Resolves #483 case sensitivity

This commit is contained in:
Peter Cottle 2018-09-28 20:29:50 -05:00
parent 30ba0e6a39
commit e8d3bf8667
2 changed files with 11 additions and 0 deletions

View file

@ -23,6 +23,13 @@ describe('Git', function() {
);
});
it('handles lower case branch options', function() {
expectTreeAsync(
'git branch banana c0; git commit; git checkout -b side banana; git branch -d banana;git branch -f another c1; git commit',
'{"branches":{"master":{"target":"C2","id":"master"},"side":{"target":"C3","id":"side"},"another":{"target":"C1","id":"another"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C0"],"id":"C3"}},"HEAD":{"target":"side","id":"HEAD"}}'
);
});
it('handles branch options', function() {
expectTreeAsync(
'git branch banana C0; git commit; git checkout -b side banana; git branch -d banana;git branch -f another C1; git commit',

View file

@ -1663,6 +1663,10 @@ GitEngine.prototype.resolveStringRef = function(ref) {
if (this.refs[ref]) {
return this.refs[ref];
}
// Commit hashes like C4 are case insensitive
if (ref.match(/^c\d+$/) && this.refs[ref.toUpperCase()]) {
return this.refs[ref.toUpperCase()];
}
// Attempt to split ref string into a reference and a string of ~ and ^ modifiers.
var startRef = null;