Re: [PATCH 2/2] worktree: add: change to new worktree directory before running hook
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Feb 13, 2018, 07:27 UTC
- Message-ID
- <b24e2f26-d5e4-d17d-04d1-1bd12eaf9faa@kdbg.org>
- In-Reply-To
- <20180212031526.40039-3-sunshine@sunshineco.com>
Am 12.02.2018 um 04:15 schrieb Eric Sunshine:
Show 20 quoted lines
> --- a/t/t2025-worktree-add.sh
> +++ b/t/t2025-worktree-add.sh
> @@ -454,20 +454,29 @@ post_checkout_hook () {
> test_when_finished "rm -f .git/hooks/post-checkout" &&
> mkdir -p .git/hooks &&
> write_script .git/hooks/post-checkout <<-\EOF
> - echo $* >hook.actual
> + {
> + echo $*
> + git rev-parse --show-toplevel
> + } >../hook.actual
> EOF
> }
>
> test_expect_success '"add" invokes post-checkout hook (branch)' '
> post_checkout_hook &&
> - printf "%s %s 1\n" $_z40 $(git rev-parse HEAD) >hook.expect &&
> + {
> + echo $_z40 $(git rev-parse HEAD) 1 &&
> + echo $(pwd)/gumby$(pwd) is here and in the other tests correct. $PWD would be wrong on Windows. Thanks for being considerate.
> + } >hook.expect && > git worktree add gumby && > test_cmp hook.expect hook.actual
-- Hannes