summaryrefslogtreecommitdiff
path: root/bin/4commit
blob: aea15ec77d2927c246f392b5aa699cc7e4eaf083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 ) )"
);