From e07ef451a07083f20411e61fb24dbee32a3b3b61 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Fri, 14 Nov 2025 15:12:57 -0500 Subject: [PATCH 1/2] fix: diff view does not use --cached for unmerged changes --- CHANGELOG.md | 1 + git-webui/release/share/git-webui/webui/js/git-webui.js | 2 +- git-webui/src/share/git-webui/webui/js/git-webui.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13957879..546ee5a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed - Web UI workspace view labels changes as Merge Conflict if there are unmerged changes (#890) +- Web UI workspace view displays diff correctly for files with merge conflicts (#898) ## [2.14.0] - 2025-11-07 diff --git a/git-webui/release/share/git-webui/webui/js/git-webui.js b/git-webui/release/share/git-webui/webui/js/git-webui.js index ff17702d..daf96ed3 100644 --- a/git-webui/release/share/git-webui/webui/js/git-webui.js +++ b/git-webui/release/share/git-webui/webui/js/git-webui.js @@ -3210,7 +3210,7 @@ webui.NewChangedFilesView = function(workspaceView) { self.fileToDiff = $(element).attr("data-filename"); var indexStatus = $(element).attr("data-index-status"); var gitOpts = []; - if (indexStatus != " ") { + if ((indexStatus != " ") && (indexStatus != "U")) { gitOpts.push("--cached"); } workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage"); diff --git a/git-webui/src/share/git-webui/webui/js/git-webui.js b/git-webui/src/share/git-webui/webui/js/git-webui.js index ff17702d..daf96ed3 100644 --- a/git-webui/src/share/git-webui/webui/js/git-webui.js +++ b/git-webui/src/share/git-webui/webui/js/git-webui.js @@ -3210,7 +3210,7 @@ webui.NewChangedFilesView = function(workspaceView) { self.fileToDiff = $(element).attr("data-filename"); var indexStatus = $(element).attr("data-index-status"); var gitOpts = []; - if (indexStatus != " ") { + if ((indexStatus != " ") && (indexStatus != "U")) { gitOpts.push("--cached"); } workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage"); From 284b5d3f991113cc31973c61adba0b98e65070d9 Mon Sep 17 00:00:00 2001 From: Pravin Barton <9560941+isc-pbarton@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:07:37 -0500 Subject: [PATCH 2/2] fix: merge conflicts with deletes etc display as merge conflict too --- .../release/share/git-webui/webui/js/git-webui.js | 14 +++++++++++--- .../src/share/git-webui/webui/js/git-webui.js | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/git-webui/release/share/git-webui/webui/js/git-webui.js b/git-webui/release/share/git-webui/webui/js/git-webui.js index daf96ed3..53cfdfe7 100644 --- a/git-webui/release/share/git-webui/webui/js/git-webui.js +++ b/git-webui/release/share/git-webui/webui/js/git-webui.js @@ -37,6 +37,9 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade" "#e47b07", "#e36920", "#d34e2a", "#ec3b24", "#ba3d99", "#9d45c9", "#4f5aec", "#615dcf", "#3286cf", "#00abca", "#279227", "#3a980c", "#6c7f00", "#ab8b0a", "#b56427", "#757575", "#ff911a", "#fc8120", "#e7623e", "#fa5236", "#ca4da9", "#a74fd3", "#5a68ff", "#6d69db", "#489bd9", "#00bcde", "#36a436", "#47a519", "#798d0a", "#c1a120", "#bf7730", "#8e8e8e"] +webui.UNMERGED_STATUSES = ["DD","AU","UD","UA","DU","AA","UU"]; +webui.STAGED_STATUSES = ["M","A","D","R","C"]; + webui.peopleIcon = ''+ ''+ ''+ @@ -2687,7 +2690,10 @@ webui.NewChangedFilesView = function(workspaceView) { formCheck.attr("data-index-status", indexStatus); formCheck.attr("data-working-tree-status", workingTreeStatus); - var displayStatus = (indexStatus == " ") ? workingTreeStatus : indexStatus; + var statusPair = (indexStatus || "") + (workingTreeStatus || ""); + var displayStatus = (webui.UNMERGED_STATUSES.indexOf(statusPair) > -1) ? "U" + : (indexStatus == " ") ? workingTreeStatus + : indexStatus; var checkboxInput; @@ -3209,8 +3215,10 @@ webui.NewChangedFilesView = function(workspaceView) { self.refreshDiff = function(element) { self.fileToDiff = $(element).attr("data-filename"); var indexStatus = $(element).attr("data-index-status"); + var workingTreeStatus = $(element).attr("data-working-tree-status"); + var statusPair = (indexStatus || "") + (workingTreeStatus || ""); var gitOpts = []; - if ((indexStatus != " ") && (indexStatus != "U")) { + if ((webui.STAGED_STATUSES.indexOf(indexStatus) > -1) && (webui.UNMERGED_STATUSES.indexOf(statusPair) == -1)) { gitOpts.push("--cached"); } workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage"); @@ -3434,4 +3442,4 @@ $(function () { e.preventDefault(); location.reload() }); -}); \ No newline at end of file +}); diff --git a/git-webui/src/share/git-webui/webui/js/git-webui.js b/git-webui/src/share/git-webui/webui/js/git-webui.js index daf96ed3..53cfdfe7 100644 --- a/git-webui/src/share/git-webui/webui/js/git-webui.js +++ b/git-webui/src/share/git-webui/webui/js/git-webui.js @@ -37,6 +37,9 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade" "#e47b07", "#e36920", "#d34e2a", "#ec3b24", "#ba3d99", "#9d45c9", "#4f5aec", "#615dcf", "#3286cf", "#00abca", "#279227", "#3a980c", "#6c7f00", "#ab8b0a", "#b56427", "#757575", "#ff911a", "#fc8120", "#e7623e", "#fa5236", "#ca4da9", "#a74fd3", "#5a68ff", "#6d69db", "#489bd9", "#00bcde", "#36a436", "#47a519", "#798d0a", "#c1a120", "#bf7730", "#8e8e8e"] +webui.UNMERGED_STATUSES = ["DD","AU","UD","UA","DU","AA","UU"]; +webui.STAGED_STATUSES = ["M","A","D","R","C"]; + webui.peopleIcon = ''+ ''+ ''+ @@ -2687,7 +2690,10 @@ webui.NewChangedFilesView = function(workspaceView) { formCheck.attr("data-index-status", indexStatus); formCheck.attr("data-working-tree-status", workingTreeStatus); - var displayStatus = (indexStatus == " ") ? workingTreeStatus : indexStatus; + var statusPair = (indexStatus || "") + (workingTreeStatus || ""); + var displayStatus = (webui.UNMERGED_STATUSES.indexOf(statusPair) > -1) ? "U" + : (indexStatus == " ") ? workingTreeStatus + : indexStatus; var checkboxInput; @@ -3209,8 +3215,10 @@ webui.NewChangedFilesView = function(workspaceView) { self.refreshDiff = function(element) { self.fileToDiff = $(element).attr("data-filename"); var indexStatus = $(element).attr("data-index-status"); + var workingTreeStatus = $(element).attr("data-working-tree-status"); + var statusPair = (indexStatus || "") + (workingTreeStatus || ""); var gitOpts = []; - if ((indexStatus != " ") && (indexStatus != "U")) { + if ((webui.STAGED_STATUSES.indexOf(indexStatus) > -1) && (webui.UNMERGED_STATUSES.indexOf(statusPair) == -1)) { gitOpts.push("--cached"); } workspaceView.diffView.update("diff", gitOpts, self.fileToDiff, "stage"); @@ -3434,4 +3442,4 @@ $(function () { e.preventDefault(); location.reload() }); -}); \ No newline at end of file +});