aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-05-15 19:12:43 +0200
committerGuido Günther <agx@sigxcpu.org>2010-05-15 19:12:43 +0200
commit88c2d6d83699ca67de3e4d49fc0798e3e057a3b9 (patch)
tree4efdb3922651e97a4a852575787bb677281919d9
parentd3e5b6fee109381bcb91881a8a03184503dcf54c (diff)
gbp-pq export: Instead of failing switch branch
if on a patch-queue branch.
-rwxr-xr-xgbp-pq32
1 files changed, 22 insertions, 10 deletions
diff --git a/gbp-pq b/gbp-pq
index bacdb820..5942c7c8 100755
--- a/gbp-pq
+++ b/gbp-pq
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Convert a patch-queue branch into a patch series in debian/patches and vice
# versa.
@@ -11,21 +11,33 @@ is_patch_queue()
{
local branch=$1
- if expr $branch : patch-queue/ >/dev/null; then
- return 0
- else
- return 1
- fi
+ case $branch in
+ patch-queue/*)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
+run_git()
+{
+ set -e
+ git $@
+ set +e
}
pq_export()
{
- local branch=$1
- local pq="patch-queue/$branch"
+ local branch=$1
+ local pq="patch-queue/$branch"
if is_patch_queue $branch; then
- echo "On a patch-queue branch, can't redo patches."
- return 1
+ branch="${branch//patch-queue\/}"
+ pq="patch-queue/$branch"
+ echo "On \"$pq\", switching to \"$branch\"."
+ run_git checkout $branch
fi
rm -f debian/patches/*