{"thread":{"id":"47389","subject":"'git worktree add' does not fire post-checkout hook","startedAt":"2017-12-06T21:00:47Z","lastAt":"2017-12-07T10:19:57Z","messageCount":3,"participants":["Gumbel, Matthew K","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"334270","messageId":"DA0A42D68346B1469147552440A64503C60832DB@ORSMSX105.amr.corp.intel.com","threadId":"47389","inReplyTo":null,"subject":"'git worktree add' does not fire post-checkout hook","fromName":"Gumbel, Matthew K","fromEmail":"matthew.k.gumbel@intel.com","sentAt":"2017-12-06T21:00:38Z","receivedAt":"2017-12-06T21:00:47Z","isPatch":false,"sender":{"key":"matthew.k.gumbel@intel.com","avatar":"https://gravatar.com/avatar/b890e13658e390e8dbf289304ea863589f6679161577e2bbb16a7626a267950b?d=mp&s=160"},"body":"Hello all,\n\nI've noticed that when I run 'git worktree add /path/to/new/tree', the post-checkout hook does not fire, even though the worktree manpage explicitly states that \"worktree add\" will, \"Create <path> and checkout <branch> into it.\"\n\nIs this the intended behavior? Seems like maybe a bug, but I'm not sure.\n\nThanks\nMatt\n\n\n"},{"id":"334275","messageId":"CAPig+cQXeC5Nh+=rO9U46PNgnNALd4H3on+feo_NzMg45HqUkQ@mail.gmail.com","threadId":"47389","inReplyTo":"DA0A42D68346B1469147552440A64503C60832DB@ORSMSX105.amr.corp.intel.com","subject":"Re: 'git worktree add' does not fire post-checkout hook","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-06T21:45:33Z","receivedAt":"2017-12-06T21:45:50Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Dec 6, 2017 at 4:00 PM, Gumbel, Matthew K\n<matthew.k.gumbel@intel.com> wrote:\n> I've noticed that when I run 'git worktree add /path/to/new/tree',\n> the post-checkout hook does not fire, even though the worktree\n> manpage explicitly states that \"worktree add\" will, \"Create <path>\n> and checkout <branch> into it.\"\n>\n> Is this the intended behavior? Seems like maybe a bug, but I'm not\n> sure.\n\nSeems like an oversight. Given that 'git worktree' is like a cross of\n'git clone' and 'git checkout', both of which run that hook, it seems\nreasonable that 'git-worktree' should do so, as well.\n\nIf you'd like to get your feet wet at contributing to the Git project,\nthis might be a good first dip, as it looks like an easy fix (a one-\nor two-liner). The only thing which needs a bit of care is to skip the\nhook when --no-checkout is specified. Other than that, 'githooks'\ndocumentation would need an update to mention that git-worktree also\nruns the hook, and t2025-worktree-add.sh would want a couple new tests\n(which would probably be the most complex part of the patch).\n"},{"id":"334314","messageId":"CAPig+cRAth85f+Euim8Sw7An8UQQeOAo6e6kVP_yruw400aJug@mail.gmail.com","threadId":"47389","inReplyTo":"CAPig+cQXeC5Nh+=rO9U46PNgnNALd4H3on+feo_NzMg45HqUkQ@mail.gmail.com","subject":"Re: 'git worktree add' does not fire post-checkout hook","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2017-12-07T10:19:51Z","receivedAt":"2017-12-07T10:19:57Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Dec 6, 2017 at 4:45 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Wed, Dec 6, 2017 at 4:00 PM, Gumbel, Matthew K\n> <matthew.k.gumbel@intel.com> wrote:\n>> I've noticed that when I run 'git worktree add /path/to/new/tree',\n>> the post-checkout hook does not fire, even though the worktree\n>> manpage explicitly states that \"worktree add\" will, \"Create <path>\n>> and checkout <branch> into it.\"\n>>\n>> Is this the intended behavior? Seems like maybe a bug, but I'm not\n>> sure.\n>\n> If you'd like to get your feet wet at contributing to the Git project,\n> this might be a good first dip, as it looks like an easy fix (a one-\n> or two-liner). The only thing which needs a bit of care is to skip the\n> hook when --no-checkout is specified. Other than that, 'githooks'\n> documentation would need an update to mention that git-worktree also\n> runs the hook, and t2025-worktree-add.sh would want a couple new tests\n> (which would probably be the most complex part of the patch).\n\nI worked up a patch to fix this oversight which I'll try to send out\nlater today.\n"}]}