Skip to content

Commit caf366b

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
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 <johannes.schindelin@gmx.de>
2 parents 4ef92f1 + 1cbe2bf commit caf366b

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
@@ -2086,6 +2086,7 @@ set all_icons(U$ui_index) file_merge
20862086
set all_icons(T$ui_index) file_statechange
20872087

20882088
set all_icons(_$ui_workdir) file_plain
2089+
set all_icons(A$ui_workdir) file_plain
20892090
set all_icons(M$ui_workdir) file_mod
20902091
set all_icons(D$ui_workdir) file_question
20912092
set all_icons(U$ui_workdir) file_merge
@@ -2112,6 +2113,7 @@ foreach i {
21122113
{A_ {mc "Staged for commit"}}
21132114
{AM {mc "Portions staged for commit"}}
21142115
{AD {mc "Staged for commit, missing"}}
2116+
{AA {mc "Intended to be added"}}
21152117

21162118
{_D {mc "Missing"}}
21172119
{D_ {mc "Staged for removal"}}

git-gui/lib/diff.tcl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,8 @@ proc apply_or_revert_hunk {x y revert} {
568568
if {$current_diff_side eq $ui_index} {
569569
set failed_msg [mc "Failed to unstage selected hunk."]
570570
lappend apply_cmd --reverse --cached
571-
if {[string index $mi 0] ne {M}} {
571+
set file_state [string index $mi 0]
572+
if {$file_state ne {M} && $file_state ne {A}} {
572573
unlock_index
573574
return
574575
}
@@ -581,7 +582,8 @@ proc apply_or_revert_hunk {x y revert} {
581582
lappend apply_cmd --cached
582583
}
583584

584-
if {[string index $mi 1] ne {M}} {
585+
set file_state [string index $mi 1]
586+
if {$file_state ne {M} && $file_state ne {A}} {
585587
unlock_index
586588
return
587589
}
@@ -673,7 +675,8 @@ proc apply_or_revert_range_or_line {x y revert} {
673675
set failed_msg [mc "Failed to unstage selected line."]
674676
set to_context {+}
675677
lappend apply_cmd --reverse --cached
676-
if {[string index $mi 0] ne {M}} {
678+
set file_state [string index $mi 0]
679+
if {$file_state ne {M} && $file_state ne {A}} {
677680
unlock_index
678681
return
679682
}
@@ -688,7 +691,8 @@ proc apply_or_revert_range_or_line {x y revert} {
688691
lappend apply_cmd --cached
689692
}
690693

691-
if {[string index $mi 1] ne {M}} {
694+
set file_state [string index $mi 1]
695+
if {$file_state ne {M} && $file_state ne {A}} {
692696
unlock_index
693697
return
694698
}

0 commit comments

Comments
 (0)