diff --git a/src/js/git/commands.js b/src/js/git/commands.js index 03b68cd0..e08122dd 100644 --- a/src/js/git/commands.js +++ b/src/js/git/commands.js @@ -208,6 +208,14 @@ var commandConfig = { } }, + gc: { + displayName: 'gc', + regex: /^git +gc($|\s)/, + execute: function(engine, command) { + engine.pruneTree(false); + } + }, + pull: { regex: /^git +pull($|\s)/, options: [ diff --git a/src/js/git/index.js b/src/js/git/index.js index b5970d2f..c624be11 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1836,7 +1836,7 @@ GitEngine.prototype.pruneTreeAndPlay = function() { this.animationFactory.playRefreshAnimationSlow(this.gitVisuals); }; -GitEngine.prototype.pruneTree = function() { +GitEngine.prototype.pruneTree = function(doPrintWarning = true) { var set = this.getUpstreamBranchSet(); // don't prune commits that HEAD depends on var headSet = Graph.getUpstreamSet(this, 'HEAD'); @@ -1857,7 +1857,7 @@ GitEngine.prototype.pruneTree = function() { // the switch sync return; } - if (this.command) { + if (this.command && doPrintWarning) { this.command.addWarning(intl.str('hg-prune-tree')); }