{"thread":{"id":"8930","subject":"[PATCH] git-stash: try reusing cached stat info as much as possible","startedAt":"2007-07-08T18:43:04Z","lastAt":"2007-07-08T18:43:04Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46777","messageId":"7vvecu20uf.fsf@assigned-by-dhcp.cox.net","threadId":"8930","inReplyTo":null,"subject":"[PATCH] git-stash: try reusing cached stat info as much as possible","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-08T18:43:04Z","receivedAt":"2007-07-08T18:43:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Earlier when we read a tree into a temporary index, we read it\nfrom scratch.  Start from the current index and use read-tree -m\nto preserve cached stat information as much as possible, in\norder to speed up \"git add -u\".  This makes \"git stash\" usable\nin a source tree of nontrivial size.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-stash.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex eac5551..de13dd1 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -58,11 +58,11 @@ save_stash () {\n \n \t# state of the working tree\n \tw_tree=$( (\n+\t\trm -f \"$TMP-index\" &&\n+\t\tcp -p ${GIT_INDEX_FILE-\"$GIT_DIR/index\"} \"$TMP-index\" &&\n \t\tGIT_INDEX_FILE=\"$TMP-index\" &&\n \t\texport GIT_INDEX_FILE &&\n-\n-\t\trm -f \"$TMP-index\" &&\n-\t\tgit read-tree $i_tree &&\n+\t\tgit read-tree -m $i_tree &&\n \t\tgit add -u &&\n \t\tgit write-tree &&\n \t\trm -f \"$TMP-index\"\n-- \n1.5.3.rc0.858.gd08b\n"}]}