aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-07-08 01:28:18 -0700
committerJunio C Hamano <gitster@pobox.com>2007-07-08 18:24:18 -0700
commitb24f56d60491416a1c5a8fc71863bbaa0f390f23 (patch)
treecb5db51d5c5a0cf0f3818d046134d25f4825406c
parentd3a93dc96786847f9d148da42ecadee5f027c9a7 (diff)
downloadgit-b24f56d60491416a1c5a8fc71863bbaa0f390f23.tar.gz
git-b24f56d60491416a1c5a8fc71863bbaa0f390f23.tar.xz
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>
-rwxr-xr-xgit-stash.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/git-stash.sh b/git-stash.sh
index eac555138..de13dd181 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -58,11 +58,11 @@ save_stash () {
# state of the working tree
w_tree=$( (
+ rm -f "$TMP-index" &&
+ cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
GIT_INDEX_FILE="$TMP-index" &&
export GIT_INDEX_FILE &&
-
- rm -f "$TMP-index" &&
- git read-tree $i_tree &&
+ git read-tree -m $i_tree &&
git add -u &&
git write-tree &&
rm -f "$TMP-index"