ivan's stupid multi-branch tools, don't use them
[freeside.git] / bin / 4commit
diff --git a/bin/4commit b/bin/4commit
new file mode 100755 (executable)
index 0000000..aea15ec
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# usage: 4commit 'log message' filename filename ...
+
+use Cwd;
+use String::ShellQuote;
+
+my $USER = $ENV{USER};
+
+my $dir = getcwd;
+( my $prefix = $dir ) =~ s(^/home/$USER/freeside/?)() or die $dir; #eventually from anywhere
+
+my $desc = shell_quote(shift @ARGV); # -m
+
+die "no files!" unless @ARGV;
+
+#warn "$prefix";
+
+#print <<END;
+system join('',
+  "( cd /home/$USER/freeside4/$prefix; git pull ) && ",
+  "git diff -u @ARGV | ( cd /home/$USER/freeside4/$prefix; patch -p1 ) ",
+  " && ( ( git pull && git commit  -m $desc @ARGV && git push ); ",
+  "( cd /home/$USER/freeside4/$prefix; git commit -m $desc @ARGV && git push ) )"
+);
+