Sample update hook: typofix and modernization to use "git log"
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>
Andy Parkins committed
Mar 2, 2007 at 19:29 UTC
3d84df43e134d01cb790ddd47a14963ecd110152
1 file changed
+4
-5
templates/hooks--update
+4
-5
@@ -148,7 +148,7 @@ case "$refname_type" in
148
# This shows all log entries that are not already covered by
149
# another ref - i.e. commits that are now accessible from this
150
# ref that were previously not accessible
151
- git-rev-parse --not --all | git-rev-list --stdin --pretty $newref
151
+ git log $newrev --not --all
152
echo $LOGEND
153
else
154
# oldrev is valid
@@ -165,7 +165,7 @@ case "$refname_type" in
165
baserev=$(git-merge-base $oldrev $newrev)
166
167
# Commit with a parent
168
- for rev in $(git-rev-parse --not --all | git-rev-list --stdin $newrev ^$baserev)
168
+ for rev in $(git-rev-list $newrev --not $baserev --all)
169
do
170
revtype=$(git-cat-file -t "$rev")
171
echo " via $rev ($revtype)"
@@ -190,12 +190,11 @@ case "$refname_type" in
190
fi
191
echo ""
192
echo $LOGBEGIN
193
- git-rev-parse --not --all |
194
- git-rev-list --stdin --pretty $newrev ^$baserev
193
+ git log $newrev --not $baserev --all
194
echo $LOGEND
195
echo ""
196
echo "Diffstat:"
198
- git-diff-tree --no-color --stat -M -C --find-copies-harder $newrev ^$baserev
197
+ git-diff-tree --no-color --stat -M -C --find-copies-harder $baserev..$newrev
198
fi
199
;;
200
"annotated tag")