Use case-insensitive matching for Git error message "Not a valid object name"
Summary
Git is changing the capitalization of its fatal: Not a valid object name error message to lowercase (fatal: not a valid object name) to follow Git's CodingGuidelines, which state that error messages should begin with a lowercase letter.
This change is under review on the Git mailing list: https://lore.kernel.org/git/[email protected]
Problem
Harness currently uses case-sensitive string matching to detect this Git error, which will break when Git ships the updated message.
Affected files
- git/api/merge.go — `strings.HasPrefix(msg, "fatal: Not a valid object name")`
- git/api/tree.go — `strings.Contains(...)` with case-sensitive match
Suggested fix
Use case-insensitive comparison, for example: ```go strings.Contains(strings.ToLower(msg), "not a valid object name") ```
This will work with both the current and future Git versions.
Timeline
The Git change is currently under review and will likely be included in a future Git release. Fixing the matching now ensures forward compatibility.
Source: harness/harness