Skip to content

Commit 33d83ae

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge 'git-gui/js/intent-to-add'
This merges the current version of the patch that tries to address Git GUI's problems with intent-to-add files. This patch will likely be improved substantially before it is merged into Git GUI's main branch, but we want to have _something_ resembling a fix already in Git for Windows v2.29.0. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents ae929a2 + 6511f06 commit 33d83ae

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

git-gui/git-gui.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,7 @@ set all_icons(U$ui_index) file_merge
20872087
set all_icons(T$ui_index) file_statechange
20882088
20892089
set all_icons(_$ui_workdir) file_plain
2090+
set all_icons(A$ui_workdir) file_plain
20902091
set all_icons(M$ui_workdir) file_mod
20912092
set all_icons(D$ui_workdir) file_question
20922093
set all_icons(U$ui_workdir) file_merge
@@ -2113,6 +2114,7 @@ foreach i {
21132114
{A_ {mc "Staged for commit"}}
21142115
{AM {mc "Portions staged for commit"}}
21152116
{AD {mc "Staged for commit, missing"}}
2117+
{AA {mc "Intended to be added"}}
21162118
21172119
{_D {mc "Missing"}}
21182120
{D_ {mc "Staged for removal"}}

git-gui/lib/diff.tcl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,8 @@ proc apply_or_revert_hunk {x y revert} {
582582
if {$current_diff_side eq $ui_index} {
583583
set failed_msg [mc "Failed to unstage selected hunk."]
584584
lappend apply_cmd --reverse --cached
585-
if {[string index $mi 0] ne {M}} {
585+
set file_state [string index $mi 0]
586+
if {$file_state ne {M} && $file_state ne {A}} {
586587
unlock_index
587588
return
588589
}
@@ -595,7 +596,8 @@ proc apply_or_revert_hunk {x y revert} {
595596
lappend apply_cmd --cached
596597
}
597598

598-
if {[string index $mi 1] ne {M}} {
599+
set file_state [string index $mi 1]
600+
if {$file_state ne {M} && $file_state ne {A}} {
599601
unlock_index
600602
return
601603
}
@@ -687,7 +689,8 @@ proc apply_or_revert_range_or_line {x y revert} {
687689
set failed_msg [mc "Failed to unstage selected line."]
688690
set to_context {+}
689691
lappend apply_cmd --reverse --cached
690-
if {[string index $mi 0] ne {M}} {
692+
set file_state [string index $mi 0]
693+
if {$file_state ne {M} && $file_state ne {A}} {
691694
unlock_index
692695
return
693696
}
@@ -702,7 +705,8 @@ proc apply_or_revert_range_or_line {x y revert} {
702705
lappend apply_cmd --cached
703706
}
704707

705-
if {[string index $mi 1] ne {M}} {
708+
set file_state [string index $mi 1]
709+
if {$file_state ne {M} && $file_state ne {A}} {
706710
unlock_index
707711
return
708712
}

0 commit comments

Comments
 (0)