Skip to content

Commit 284b5d3

Browse files
committed
fix: merge conflicts with deletes etc display as merge conflict too
1 parent e07ef45 commit 284b5d3

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade"
3737
"#e47b07", "#e36920", "#d34e2a", "#ec3b24", "#ba3d99", "#9d45c9", "#4f5aec", "#615dcf", "#3286cf", "#00abca", "#279227", "#3a980c", "#6c7f00", "#ab8b0a", "#b56427", "#757575",
3838
"#ff911a", "#fc8120", "#e7623e", "#fa5236", "#ca4da9", "#a74fd3", "#5a68ff", "#6d69db", "#489bd9", "#00bcde", "#36a436", "#47a519", "#798d0a", "#c1a120", "#bf7730", "#8e8e8e"]
3939

40+
webui.UNMERGED_STATUSES = ["DD","AU","UD","UA","DU","AA","UU"];
41+
webui.STAGED_STATUSES = ["M","A","D","R","C"];
42+
4043
webui.peopleIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-people-fill" viewBox="0 0 16 16">'+
4144
'<path d="M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1H7zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>'+
4245
'<path fill-rule="evenodd" d="M5.216 14A2.238 2.238 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.325 6.325 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1h4.216z"/>'+
@@ -2687,7 +2690,10 @@ webui.NewChangedFilesView = function(workspaceView) {
26872690
formCheck.attr("data-index-status", indexStatus);
26882691
formCheck.attr("data-working-tree-status", workingTreeStatus);
26892692

2690-
var displayStatus = (indexStatus == " ") ? workingTreeStatus : indexStatus;
2693+
var statusPair = (indexStatus || "") + (workingTreeStatus || "");
2694+
var displayStatus = (webui.UNMERGED_STATUSES.indexOf(statusPair) > -1) ? "U"
2695+
: (indexStatus == " ") ? workingTreeStatus
2696+
: indexStatus;
26912697

26922698
var checkboxInput;
26932699

@@ -3209,8 +3215,10 @@ webui.NewChangedFilesView = function(workspaceView) {
32093215
self.refreshDiff = function(element) {
32103216
self.fileToDiff = $(element).attr("data-filename");
32113217
var indexStatus = $(element).attr("data-index-status");
3218+
var workingTreeStatus = $(element).attr("data-working-tree-status");
3219+
var statusPair = (indexStatus || "") + (workingTreeStatus || "");
32123220
var gitOpts = [];
3213-
if ((indexStatus != " ") && (indexStatus != "U")) {
3221+
if ((webui.STAGED_STATUSES.indexOf(indexStatus) > -1) && (webui.UNMERGED_STATUSES.indexOf(statusPair) == -1)) {
32143222
gitOpts.push("--cached");
32153223
}
32163224
workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage");
@@ -3434,4 +3442,4 @@ $(function () {
34343442
e.preventDefault();
34353443
location.reload()
34363444
});
3437-
});
3445+
});

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade"
3737
"#e47b07", "#e36920", "#d34e2a", "#ec3b24", "#ba3d99", "#9d45c9", "#4f5aec", "#615dcf", "#3286cf", "#00abca", "#279227", "#3a980c", "#6c7f00", "#ab8b0a", "#b56427", "#757575",
3838
"#ff911a", "#fc8120", "#e7623e", "#fa5236", "#ca4da9", "#a74fd3", "#5a68ff", "#6d69db", "#489bd9", "#00bcde", "#36a436", "#47a519", "#798d0a", "#c1a120", "#bf7730", "#8e8e8e"]
3939

40+
webui.UNMERGED_STATUSES = ["DD","AU","UD","UA","DU","AA","UU"];
41+
webui.STAGED_STATUSES = ["M","A","D","R","C"];
42+
4043
webui.peopleIcon = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-people-fill" viewBox="0 0 16 16">'+
4144
'<path d="M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1H7zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>'+
4245
'<path fill-rule="evenodd" d="M5.216 14A2.238 2.238 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.325 6.325 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1h4.216z"/>'+
@@ -2687,7 +2690,10 @@ webui.NewChangedFilesView = function(workspaceView) {
26872690
formCheck.attr("data-index-status", indexStatus);
26882691
formCheck.attr("data-working-tree-status", workingTreeStatus);
26892692

2690-
var displayStatus = (indexStatus == " ") ? workingTreeStatus : indexStatus;
2693+
var statusPair = (indexStatus || "") + (workingTreeStatus || "");
2694+
var displayStatus = (webui.UNMERGED_STATUSES.indexOf(statusPair) > -1) ? "U"
2695+
: (indexStatus == " ") ? workingTreeStatus
2696+
: indexStatus;
26912697

26922698
var checkboxInput;
26932699

@@ -3209,8 +3215,10 @@ webui.NewChangedFilesView = function(workspaceView) {
32093215
self.refreshDiff = function(element) {
32103216
self.fileToDiff = $(element).attr("data-filename");
32113217
var indexStatus = $(element).attr("data-index-status");
3218+
var workingTreeStatus = $(element).attr("data-working-tree-status");
3219+
var statusPair = (indexStatus || "") + (workingTreeStatus || "");
32123220
var gitOpts = [];
3213-
if ((indexStatus != " ") && (indexStatus != "U")) {
3221+
if ((webui.STAGED_STATUSES.indexOf(indexStatus) > -1) && (webui.UNMERGED_STATUSES.indexOf(statusPair) == -1)) {
32143222
gitOpts.push("--cached");
32153223
}
32163224
workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage");
@@ -3434,4 +3442,4 @@ $(function () {
34343442
e.preventDefault();
34353443
location.reload()
34363444
});
3437-
});
3445+
});

0 commit comments

Comments
 (0)