]> git.ozlabs.org Git - patchwork/commitdiff
Make the post-receive hook more efficient (using pwclient info, not view)
authorCarl Worth <cworth@cworth.org>
Wed, 11 Dec 2013 18:46:27 +0000 (10:46 -0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 29 Jan 2014 09:57:12 +0000 (17:57 +0800)
Older versions of patchwork shipped with a version of pwclient that
had the view command, but not info command. Now that info exists, it's
inefficient to use it to obtain the patchwork ID value, (since it
requires the server to send the entire patch content in response to an
XML RPC request).

So be kind to the server by using info instead, (which has a small,
fixed-length response).

Signed-off-by: Carl Worth <cworth@cworth.org>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
tools/post-receive.hook

index b2b89a2953b54bb64b30695b75a68d91c2dc27b0..4f76fa6cd26a0cd02f7c2ae64b70f174fd62fcfc 100755 (executable)
@@ -25,8 +25,8 @@ get_patchwork_hash()
 get_patch_id()
 {
   local id
-  id=$($PWDIR/bin/pwclient view -h $1 2>/dev/null \
-    | sed -rne 's,X-Patchwork-Id: ,,p')
+  id=$($PWDIR/bin/pwclient info -h $1 2>/dev/null \
+    | sed -rne 's,- id[[:space:]]*: ,,p')
   echo $id
   test -n "$id"
 }