Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git GUI does not execute commit hooks when running from a secondary worktree #1755

Closed
1 task done
luismbo opened this issue Jul 9, 2018 · 2 comments · Fixed by #1757
Closed
1 task done

Git GUI does not execute commit hooks when running from a secondary worktree #1755

luismbo opened this issue Jul 9, 2018 · 2 comments · Fixed by #1757
Milestone

Comments

@luismbo
Copy link

luismbo commented Jul 9, 2018

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.17.0.windows.1
cpu: x86_64
built from commit: e7621d891d081acff6acd1f0ba6ae0adce06dd09
sizeof-long: 4
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.17134.112]
  • What options did you set as part of the installation? Or did you choose the
    defaults?

Portable version.

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

Hopefully, no.

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash.

mkdir foo
cd foo
git init

# set up a commit-msg hook that appends "The End" to commit messages
echo -e '#!/bin/sh\necho "The End" >> "$1"' > .git/hooks/commit-msg

touch file
git add file
git gui # commit; the commit-msg hook runs

# another commit, this time from a worktree
git branch master2
git worktree add ../foo-worktree master2
cd ../foo-worktree
echo "some change" >> file
git add file
git gui # commit; the commit-msg hook does NOT run
  • What did you expect to occur after running these commands?

I expected the commit created in foo-worktree would have "The End" appended by the commit-msg hook.

  • What actually happened instead?

The commit-msg hook appears to not have been executed. The commit message does not end with "The End".

@dscho
Copy link
Member

dscho commented Jul 9, 2018

Probably the hooks directory is hard-coded or something.

Have you looked whether patthoyts/git-gui#12 or another PR that is still open in that repository fixes things for you?

@luismbo
Copy link
Author

luismbo commented Jul 9, 2018

@dscho I've just tried your suggested patch at https://github.com/patthoyts/git-gui/pull/12/files#r121945479 and it fixes the problem.

(Indeed git rev-parse --git-path hooks/commit-msg within the secondary worktree returns a path pointing to the main .git directory.)

dscho added a commit to dscho/git-gui-legacy that referenced this issue Jul 10, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows/git#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Jul 10, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Jul 10, 2018
dscho added a commit to git-for-windows/build-extra that referenced this issue Jul 18, 2018
Git GUI [now handles hooks
correctly](git-for-windows/git#1755) in
worktrees other than the main one.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho modified the milestones: v2.17.1(3), v2.18.0, v2.18.0(2) Jul 18, 2018
dscho added a commit to dscho/git that referenced this issue Oct 4, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Oct 4, 2018
dscho added a commit that referenced this issue Oct 10, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Oct 10, 2018
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Oct 11, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Oct 11, 2018
dscho added a commit to dscho/git that referenced this issue Nov 19, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Nov 19, 2018
dscho added a commit to dscho/git that referenced this issue Nov 20, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Nov 20, 2018
dscho added a commit that referenced this issue Nov 21, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 21, 2018
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit to dscho/git that referenced this issue Nov 23, 2018
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes git-for-windows#1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 18, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 18, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 18, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 18, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Sep 20, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Sep 20, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 22, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 22, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 22, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 22, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 23, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Sep 23, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Oct 15, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Oct 15, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Oct 19, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Oct 19, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Nov 2, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Nov 2, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 5, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 5, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 13, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 13, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 14, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 14, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 22, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this issue Nov 22, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Dec 2, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Dec 2, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Dec 7, 2023
Since v2.9.0, Git knows about the config variable core.hookspath
that allows overriding the path to the directory containing the
Git hooks.

Since v2.10.0, the `--git-path` option respects that config
variable, too, so we may just as well use that command.

For Git versions older than v2.5.0 (which was the first version to
support the `--git-path` option for the `rev-parse` command), we
simply fall back to the previous code.

This fixes #1755

Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
git-for-windows-ci pushed a commit that referenced this issue Dec 7, 2023
Let's try to address #1755 this way.

Signed-off-by: Johannes Schindelin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@luismbo @dscho and others