3 test_description='post upload-hook'
7 LOGFILE=".git/post-upload-pack-log"
9 test_expect_success setup '
15 mkdir -p .git/hooks &&
17 echo "#!$SHELL_PATH" &&
18 echo "cat >post-upload-pack-log"
19 } >".git/hooks/post-upload-pack" &&
20 chmod +x .git/hooks/post-upload-pack
23 test_expect_success initial '
28 git fetch --no-tags .. prev
30 want=$(sed -n "s/^want //p" "$LOGFILE") &&
31 test "$want" = "$(git rev-parse --verify B)" &&
32 ! grep "^have " "$LOGFILE" &&
33 kind=$(sed -n "s/^kind //p" "$LOGFILE") &&
37 test_expect_success second '
42 git fetch --no-tags .. prev:refs/remotes/prev &&
43 git fetch --no-tags .. master
45 want=$(sed -n "s/^want //p" "$LOGFILE") &&
46 test "$want" = "$(git rev-parse --verify C)" &&
47 have=$(sed -n "s/^have //p" "$LOGFILE") &&
48 test "$have" = "$(git rev-parse --verify B)" &&
49 kind=$(sed -n "s/^kind //p" "$LOGFILE") &&
53 test_expect_success all '
59 git clone "file://$HERE/.git" new
61 sed -n "s/^want //p" "$LOGFILE" | sort >actual &&
62 git rev-parse A B C | sort >expect &&
63 test_cmp expect actual &&
64 ! grep "^have " "$LOGFILE" &&
65 kind=$(sed -n "s/^kind //p" "$LOGFILE") &&