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>
This commit is contained in:
@ -58,11 +58,11 @@ save_stash () {
|
|||||||
|
|
||||||
# state of the working tree
|
# state of the working tree
|
||||||
w_tree=$( (
|
w_tree=$( (
|
||||||
|
rm -f "$TMP-index" &&
|
||||||
|
cp -p ${GIT_INDEX_FILE-"$GIT_DIR/index"} "$TMP-index" &&
|
||||||
GIT_INDEX_FILE="$TMP-index" &&
|
GIT_INDEX_FILE="$TMP-index" &&
|
||||||
export GIT_INDEX_FILE &&
|
export GIT_INDEX_FILE &&
|
||||||
|
git read-tree -m $i_tree &&
|
||||||
rm -f "$TMP-index" &&
|
|
||||||
git read-tree $i_tree &&
|
|
||||||
git add -u &&
|
git add -u &&
|
||||||
git write-tree &&
|
git write-tree &&
|
||||||
rm -f "$TMP-index"
|
rm -f "$TMP-index"
|
||||||
|
Reference in New Issue
Block a user