git-gui: Update in memory states after commit.
In order to allow the user to toggle include/exclude from next commit for files which were partially included in the last commit we need the current index mode+sha1 data stored in our file_states array. For any partially included file we have this information from diff-files, so we just have to copy it over to the diff-index portion of our state array. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 19, 2006 at 03:38 UTC
a29481e2123c2fd14fbcb2531be9de16adf21779
1 file changed
+24
-14
git-gui
+24
-14
@@ -922,7 +922,7 @@ proc commit_writetree {curHEAD msg} {
922
proc commit_committree {fd_wt curHEAD msg} {
923
global single_commit gitdir HEAD PARENT commit_type tcl_platform
924
global ui_status_value ui_comm selected_commit_type
925
- global file_states selected_paths
925
+ global file_states selected_paths rescan_active
926
927
gets $fd_wt tree_id
928
if {$tree_id eq {} || [catch {close $fd_wt} err]} {
@@ -1018,7 +1018,7 @@ proc commit_committree {fd_wt curHEAD msg} {
1018
1019
if {$single_commit} do_quit
1020
1021
- # -- Update status without invoking any git commands.
1021
+ # -- Update in memory status
1022
#
1023
set commit_type normal
1024
set selected_commit_type new
@@ -1029,18 +1029,29 @@ proc commit_committree {fd_wt curHEAD msg} {
1029
set s $file_states($path)
1030
set m [lindex $s 0]
1031
switch -glob -- $m {
1032
- DD -
1033
- AO {set m __}
1034
- A? -
1035
- M? -
1036
- D? {set m _[string index $m 1]}
1037
- }
1038
-
1039
- if {$m eq {__}} {
1032
+ _O -
1033
+ _M -
1034
+ _D {continue}
1035
+ __ -
1036
+ A_ -
1037
+ M_ -
1038
+ DD {
1039
unset file_states($path)
1040
catch {unset selected_paths($path)}
1042
- } else {
1043
- lset file_states($path) 0 $m
1041
+ }
1042
+ DO {
1043
+ set file_states($path) [list _O [lindex $s 1] {} {}]
1044
+ }
1045
+ AM -
1046
+ AD -
1047
+ MM -
1048
+ DM {
1049
+ set file_states($path) [list \
1050
+ _[string index $m 1] \
1051
+ [lindex $s 1] \
1052
+ [lindex $s 3] \
1053
+ {}]
1054
+ }
1055
}
1056
}
1057
@@ -1661,9 +1672,9 @@ foreach i {
1672
{AD o question "Added (but now gone)"}
1673
1674
{_D i question "Missing"}
1664
- {D_ i removed "Removed by commit"}
1675
{DD i removed "Removed by commit"}
1676
{DO i removed "Removed (still exists)"}
1677
+ {DM i removed "Removed (but modified)"}
1678
1679
{UM i merge "Merge conflicts"}
1680
{U_ i merge "Merge conflicts"}
@@ -2424,7 +2435,6 @@ proc toggle_or_diff {w x y} {
2435
}
2436
switch -glob -- [lindex $file_states($path) 0] {
2437
A_ -
2427
- AO -
2438
M_ -
2439
DD -
2440
D_ {