Skip to content

Commit

Permalink
Sample update hook: typofix and modernization to use "git log"
Browse files Browse the repository at this point in the history
Instead of using antiquated "git-rev-parse | git-rev-list"
pipeline, it is easier to use "git-rev-list" or "git-log" these
days, as Linus points out.

While we are at it, fix the typo on variable name $newref that
should be $newrev.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Andy Parkins authored and Junio C Hamano committed Mar 2, 2007
1 parent 8ab3e18 commit 3d84df4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions templates/hooks--update
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ case "$refname_type" in
# This shows all log entries that are not already covered by
# another ref - i.e. commits that are now accessible from this
# ref that were previously not accessible
git-rev-parse --not --all | git-rev-list --stdin --pretty $newref
git log $newrev --not --all
echo $LOGEND
else
# oldrev is valid
Expand All @@ -165,7 +165,7 @@ case "$refname_type" in
baserev=$(git-merge-base $oldrev $newrev)

# Commit with a parent
for rev in $(git-rev-parse --not --all | git-rev-list --stdin $newrev ^$baserev)
for rev in $(git-rev-list $newrev --not $baserev --all)
do
revtype=$(git-cat-file -t "$rev")
echo " via $rev ($revtype)"
Expand All @@ -190,12 +190,11 @@ case "$refname_type" in
fi
echo ""
echo $LOGBEGIN
git-rev-parse --not --all |
git-rev-list --stdin --pretty $newrev ^$baserev
git log $newrev --not $baserev --all
echo $LOGEND
echo ""
echo "Diffstat:"
git-diff-tree --no-color --stat -M -C --find-copies-harder $newrev ^$baserev
git-diff-tree --no-color --stat -M -C --find-copies-harder $baserev..$newrev
fi
;;
"annotated tag")
Expand Down

0 comments on commit 3d84df4

Please sign in to comment.