Re: [PATCH v5 8/9] sequencer: try to commit without forking 'git commit'
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 10, 2018, 22:40 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1801102332350.31@ZVAVAG-6OXH6DA.rhebcr.pbec.zvpebfbsg.pbz>
- In-Reply-To
- <20180110205351.GA73826@aiede.svl.corp.google.com>
Hi,
On Wed, 10 Jan 2018, Jonathan Nieder wrote:
Show 17 quoted lines
> Phillip Wood wrote: > > > From: Phillip Wood <phillip.wood@dunelm.org.uk> > > > > If the commit message does not need to be edited then create the > > commit without forking 'git commit'. Taking the best time of ten runs > > with a warm cache this reduces the time taken to cherry-pick 10 > > commits by 27% (from 282ms to 204ms), and the time taken by 'git > > rebase --continue' to pick 10 commits by 45% (from 386ms to 212ms) on > > my computer running linux. Some of greater saving for rebase is > > because it no longer wastes time creating the commit summary just to > > throw it away. > > Neat! Dmitry Torokhov (cc-ed) noticed[1] that this causes the > prepare-commit-msg hook not to be invoked, which I think is > unintentional. Should we check for such a hook and take the slowpath > when it is present?
We could also easily recreate the functionality:
if (find_hook("pre-commit")) {
struct argv_array hook_env = ARGV_ARRAY_INIT;argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", get_index_file()); argv_array_push(&hook_env, "GIT_EDITOR=:"); ret = run_hook_le(hook_env.argv, "pre-commit", NULL); argv_array_clear(&hook_env); }
(This assumes that the in-process try_to_commit() is only called if the commit message is not to be edited interactively, which is currently the case.)
Ciao, Dscho