This commit is contained in:
Peter Cottle 2021-03-23 08:10:10 -06:00
parent a39b4cb5da
commit 8249f01651

View file

@ -1610,6 +1610,19 @@ GitEngine.prototype.commit = function(options) {
return newCommit; return newCommit;
}; };
GitEngine.prototype.resolveNameNoPrefix = function(someRef) {
// first get the obj
var obj = this.resolveID(someRef);
if (obj.get('type') == 'commit') {
return obj.get('id');
}
if (obj.get('type') == 'branch') {
return obj.get('id').replace(/\bmaster\b/, 'main');
}
// we are dealing with HEAD
return this.resolveNameNoPrefix(obj.get('target'));
};
GitEngine.prototype.resolveName = function(someRef) { GitEngine.prototype.resolveName = function(someRef) {
// first get the obj // first get the obj
var obj = this.resolveID(someRef); var obj = this.resolveID(someRef);
@ -2740,7 +2753,7 @@ GitEngine.prototype.status = function() {
if (this.getDetachedHead()) { if (this.getDetachedHead()) {
lines.push(intl.str('git-status-detached')); lines.push(intl.str('git-status-detached'));
} else { } else {
var branchName = this.HEAD.get('target').get('id'); var branchName = this.resolveNameNoPrefix('HEAD');
lines.push(intl.str('git-status-onbranch', {branch: branchName})); lines.push(intl.str('git-status-onbranch', {branch: branchName}));
} }
lines.push('Changes to be committed:'); lines.push('Changes to be committed:');