Skip to contentSkip to conversation

git-gui: Unstaging a partly staged entry didn't update file_states correctly

PATCH Applied Jens Lehmann 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Unstaging a partly staged entry didn't update file_states correctly

When unstaging a partly staged file or submodule, the file_states list was not updated properly (unless unstaged linewise). Its index_info part did not contain the former head_info as it should have but kept its old value.

This seems not to have had any bad effects but diminishes the value of the file_states list for future enhancements.

---

I noticed this while whipping up another - soon to be released - patch where the file_states list is used to access the hash values of staged and unstaged changes.

AFAICS this buglet did not have negative effects until now because the index_info hash value is not used.

 git-gui/git-gui.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
git-gui/git-gui.sh +3 -0
index 037a1f2..9495789 100755
@@ -1613,6 +1613,9 @@ proc merge_state {path new_state {head_info {}} {index_info {}}} {
 	} elseif {$s0 ne {_} && [string index $state 0] eq {_}
 		&& $head_info eq {}} {
 		set head_info $index_info
+	} elseif {$s0 eq {_} && [string index $state 0] ne {_}} {
+		set index_info $head_info
+		set head_info {}
 	}
 
 	set file_states($path) [list $s0$s1 $icon \
Signature · 1 line
1.6.6.rc1.245.gcec33.dirty
#1 lore raw
Quoted 10 lines · Jens Lehmann

When unstaging a partly staged file or submodule, the file_states list was not updated properly (unless unstaged linewise). Its index_info part did not contain the former head_info as it should have but kept its old value.

This seems not to have had any bad effects but diminishes the value of the file_states list for future enhancements.

---

Thanks, applied.

Signature · 1 line
Shawn.