From: Preston Tunnell Wilson <prestontunnellwilson@gmail.com>
To: git@vger.kernel.org
Subject: Bug report between git hooks and git worktree
Date: Sat, 7 Jan 2023 12:59:46 -0600 [thread overview]
Message-ID: <CAC-j02OVoFDFjeGUjcs0ZMwPSXKLL_GBme2m2-ttzGTbxXNP-w@mail.gmail.com> (raw)
Hello!
I ran into a strange issue using git-worktree with git-hooks. I have
attached the output of `git bugreport` below. More concrete steps to
reproduce are available in
https://github.com/prestontw/git_hook-git_worktree-minimal-repo. I've
run into this both in macOS and Fedora---I've included the system
information from both of these systems below.
What did you do before the bug happened? (Steps to reproduce your issue)
Add a git hook that executes git commands inside of another folder. Let's
call this other folder `FolderA`.
(This might sound weird, but `flutter` distributes itself through a `git`
folder in some circumstances and uses `git` commands to see which version
the user has installed, etc.).
Add a git worktree branch/folder, `cd` to it, and commit something there.
Let's call this git worktree folder `FolderW`.
(Steps are outlined in more detail with an example in
https://github.com/prestontw/git_hook-git_worktree-minimal-repo.)
What did you expect to happen? (Expected behavior)
The git command would report details from `FolderA`.
What happened instead? (Actual behavior)
The git command outputs details from `FolderW`.
What's different between what you expected and what actually happened?
I would expect the git command to output details from `FolderA`.
It's confusing to me that there is a difference in behavior between
the "main" branch and `FolderW` in git hooks.
Anything else you want to add:
I'm seeing this both in macOS and Fedora. I've added that system
info below.
[System Info]
git version:
git version 2.32.0 (Apple Git-132)
cpu: arm64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58
PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64
compiler info: clang: 13.1.6 (clang-1316.0.21.2)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/zsh
[Enabled Hooks]
pre-commit
[System Info]
git version:
git version 2.37.3
cpu: aarch64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.0.7-301.fc37.aarch64 #1 SMP PREEMPT_DYNAMIC Fri Nov 4 18:13:35 U>
compiler info: gnuc: 12.2
libc info: glibc: 2.36
$SHELL (typically, interactive shell): /bin/bash
[Enabled Hooks]
pre-commit
next reply other threads:[~2023-01-07 19:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 18:59 Preston Tunnell Wilson [this message]
2023-01-07 19:29 ` Bug report between git hooks and git worktree Preston Tunnell Wilson
2023-01-08 6:32 ` Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAC-j02OVoFDFjeGUjcs0ZMwPSXKLL_GBme2m2-ttzGTbxXNP-w@mail.gmail.com \
--to=prestontunnellwilson@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).