git-stash: try reusing cached stat info as much as possible
Earlier when we read a tree into a temporary index, we read it from scratch. Start from the current index and use read-tree -m to preserve cached stat information as much as possible, in order to speed up "git add -u". This makes "git stash" usable in a source tree of nontrivial size. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 8, 2007 at 01:28 UTC
b24f56d60491416a1c5a8fc71863bbaa0f390f23
1 file changed
+3
-3
git-stash.sh
+3
-3
@@ -58,11 +58,11 @@ save_stash () {
58
59
# state of the working tree
60
w_tree=$( (
61
+ rm -f "$TMP-index" &&
62
+ cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
63
GIT_INDEX_FILE="$TMP-index" &&
64
export GIT_INDEX_FILE &&
63
-
64
- rm -f "$TMP-index" &&
65
- git read-tree $i_tree &&
65
+ git read-tree -m $i_tree &&
66
git add -u &&
67
git write-tree &&
68
rm -f "$TMP-index"