@matheusbsbs / matheus-bagliano / commits / dba07411da
Fork 0

git-gui: Skip unnecessary read-tree work during checkout

I totally missed this obvious optimization in the checkout code path. If our current repository HEAD is actually at the commit we are moving to, and we agreed to perform this switch earlier, then we have no files to update in the working directory and any stale mtimes are simply not of consequence right now. We can pretend like we ran a read-tree and skip right into the post-read-tree work, such as updating the branch and setting the symbolic-ref. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 20, 2007 at 03:56 UTC dba07411da8debf9e39bf8d28f642b09c5794aff
1 file changed +3 -1
lib/checkout_op.tcl
+3 -1
@@ -266,7 +266,9 @@ The rescan will be automatically started now.
266 return
267 }
268
269 - if {[is_config_true gui.trustmtime]} {
269 + if {$curHEAD eq $new_hash} {
270 + _after_readtree $this
271 + } elseif {[is_config_true gui.trustmtime]} {
272 _readtree $this
273 } else {
274 ui_status {Refreshing file status...}