git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/4] git --paginate: do not commit pager choice too early

From
Jeff King <peff@peff.net>
Date
Jun 28, 2010, 10:22 UTC
Message-ID
<20100628102201.GA24817@coredump.intra.peff.net>
In-Reply-To
<20100628101335.GA5007@burratino>
On Mon, Jun 28, 2010 at 05:13:35AM -0500, Jonathan Nieder wrote:
Show 11 quoted lines
> > But reading the message for patch 4/4, I can't help but wonder if the
> > right way forward is for the git wrapper to _always_ find the repository
> > as the very first thing.
> [...]
> > the worst case should be a little bit of
> > wasted effort.
> 
> This is a very useful thought.  Git without the chdir() to toplevel
> would be pleasanter, I think.  (Yes, I realize you weren’t necessarily
> suggesting suppressing a chdir_to_toplevel() in place of
> setup_git_repository() and friends.)

I had just meant that we would not do the chdir() initially, but would do so right before running the actual command which wanted repository setup (and commands like init which do not do that setup would never chdir to the toplevel). But we must always run at least aliases and external sub-commands from the toplevel to keep backwards compatibility.

Show 16 quoted lines
> Regarding the repository search: automounters can cause pain if
> DISCOVERY_ACROSS_FILESYSTEM is set and GIT_CEILING_DIRECTORIES is not
> set appropriately.  An important script that does
> 
>   tmpdir=$(mktemp -d)
>   cd "$tmpdir"
>   ...
> 
>   git diff --no-index a b
>   ...
> 
> could hang indefinitely if some nut has created a named pipe at
> /tmp/.git.  I haven’t come up with any non far-fetched reason to mind
> the repository search, though.
> 
> Will think about this.

Yeah, I considered that, too. But I doubt it is a big problem. If it were, then just running "git log" when you are not in a repository would be similarly painful. The people who have setups like that are already having to deal with GIT_CEILING_DIRECTORIES to make things less painful (though I imagine the new cross-filesystem discovery code will prevent most of the pain without them having to actually do anything).

So yes, we are adding the extra lookup for commands like "git clone", but I suspect in practice nobody will care. If it is a big deal, we can do something like:

  if (!strcmp(cmd, "clone") || !strcmp(cmd, "init"))
     ... don't do setup ...

which I admit is a terrible hack, but it is an optimization, not a correctness thing. So we are not shutting out external user-defined commands that might not care about the repo. We are just making our common built-in ones a bit more efficient.

-Peff
Previous: Jonathan NiederNext: Nguyen Thai Ngoc Duy
Message 9 of 42 in “git --paginate: do not commit pager choice too early”
  1. 0/4 git --paginate: do not commit pager choice too earlyJonathan Nieder, Jun 26, 2010
  2. 1/4 t7006 (pager): introduce helper for parameterized testsJonathan Nieder, Jun 26, 2010
  3. 2/4 t7006: test pager configuration for several git commandsJonathan Nieder, Jun 26, 2010
  4. Jonathan NiederJun 26, 2010
  5. 3/4 tests: local config file should be honored from subdirs of toplevelJonathan Nieder, Jun 26, 2010
  6. 4/4 git --paginate: do not commit pager choice too earlyJonathan Nieder, Jun 26, 2010
  7. Jeff KingJun 28, 2010
  8. Jonathan NiederJun 28, 2010
  9. Jeff KingJun 28, 2010
  10. Nguyen Thai Ngoc DuyJun 28, 2010
  11. Junio C HamanoJun 29, 2010
  12. Junio C HamanoJul 14, 2010
  13. Jonathan NiederJul 14, 2010
  14. git --paginate: paginate external commands againJonathan Nieder, Jul 14, 2010
  15. Nguyen Thai Ngoc DuyJul 18, 2010
  16. 0/12 Re: git --paginate: do not commit pager choice too earlyJonathan Nieder, Aug 6, 2010
  17. 01/12 git wrapper: introduce startup_info structJonathan Nieder, Aug 6, 2010
  18. 02/12 setup: remember whether repository was foundJonathan Nieder, Aug 6, 2010
  19. 03/12 git wrapper: allow setup_git_directory_gently() be called earlierJonathan Nieder, Aug 6, 2010
  20. 04/12 shortlog: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  21. 05/12 grep: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  22. 06/12 apply: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  23. Ævar Arnfjörð BjarmasonAug 15, 2010
  24. Nguyen Thai Ngoc DuyAug 15, 2010
  25. Jonathan NiederAug 15, 2010
  26. 06/12 apply: run setup_git_directory_gently() soonerNguyễn Thái Ngọc Duy, Aug 16, 2010
  27. Junio C HamanoAug 16, 2010
  28. 07/12 bundle: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  29. Thomas RastAug 16, 2010
  30. Jonathan NiederAug 16, 2010
  31. 2/2 t7006 (pager): add missing TTY prerequisiteJonathan Nieder, Aug 16, 2010
  32. Junio C HamanoAug 16, 2010
  33. 08/12 config: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  34. 09/12 index-pack: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  35. 10/12 ls-remote: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  36. 11/12 var: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  37. 12/12 merge-file: run setup_git_directory_gently() soonerJonathan Nieder, Aug 6, 2010
  38. 0/2 fix "check-ref-format --branch" from subdir of toplevelJonathan Nieder, Aug 6, 2010
  39. 1/2 check-ref-format: handle subcommands in separate functionsJonathan Nieder, Aug 6, 2010
  40. 2/2 Allow "check-ref-format --branch" from subdirectoryJonathan Nieder, Aug 6, 2010
  41. Junio C HamanoAug 6, 2010
  42. Nguyen Thai Ngoc DuyAug 6, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.