Created
March 13, 2009 16:38
-
-
Save masaki/78645 to your computer and use it in GitHub Desktop.
ShipIt with Git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/ShipIt/VC/Git.pm b/lib/ShipIt/VC/Git.pm | |
index 9bf21d7..b5b6c2c 100644 | |
--- a/lib/ShipIt/VC/Git.pm | |
+++ b/lib/ShipIt/VC/Git.pm | |
@@ -61,6 +61,18 @@ sub commit { | |
print $tmp_fh $msg; | |
my $tmp_fn = "$tmp_fh"; | |
system($command, "commit", "-a", "-F", $tmp_fn); | |
+ | |
+ if (my $where = $self->{push_to}) { | |
+ open my $fh, '<', '.git/HEAD'; | |
+ chomp(my $head = do { local $/; <$fh> }); | |
+ close $fh; | |
+ | |
+ my ($branch) = $head =~ m!ref: refs/heads/(\S+)!; | |
+ if ($branch) { | |
+ warn "pushing to $where"; | |
+ system($self->command, "push", $where, $branch); | |
+ } | |
+ } | |
} | |
sub local_diff { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment