From fbefc232d787699a0a89046e778a7115e7fa0e36 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Sun, 19 Sep 2010 13:27:37 -0400 Subject: [PATCH] update hook: Avoid errors on initial push in denymerge Passing rev-list ^00000 doesn't work well. Instead, just tell the user that merges cannot be detected/denied for an initial push. --- git-hook/update | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/git-hook/update b/git-hook/update index f98a403..2e85805 100755 --- a/git-hook/update +++ b/git-hook/update @@ -198,8 +198,13 @@ case "$refname","$newrev_type" in # Enable this hook for branch "next" with e.g., # git config --bool hooks.denymerge.next true deny_merge=$(git config --bool "hooks.denymerge.$branch") - case $deny_merge in - true) + case $deny_merge,$oldrev in + true,$zero) + # XXX Is there a way to get the list of revisions being + # added if this is an initial push to an empty repo? + echo "*** Unable to detect/deny merges in initial push." >&2 + ;; + true,*) for r in $(git rev-list $newrev ^$oldrev); do is_merge_commit $r && { printf "error: *** %s\n" \ -- 1.7.2.3