зеркало из https://github.com/microsoft/git.git
git-gui: Refactor file state representations.
It just felt wrong to me that I was using _ as part of the mode argument to display_file to mean "don't care/use existing" and * as part of the mode argument to mean "force to _". So instead use ? to mean "don't care/use existing" and _ to mean "force to _". The code is a lot clearer this way and hopefully it won't drive another developer insane, as it did me. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Родитель
32e0bcab59
Коммит
b676511298
20
git-gui
20
git-gui
|
@ -378,7 +378,7 @@ proc read_diff_index {fd after} {
|
||||||
incr z2 -1
|
incr z2 -1
|
||||||
display_file \
|
display_file \
|
||||||
[string range $buf_rdi $z1 $z2] \
|
[string range $buf_rdi $z1 $z2] \
|
||||||
[string index $buf_rdi [expr {$z1 - 2}]]_
|
[string index $buf_rdi [expr {$z1 - 2}]]?
|
||||||
incr c
|
incr c
|
||||||
}
|
}
|
||||||
if {$c < $n} {
|
if {$c < $n} {
|
||||||
|
@ -407,7 +407,7 @@ proc read_diff_files {fd after} {
|
||||||
incr z2 -1
|
incr z2 -1
|
||||||
display_file \
|
display_file \
|
||||||
[string range $buf_rdf $z1 $z2] \
|
[string range $buf_rdf $z1 $z2] \
|
||||||
_[string index $buf_rdf [expr {$z1 - 2}]]
|
?[string index $buf_rdf [expr {$z1 - 2}]]
|
||||||
incr c
|
incr c
|
||||||
}
|
}
|
||||||
if {$c < $n} {
|
if {$c < $n} {
|
||||||
|
@ -426,7 +426,7 @@ proc read_ls_others {fd after} {
|
||||||
set pck [split $buf_rlo "\0"]
|
set pck [split $buf_rlo "\0"]
|
||||||
set buf_rlo [lindex $pck end]
|
set buf_rlo [lindex $pck end]
|
||||||
foreach p [lrange $pck 0 end-1] {
|
foreach p [lrange $pck 0 end-1] {
|
||||||
display_file $p _O
|
display_file $p ?O
|
||||||
}
|
}
|
||||||
rescan_done $fd buf_rlo $after
|
rescan_done $fd buf_rlo $after
|
||||||
}
|
}
|
||||||
|
@ -1151,15 +1151,15 @@ proc merge_state {path new_state} {
|
||||||
set icon [lindex $info 1]
|
set icon [lindex $info 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$s0 eq {_}} {
|
if {$s0 eq {?}} {
|
||||||
set s0 [string index $state 0]
|
set s0 [string index $state 0]
|
||||||
} elseif {$s0 eq {*}} {
|
} elseif {$s0 eq {_}} {
|
||||||
set s0 _
|
set s0 _
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$s1 eq {_}} {
|
if {$s1 eq {?}} {
|
||||||
set s1 [string index $state 1]
|
set s1 [string index $state 1]
|
||||||
} elseif {$s1 eq {*}} {
|
} elseif {$s1 eq {_}} {
|
||||||
set s1 _
|
set s1 _
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1303,15 +1303,15 @@ proc write_update_index {fd pathList totalCnt batch msg after} {
|
||||||
switch -glob -- [lindex $file_states($path) 0] {
|
switch -glob -- [lindex $file_states($path) 0] {
|
||||||
AD -
|
AD -
|
||||||
MD -
|
MD -
|
||||||
_D {set new D*}
|
_D {set new D_}
|
||||||
|
|
||||||
_M -
|
_M -
|
||||||
MM -
|
MM -
|
||||||
M_ {set new M*}
|
M_ {set new M_}
|
||||||
|
|
||||||
_O -
|
_O -
|
||||||
AM -
|
AM -
|
||||||
A_ {set new A*}
|
A_ {set new A_}
|
||||||
|
|
||||||
?? {continue}
|
?? {continue}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче