[PATCH jn/paginate-fix 0/12] Re: git --paginate: do not commit pager choice too early
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 6, 2010, 02:35 UTC
- Message-ID
- <20100806023529.GB22369@burratino>
- In-Reply-To
- <7v630hyf5r.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 8 quoted lines
> So delay the pager startup when possible: > > 1. run_argv() already commits pager choice inside run_builtin() if a > command is found. For commands that use RUN_SETUP, waiting until > then fixes the problem described above: once git knows where to > look, it happily respects the core.pager setting. > > ... and for commands that do not use RUN_SETUP, what happens?
Let’s help some of them out a little.
These patches teach a few more built-ins to do something like RUN_SETUP; more precisely, a RUN_SETUP_GENTLY facility is introduced to run setup_git_directory_gently() early just like NEEDS_PREFIX has always caused setup_git_directory() to be run early.
This series wouldn’t be possible without Duy’s recent efforts to roll out other fixes from the famous nd/setup topic --- thanks! The patches should be familiar[1] and I think they are better justified now.
The first 8 patches apply on top to jn/paginate-fix from pu. Between patch 8 and 9 I have a merge of jn/maint-setup-fix^, with the following explanation:
Merge branch 'jn/maint-setup-fix' (early part) into jn/paginate-fix
That topic includes a fix for “git index-pack” (which used to save the cwd before the repository search to work around a bug) which is needed before the repository search can be safely run earlier.
That merge involves a trivial conflict between adding the RUN_SETUP_GENTLY flag for this topic and removing USE_PAGER for grep -O. The conflict is only nominal --- the two changes do not interfere with each other.
One final note: this series is deliberately very conservative, in that it does not touch commands like diff (which has a --no-index mode suppressing the repository search). Such commands are neither helped nor hindered by this series, and I think that during this transition time we should be opportunistic rather than rigid: the rule is to run the repository search as soon as can be easily justified but no sooner.
Thoughts welcome, as always.
Nguyễn Thái Ngọc Duy (12): git wrapper: introduce startup_info struct setup: remember whether repository was found git wrapper: allow setup_git_directory_gently() be called earlier shortlog: run setup_git_directory_gently() sooner grep: run setup_git_directory_gently() sooner apply: run setup_git_directory_gently() sooner bundle: run setup_git_directory_gently() sooner config: run setup_git_directory_gently() sooner index-pack: run setup_git_directory_gently() sooner ls-remote: run setup_git_directory_gently() sooner var: run setup_git_directory_gently() sooner merge-file: run setup_git_directory_gently() sooner
[1] http://thread.gmane.org/gmane.comp.version-control.git/144000/focus=144110