Patchwork post-receive: Fix error message when pushing to an unmapped branch

login
register
mail settings
Submitter Carl Worth
Date Dec. 13, 2013, 4:28 a.m.
Message ID <1386908882-9666-1-git-send-email-cworth@cworth.org>
Download mbox | patch
Permalink /patch/300875/
State Accepted
Headers show

Comments

Carl Worth - Dec. 13, 2013, 4:28 a.m.
Previously, if STATE_MAP contained only refs/heads/master and a user
pushed to a branch such as refs/heads/stable, the hook emitted a
misleading error message:

	E: no mapping for refname refs/heads/master

Fix this by correctly printing the reference being looked for, rather
than the reference most recently found in STATE_MAP. Also, reword the
message slightly to point the user to STATE_MAP and to use an actual
word "branch" instead of the non-word "refname".
---
 tools/post-receive.hook | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/tools/post-receive.hook b/tools/post-receive.hook
index d0b8e22..94387ab 100755
--- a/tools/post-receive.hook
+++ b/tools/post-receive.hook
@@ -67,6 +67,6 @@  while read oldrev newrev refname; do
     fi
   done
   if [ $found -eq 0 ]; then
-    echo "E: no mapping for refname $key" >&2
+    echo "E: STATE_MAP has no mapping for branch $refname" >&2
   fi
 done