Merge branch 'master' of ssh://vps.jankratochvil.net/var/lib/git/nethome
[nethome.git] / bin / dashtopatch
index 03ae652..717c5cc 100755 (executable)
@@ -1,25 +1,38 @@
 #! /bin/sh
 set -ex
+compile=false
+if [ "$1" = -c ];then
+  compile=true
+  shift
+fi
 if [ $# != 1 ] || ! echo "$1" | grep -q '-';then
   echo >&2 "Syntax: $0 branch-list-delimited-by-dashes"
   exit 1
 fi
-base="master"
+if [ -f origin ];then
+  origin="`cat origin`"
+else
+  origin="gdb/master"
+fi
+base=$origin
 gerrit=true
 if git branch -D gerrit;then
-  git checkout master
+  git checkout $origin
   git checkout -b gerrit
 else
   gerrit=false
 fi
 for elem in $(echo "$1"|tr '-' ' ');do
-  if [ "$base" = "master" ];then
+  if [ "$base" = $origin ];then
     next="$elem"
   else
     next="$base-$elem"
   fi
   git checkout "$next"
-  git merge "$base"
+  git merge --no-edit "$base"
+  if $compile;then
+    make
+  fi
   if [ -e "$next".patch ];then
     echo -e '/^--- /,$d\nw'|ed "$next".patch || :
   fi