-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload-pack: add a trigger for post-upload-pack hook
After upload-pack successfully finishes its operation, post-upload-pack hook can be called for logging purposes. The hook is passed various pieces of information, one per line, from its standard input. Currently the following items can be fed to the hook, but more types of information may be added in the future: want SHA-1:: 40-byte hexadecimal object name the client asked to include in the resulting pack. Can occur one or more times in the input. have SHA-1:: 40-byte hexadecimal object name the client asked to exclude from the resulting pack, claiming to have them already. Can occur zero or more times in the input. time float:: Number of seconds spent for creating the packfile. size decimal:: Size of the resulting packfile in bytes. Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Junio C Hamano
committed
Aug 29, 2009
1 parent
68ea474
commit a8563ec
Showing
4 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
test_description='post upload-hook' | ||
|
||
. ./test-lib.sh | ||
|
||
LOGFILE=".git/post-upload-pack-log" | ||
|
||
test_expect_success setup ' | ||
test_commit A && | ||
test_commit B && | ||
git reset --hard A && | ||
test_commit C && | ||
git branch prev B && | ||
mkdir -p .git/hooks && | ||
{ | ||
echo "#!$SHELL_PATH" && | ||
echo "cat >post-upload-pack-log" | ||
} >".git/hooks/post-upload-pack" && | ||
chmod +x .git/hooks/post-upload-pack | ||
' | ||
|
||
test_expect_success initial ' | ||
rm -fr sub && | ||
git init sub && | ||
( | ||
cd sub && | ||
git fetch --no-tags .. prev | ||
) && | ||
want=$(sed -n "s/^want //p" "$LOGFILE") && | ||
test "$want" = "$(git rev-parse --verify B)" && | ||
! grep "^have " "$LOGFILE" | ||
' | ||
|
||
test_expect_success second ' | ||
rm -fr sub && | ||
git init sub && | ||
( | ||
cd sub && | ||
git fetch --no-tags .. prev:refs/remotes/prev && | ||
git fetch --no-tags .. master | ||
) && | ||
want=$(sed -n "s/^want //p" "$LOGFILE") && | ||
test "$want" = "$(git rev-parse --verify C)" && | ||
have=$(sed -n "s/^have //p" "$LOGFILE") && | ||
test "$have" = "$(git rev-parse --verify B)" | ||
' | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters