add git gc command

This commit is contained in:
0xLogN 2022-04-29 18:34:11 -07:00
parent 9d76f28ed9
commit 1e1c3a46e6
No known key found for this signature in database
GPG key ID: 0D6D73BF275230F5
2 changed files with 10 additions and 2 deletions

View file

@ -208,6 +208,14 @@ var commandConfig = {
} }
}, },
gc: {
displayName: 'gc',
regex: /^git +gc($|\s)/,
execute: function(engine, command) {
engine.pruneTree(false);
}
},
pull: { pull: {
regex: /^git +pull($|\s)/, regex: /^git +pull($|\s)/,
options: [ options: [

View file

@ -1836,7 +1836,7 @@ GitEngine.prototype.pruneTreeAndPlay = function() {
this.animationFactory.playRefreshAnimationSlow(this.gitVisuals); this.animationFactory.playRefreshAnimationSlow(this.gitVisuals);
}; };
GitEngine.prototype.pruneTree = function() { GitEngine.prototype.pruneTree = function(doPrintWarning = true) {
var set = this.getUpstreamBranchSet(); var set = this.getUpstreamBranchSet();
// don't prune commits that HEAD depends on // don't prune commits that HEAD depends on
var headSet = Graph.getUpstreamSet(this, 'HEAD'); var headSet = Graph.getUpstreamSet(this, 'HEAD');
@ -1857,7 +1857,7 @@ GitEngine.prototype.pruneTree = function() {
// the switch sync // the switch sync
return; return;
} }
if (this.command) { if (this.command && doPrintWarning) {
this.command.addWarning(intl.str('hg-prune-tree')); this.command.addWarning(intl.str('hg-prune-tree'));
} }