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

Re: [RFC/PATCH 0/5] stop installing old libexec aliases like "git-init"

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 22, 2018, 12:48 UTC
Message-ID
<nycvar.QRO.7.76.6.1811221344360.41@tvgsbejvaqbjf.bet>
In-Reply-To
<20181117063940.GA31057@sigill.intra.peff.net>
Hi Peff,
On Sat, 17 Nov 2018, Jeff King wrote:
Show 30 quoted lines
> On Fri, Nov 16, 2018 at 08:22:11PM +0100, Ævar Arnfjörð Bjarmason wrote:
> 
> > So maybe we should just document this interface better. It seems one
> > implicit dependency is that we expect a manpage for the tool to exist
> > for --help.
> 
> Yeah, I think this really the only problematic assumption. The rest of
> "-c", "--git-dir", etc, are just manipulating the environment, and that
> gets passed through to sub-invocations of Git (so if I have a script
> which calls git-config, it will pick up the "-c" config).
> 
> It would be nice if there was a way to ask "is there a manpage?", and
> fallback to running "git-cmd --help". But:
> 
>   1. I don't think there is a portable way to query that via man. And
>      anyway, depending platform and config, it may be opening a browser
>      to show HTML documentation (or I think even texinfo?).
> 
>   2. We can just ask whether "man git-sizer" (or whatever help display
>      command) returned a non-zero exit code, and fall back to "git-sizer
>      --help". But there's an infinite-loop possibility here: running
>      "git-sizer --help" does what we want. But if "man git-log" failed,
>      we'd run "git-log --help", which in turn runs "git help log", which
>      runs "man git-log", and so on.
> 
>      You can break that loop with an environment variable for "I already
>      tried to show the manpage", which would I guess convert "--help" to
>      "-h".
> 
> So it's maybe do-able, but not quite as trivial as one might hope.

A trivial alternative would be to recommend adding a man page for 3rd-party git-<tool>s.

In other words, as soon as `git-sizer` is accompanied by `git-sizer.1` in one of the appropriate locations, it is set.

(Actually, it is not: on Windows, it would have to add git-sizer.html in the appropriate location, but we can deal with this if needed.)

Show 22 quoted lines
> > But I don't remember the details, and can't reproduce it now with:
> > 
> >     $ cat ~/bin/git-sigint 
> >     #!/usr/bin/env perl
> >     $SIG{INT} = sub { warn localtime . " " . $$ };
> >     sleep 1 while 1;
> >     $ git sigint # or git-sigint
> >     [... behaves the same either way ...]
> > 
> > So maybe it was something else, or I'm misremembering...
> 
> I think that generally works because hitting ^C is going to send SIGINT
> to the whole process group. A more interesting case is:
> 
>   git sigint &
>   kill -INT $!
> 
> There $! is a parent "git" process that is just waiting on git-sigint to
> die. But that works, too, because the parent relays common signals due
> to 10c6cddd92 (dashed externals: kill children on exit, 2012-01-08). So
> you might have been remembering issues prior to that commit (or uncommon
> signals; these come from sigchain_push_common).

FWIW I do have a couple of scripts I use that I install into `$HOME/bin/git-<tool>`. Although, granted, I essentially switched to aliases for most of them, where the aliases still call a script that is checked out in some folder in my home directory. The reason: this works in more circumstances, as I do not have to add `$HOME/bin` to the `PATH`, say, in PowerShell.

So YMMV with git-<tool>s. My rule of thumb is: if I want to use this myself only, I'll make it an alias. If I want to ship it (e.g. with Git for Windows), I'll make it a git-<tool>.

Ciao, Dscho

Previous: Jeff KingNext: Jeff King
Message 28 of 53 in “What's cooking in git.git (Mar 2018, #02; Tue, 6)”
  1. Junio C HamanoMar 6, 2018
  2. Johannes SchindelinMar 7, 2018
  3. Ævar Arnfjörð BjarmasonMar 8, 2018
  4. Daniel JacquesMar 8, 2018
  5. Why don't we symlink libexec/git-core/* to bin/git?Ævar Arnfjörð Bjarmason, Mar 13, 2018
  6. Junio C HamanoMar 13, 2018
  7. Randall S. BeckerMar 13, 2018
  8. 0/3 Makefile: add a INSTALL_SYMLINKS optionÆvar Arnfjörð Bjarmason, Mar 13, 2018
  9. 1/3 Makefile: fix broken bindir_relative variableÆvar Arnfjörð Bjarmason, Mar 13, 2018
  10. 3/3 Makefile: optionally symlink libexec/git-core binaries to bin/gitÆvar Arnfjörð Bjarmason, Mar 13, 2018
  11. Johannes SixtMar 14, 2018
  12. Ævar Arnfjörð BjarmasonMar 14, 2018
  13. Linus TorvaldsMar 14, 2018
  14. Johannes SchindelinMar 15, 2018
  15. Linus TorvaldsMar 15, 2018
  16. Johannes SchindelinMar 16, 2018
  17. Ævar Arnfjörð BjarmasonMar 16, 2018
  18. Johannes SchindelinMar 19, 2018
  19. Linus TorvaldsMar 19, 2018
  20. 0/5 stop installing old libexec aliases like "git-init"Ævar Arnfjörð Bjarmason, Nov 2, 2018
  21. Junio C HamanoNov 3, 2018
  22. Ævar Arnfjörð BjarmasonNov 5, 2018
  23. Johannes SchindelinNov 12, 2018
  24. Ævar Arnfjörð BjarmasonNov 16, 2018
  25. Michael HaggertyNov 16, 2018
  26. Ævar Arnfjörð BjarmasonNov 16, 2018
  27. Jeff KingNov 17, 2018
  28. Johannes SchindelinNov 22, 2018
  29. Jeff KingNov 22, 2018
  30. Johannes SchindelinNov 23, 2018
  31. 1/5 Makefile: move long inline shell loops in "install" into helperÆvar Arnfjörð Bjarmason, Nov 2, 2018
  32. Eric SunshineNov 4, 2018
  33. Johannes SchindelinNov 12, 2018
  34. Ævar Arnfjörð BjarmasonNov 12, 2018
  35. Johannes SchindelinNov 12, 2018
  36. Ævar Arnfjörð BjarmasonNov 16, 2018
  37. 2/5 Makefile: conform some of the code to our coding standardsÆvar Arnfjörð Bjarmason, Nov 2, 2018
  38. 3/5 Makefile: stop hiding failures during "install"Ævar Arnfjörð Bjarmason, Nov 2, 2018
  39. 4/5 Makefile: add NO_INSTALL_SYMLINKS_FALLBACK switchÆvar Arnfjörð Bjarmason, Nov 2, 2018
  40. Eric SunshineNov 4, 2018
  41. 5/5 Makefile: Add a NO_INSTALL_BUILTIN_EXECDIR_ALIASES flagÆvar Arnfjörð Bjarmason, Nov 2, 2018
  42. Eric SunshineNov 4, 2018
  43. Johannes SchindelinNov 12, 2018
  44. Johannes SchindelinMar 15, 2018
  45. 2/3 Makefile: add a gitexecdir_relative variableÆvar Arnfjörð Bjarmason, Mar 13, 2018
  46. Ævar Arnfjörð BjarmasonMar 14, 2018
  47. Junio C HamanoMar 14, 2018
  48. Johannes SchindelinMar 15, 2018
  49. Duy NguyenMar 16, 2018
  50. Johannes SchindelinMar 30, 2018
  51. Martin ÅgrenMar 9, 2018
  52. Duy NguyenMar 9, 2018
  53. Junio C HamanoMar 9, 2018

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.