Skip to content

Use case-insensitive matching for Git error message "Not a valid object name" #152

@mdferdousalam

Description

@mdferdousalam

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

This repo currently uses exact string equality to detect this Git error, which will break when Git ships the updated message.

Affected files

  • src/scms/git.js — `error.stderr === 'fatal: Not a valid object name HEAD'`

Suggested fix

Use case-insensitive comparison, for example:
```javascript
error.stderr.toLowerCase() === 'fatal: not a valid object name head'
```

Or more robustly:
```javascript
error.stderr.toLowerCase().includes('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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions