Skip to content

Commit 7439179

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 678766b + cb7b913 commit 7439179

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
@@ -1934,6 +1934,7 @@ set all_icons(U$ui_index) file_merge
19341934
set all_icons(T$ui_index) file_statechange
19351935

19361936
set all_icons(_$ui_workdir) file_plain
1937+
set all_icons(A$ui_workdir) file_plain
19371938
set all_icons(M$ui_workdir) file_mod
19381939
set all_icons(D$ui_workdir) file_question
19391940
set all_icons(U$ui_workdir) file_merge
@@ -1960,6 +1961,7 @@ foreach i {
19601961
{A_ {mc "Staged for commit"}}
19611962
{AM {mc "Portions staged for commit"}}
19621963
{AD {mc "Staged for commit, missing"}}
1964+
{AA {mc "Intended to be added"}}
19631965

19641966
{_D {mc "Missing"}}
19651967
{D_ {mc "Staged for removal"}}

git-gui/lib/diff.tcl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,8 @@ proc apply_or_revert_hunk {x y revert} {
553553
if {$current_diff_side eq $ui_index} {
554554
set failed_msg [mc "Failed to unstage selected hunk."]
555555
lappend apply_cmd --reverse --cached
556-
if {[string index $mi 0] ne {M}} {
556+
set file_state [string index $mi 0]
557+
if {$file_state ne {M} && $file_state ne {A}} {
557558
unlock_index
558559
return
559560
}
@@ -566,7 +567,8 @@ proc apply_or_revert_hunk {x y revert} {
566567
lappend apply_cmd --cached
567568
}
568569

569-
if {[string index $mi 1] ne {M}} {
570+
set file_state [string index $mi 1]
571+
if {$file_state ne {M} && $file_state ne {A}} {
570572
unlock_index
571573
return
572574
}
@@ -658,7 +660,8 @@ proc apply_or_revert_range_or_line {x y revert} {
658660
set failed_msg [mc "Failed to unstage selected line."]
659661
set to_context {+}
660662
lappend apply_cmd --reverse --cached
661-
if {[string index $mi 0] ne {M}} {
663+
set file_state [string index $mi 0]
664+
if {$file_state ne {M} && $file_state ne {A}} {
662665
unlock_index
663666
return
664667
}
@@ -673,7 +676,8 @@ proc apply_or_revert_range_or_line {x y revert} {
673676
lappend apply_cmd --cached
674677
}
675678

676-
if {[string index $mi 1] ne {M}} {
679+
set file_state [string index $mi 1]
680+
if {$file_state ne {M} && $file_state ne {A}} {
677681
unlock_index
678682
return
679683
}

0 commit comments

Comments
 (0)