Skip to content

Commit

Permalink
Merge 'git-gui/js/intent-to-add'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dscho committed Oct 18, 2020
2 parents e2ca5f0 + 41589cc commit cc9d759
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions git-gui/git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,7 @@ set all_icons(U$ui_index) file_merge
set all_icons(T$ui_index) file_statechange
set all_icons(_$ui_workdir) file_plain
set all_icons(A$ui_workdir) file_plain
set all_icons(M$ui_workdir) file_mod
set all_icons(D$ui_workdir) file_question
set all_icons(U$ui_workdir) file_merge
Expand All @@ -2116,6 +2117,7 @@ foreach i {
{A_ {mc "Staged for commit"}}
{AM {mc "Portions staged for commit"}}
{AD {mc "Staged for commit, missing"}}
{AA {mc "Intended to be added"}}
{_D {mc "Missing"}}
{D_ {mc "Staged for removal"}}
Expand Down
12 changes: 8 additions & 4 deletions git-gui/lib/diff.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ proc apply_or_revert_hunk {x y revert} {
if {$current_diff_side eq $ui_index} {
set failed_msg [mc "Failed to unstage selected hunk."]
lappend apply_cmd --reverse --cached
if {[string index $mi 0] ne {M}} {
set file_state [string index $mi 0]
if {$file_state ne {M} && $file_state ne {A}} {
unlock_index
return
}
Expand All @@ -595,7 +596,8 @@ proc apply_or_revert_hunk {x y revert} {
lappend apply_cmd --cached
}

if {[string index $mi 1] ne {M}} {
set file_state [string index $mi 1]
if {$file_state ne {M} && $file_state ne {A}} {
unlock_index
return
}
Expand Down Expand Up @@ -687,7 +689,8 @@ proc apply_or_revert_range_or_line {x y revert} {
set failed_msg [mc "Failed to unstage selected line."]
set to_context {+}
lappend apply_cmd --reverse --cached
if {[string index $mi 0] ne {M}} {
set file_state [string index $mi 0]
if {$file_state ne {M} && $file_state ne {A}} {
unlock_index
return
}
Expand All @@ -702,7 +705,8 @@ proc apply_or_revert_range_or_line {x y revert} {
lappend apply_cmd --cached
}

if {[string index $mi 1] ne {M}} {
set file_state [string index $mi 1]
if {$file_state ne {M} && $file_state ne {A}} {
unlock_index
return
}
Expand Down

0 comments on commit cc9d759

Please sign in to comment.