Skip to content

Commit

Permalink
Optional push support in git plugin.
Browse files Browse the repository at this point in the history
From: kitano.tk@gmail.com
  • Loading branch information
bradfitz committed Oct 3, 2009
1 parent ac62773 commit 824be60
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/ShipIt/VC/Git.pm
Expand Up @@ -61,6 +61,25 @@ sub commit {
print $tmp_fh $msg;
my $tmp_fn = "$tmp_fh";
system($command, "commit", "-a", "-F", $tmp_fn);

if (my $where = $self->{push_to}) {
my $branch = $self->_get_branch;
if ($branch) {
warn "pushing to $where";
system($self->command, "push", $where, $branch);
}
}
}

sub _get_branch {
my $self = shift;

open my $fh, '<', '.git/HEAD';
chomp(my $head = do { local $/; <$fh> });
close $fh;

my ($branch) = $head =~ m!ref: refs/heads/(\S+)!;
return $branch;
}

sub local_diff {
Expand Down

0 comments on commit 824be60

Please sign in to comment.