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

Re: [PATCH] githooks: discuss Git operations in foreign repositories

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 9, 2023, 21:47 UTC
Message-ID
<CAPig+cQo3sEJHcQkS6O03Hw5+8NzrMaHwqcR5WwjmVK2s0bcyw@mail.gmail.com>
In-Reply-To
<CAC-j02MV+Gv0D8-fpCOu7JGUimxPLF+OP1dy7bxfs7ArX05BYg@mail.gmail.com>

On Sun, Jan 8, 2023 at 9:54 PM Preston Tunnell Wilson <prestontunnellwilson@gmail.com> wrote:

Show 31 quoted lines
> > So, no, I don't think this qualifies for the BUGS section of
> > git-wortkree, and mentioning this potential gotcha only in
> > git-worktree but not in any other hook-running command doesn't seem
> > ideal either. At present, the best place to discuss it seems to be
> > Documentation/githooks.txt, as this patch does.
>
> I agree the best place to put it is in Documentation/githooks.txt. I
> also agree the BUGS section doesn't make sense, but I'm still
> wondering if we should call it out in git-worktree.txt in addition to
> githooks.txt. When I ran into this issue, I tried to compare my setup
> to that of my coworkers. The difference was that I was using
> git-worktree, they were not. git-worktree's documentation lists:
>
> Within a linked worktree, $GIT_DIR is set to point to this private
> directory (e.g. /path/main/.git/worktrees/test-next in the example)
> and $GIT_COMMON_DIR is set to point back to the main worktree’s
> $GIT_DIR (e.g. /path/main/.git). These settings are made in a .git
> file located at the top directory of the linked worktree.
>
> To me, this is the "other side of the coin" of your patch. (Or maybe
> one of the many other sides of the coin for commands that can run
> git-hooks.) Mentioning a potential collision between git-hooks and
> these variables being set could maybe go in the above snippet, maybe
> in parentheses. It took a lot of working backwards to narrow the issue
> to the interaction between git-worktree and git-hooks rather than the
> package manager I was using or the tool the hook was calling. Putting
> a note in the git-worktree documentation (in addition to the note in
> git-hooks) might help out someone in the future, but I defer to your
> judgement. If it doesn't make sense, doesn't fit, or adding it here
> would detract and make the documentation more confusing, I am happy to
> leave it out.

I understand your concern, and can relate to the amount of effort it took to narrow down the problem. Nevertheless, even though you encountered this problem in relation to git-worktree, it's a more general issue which can manifest in other situations. As such, I can't think of a good way to discuss the issue in the git-worktree documentation that wouldn't feel out of place and make the documentation more confusing.

I'm not necessarily opposed to someone else giving it a shot if it can be done in a way which doesn't feel out of place and doesn't confuse git-worktree documentation further (especially for those new to the documentation). I just don't know how to do so myself.

Previous: Preston Tunnell WilsonNext: Junio C Hamano
Message 5 of 11 in “githooks: discuss Git operations in foreign repositories”
  1. githooks: discuss Git operations in foreign repositoriesEric Sunshine via GitGitGadget, Jan 8, 2023
  2. Preston Tunnell WilsonJan 8, 2023
  3. Eric SunshineJan 8, 2023
  4. Preston Tunnell WilsonJan 9, 2023
  5. Eric SunshineJan 9, 2023
  6. Junio C HamanoJan 9, 2023
  7. Eric SunshineJan 9, 2023
  8. Junio C HamanoJan 9, 2023
  9. githooks: discuss Git operations in foreign repositoriesEric Sunshine via GitGitGadget, Jan 9, 2023
  10. Preston Tunnell WilsonJan 9, 2023
  11. Jeff KingJan 11, 2023

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.