summaryrefslogtreecommitdiff
path: root/git-gui
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-11-19 06:20:42 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2006-11-19 06:20:42 (GMT)
commit51cc47fedaaea46a556aac7d4e32683abca1b57b (patch)
tree30480910a9644befa4deb776884cfbaa1abb7fc6 /git-gui
parent0d5709cf88e9f242e0e31ccbda42a1c827c90a22 (diff)
downloadgit-51cc47fedaaea46a556aac7d4e32683abca1b57b.zip
git-51cc47fedaaea46a556aac7d4e32683abca1b57b.tar.gz
git-51cc47fedaaea46a556aac7d4e32683abca1b57b.tar.bz2
git-gui: Correct toggling of added/untracked status for new files.
New files also lack index data from diff-files therefore we cannot use their diff-files index data when we update-index. Instead we can use the fact that Git has them hardcoded as "0 0{40}" and do the same thing ourselves. This way you can toggle an untracked file into added status and back out to untracked. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui')
-rwxr-xr-xgit-gui7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-gui b/git-gui
index 3f7e408..75d1640 100755
--- a/git-gui
+++ b/git-gui
@@ -1174,9 +1174,10 @@ proc short_path {path} {
}
set next_icon_id 0
+set null_sha1 [string repeat 0 40]
proc merge_state {path new_state {head_info {}} {index_info {}}} {
- global file_states next_icon_id
+ global file_states next_icon_id null_sha1
set s0 [string index $new_state 0]
set s1 [string index $new_state 1]
@@ -1197,7 +1198,9 @@ proc merge_state {path new_state {head_info {}} {index_info {}}} {
if {$s1 eq {?}} {set s1 [string index $state 1]} \
elseif {$s1 eq {_}} {set s1 _}
- if {$s0 ne {_} && [string index $state 0] eq {_}
+ if {$s0 eq {A} && $s1 eq {_} && $head_info eq {}} {
+ set head_info [list 0 $null_sha1]
+ } elseif {$s0 ne {_} && [string index $state 0] eq {_}
&& $head_info eq {}} {
set head_info $index_info
}