blob aa265ce61069340f59f11bc855bd421e7fb7458b 2478 bytes (raw)
name: t/t5403-post-checkout-hook.sh # note: path name is non-authoritative(*)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| | #!/bin/sh
#
# Copyright (c) 2006 Josh England
#
test_description='Test the post-checkout hook.'
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-hooks.sh"
test_expect_success setup '
mkdir -p .git/hooks &&
write_script .git/hooks/post-checkout <<-\EOF &&
echo "$@" >.git/post-checkout.args
EOF
test_commit one &&
test_commit two &&
test_commit rebase-on-me &&
git reset --hard HEAD^ &&
test_commit three
'
test_expect_success 'post-checkout receives the right arguments with HEAD unchanged ' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout master &&
read old new flag <.git/post-checkout.args &&
test $old = $new && test $flag = 1
'
test_expect_success 'post-checkout args are correct with git checkout -b ' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout -b new1 &&
read old new flag <.git/post-checkout.args &&
test $old = $new && test $flag = 1
'
test_expect_success 'post-checkout receives the right args with HEAD changed ' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout two &&
read old new flag <.git/post-checkout.args &&
test $old != $new && test $flag = 1
'
test_expect_success 'post-checkout receives the right args when not switching branches ' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout master -- three.t &&
read old new flag <.git/post-checkout.args &&
test $old = $new && test $flag = 0
'
test_expect_success 'post-checkout is triggered on rebase' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout -b rebase-test master &&
rm -f .git/post-checkout.args &&
git rebase rebase-on-me &&
read old new flag <.git/post-checkout.args &&
test $old != $new && test $flag = 1
'
test_expect_success 'post-checkout is triggered on rebase with fast-forward' '
test_when_finished "rm -f .git/post-checkout.args" &&
git checkout -b ff-rebase-test rebase-on-me^ &&
rm -f .git/post-checkout.args &&
git rebase rebase-on-me &&
read old new flag <.git/post-checkout.args &&
test $old != $new && test $flag = 1
'
test_expect_success 'post-checkout hook is triggered by clone' '
mkdir -p templates/hooks &&
write_script templates/hooks/post-checkout <<-\EOF &&
echo "$@" >"$GIT_DIR/post-checkout.args"
EOF
git clone --template=templates . clone3 &&
test -f clone3/.git/post-checkout.args
'
cmd_rebase () {
git checkout -B hook-test rebase-on-me^ &&
git rebase rebase-on-me
}
test_multiple_hooks post-checkout cmd_rebase
test_done
|
debug log:
solving aa265ce610 ...
found aa265ce610 in https://public-inbox.org/git/20190424004948.728326-5-sandals@crustytoothpaste.net/ ||
https://public-inbox.org/git/20190514002332.121089-6-sandals@crustytoothpaste.net/
found a39b3b5c78 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 a39b3b5c78bc900ae4e9c629598381f915d291de t/t5403-post-checkout-hook.sh
applying [1/1] https://public-inbox.org/git/20190424004948.728326-5-sandals@crustytoothpaste.net/
diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh
index a39b3b5c78..aa265ce610 100755
Checking patch t/t5403-post-checkout-hook.sh...
Applied patch t/t5403-post-checkout-hook.sh cleanly.
skipping https://public-inbox.org/git/20190514002332.121089-6-sandals@crustytoothpaste.net/ for aa265ce610
index at:
100755 aa265ce61069340f59f11bc855bd421e7fb7458b t/t5403-post-checkout-hook.sh
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
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).