Skip to content

Commit c76fea6

Browse files
committed
simplify reRunning diff update
1 parent 3e77260 commit c76fea6

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

git-webui/src/share/git-webui/webui/js/git-webui.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,14 +1524,8 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15241524

15251525
var self = this;
15261526

1527-
self.update = function(cmd, diffOpts, file, mode, reRun) {
1528-
if (reRun) {
1529-
// Rerun with previous inputs
1530-
cmd = this.cmd
1531-
diffOpts = this.diffOpts
1532-
file = this.file
1533-
mode = this.mode
1534-
} else if (cmd || diffOpts || file || mode) {
1527+
self.update = function(cmd, diffOpts, file, mode) {
1528+
if (cmd || diffOpts || file || mode) {
15351529
// if new input, update all
15361530
this.cmd = cmd
15371531
this.diffOpts = diffOpts
@@ -1589,6 +1583,10 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
15891583
}
15901584
};
15911585

1586+
self.reRun = function() {
1587+
self.update(this.cmd, this.diffOpts, this.file, this.mode)
1588+
}
1589+
15921590
self.refresh = function(diff) {
15931591
self.currentDiff = diff;
15941592
self.diffHeader = "";
@@ -1802,24 +1800,24 @@ webui.DiffView = function(sideBySide, hunkSelectionAllowed, parent, stashedCommi
18021800

18031801
self.addContext = function() {
18041802
self.context += 3;
1805-
self.update(...[,,,,],1);
1803+
self.reRun();
18061804
}
18071805

18081806
self.removeContext = function() {
18091807
if (self.context > 3) {
18101808
self.context -= 3;
1811-
self.update(...[,,,,],1);
1809+
self.reRun();
18121810
}
18131811
}
18141812

18151813
self.allContext = function() {
18161814
self.complete = !self.complete;
1817-
self.update(...[,,,,],1);
1815+
self.reRun();
18181816
}
18191817

18201818
self.toggleIgnoreWhitespace = function() {
18211819
self.ignoreWhitespace = !self.ignoreWhitespace;
1822-
self.update(...[,,,,],1);
1820+
self.reRun();
18231821
}
18241822

18251823
self.handleClick = function(event) {

0 commit comments

Comments
 (0)