{"thread":{"id":"22255","subject":"Get rid of refreshing cache after \"git commit\"?","startedAt":"2010-01-17T08:16:46Z","lastAt":"2010-01-17T08:27:28Z","messageCount":2,"participants":["Nguyen Thai Ngoc Duy","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"131924","messageId":"fcaeb9bf1001170016q5e285201r36f6030579cfa605@mail.gmail.com","threadId":"22255","inReplyTo":null,"subject":"Get rid of refreshing cache after \"git commit\"?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-01-17T08:16:46Z","receivedAt":"2010-01-17T08:16:46Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nThe current \"git commit\" refreshes cache and writes out after a\ncommit. I dug back in history to see how it was introduced. It looks\nlike from the very first days of \"git commit\", which was\ngit-commit-script at that time, git-update-cache was called on\nspecified paths, until commit 22cff6a (git-commit: pass explicit path\nto git-diff-files. - 2005-08-16) started to do \"git-update-cache -q\n--refresh\" without paths and the tradition keeps going until today.\n\nNowadays almost (all?) porcelain commands silently refresh index\nbefore doing anything relating to worktree, I wonder if this tradition\nis still necessary. On (again) gentoo-x86 repository, taking out the\nrefresh part could cut down about 1 sec on total 3 secs from \"git\ncommit -m foo\".\n-- \nDuy\n"},{"id":"131925","messageId":"7vljfx87bj.fsf@alter.siamese.dyndns.org","threadId":"22255","inReplyTo":"fcaeb9bf1001170016q5e285201r36f6030579cfa605@mail.gmail.com","subject":"Re: Get rid of refreshing cache after \"git commit\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-01-17T08:27:28Z","receivedAt":"2010-01-17T08:27:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> Nowadays almost (all?) porcelain commands silently refresh index\n> before doing anything relating to worktree, I wonder if this tradition\n> is still necessary.\n\nInside \"commit\", various checks to see if/how worktree files are changed\nare attempted by the libified diff-files/diff-index and they must be used\nafter you refresh the cache entries.\n\n\"git commit\" (without paths) does not necessarily have to when you can\nprove that the user never looks at .git/COMMIT_EDITMSG (e.g. \"-F file\" is\ngiven without \"-e\"), but otherwise you need to refresh the index to show\nthe correct status in the message buffer.\n\n\"git commit paths...\"  must refresh the named paths (not necessarily the\nwhole index), but again you would need the whole index to show the status\ncorrectly.\n"}]}