From ef7ddcc92c33fc61eb9e97e51c544dd3685db006 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 20 Apr 2014 23:49:17 +0000 Subject: [PATCH] workaround older git without "commit-tree -m" We need to support older git versions lying around. Some versions broke argument ordering, too. --- lib/Ssoma/Git.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Ssoma/Git.pm b/lib/Ssoma/Git.pm index 5f5702b..2211893 100644 --- a/lib/Ssoma/Git.pm +++ b/lib/Ssoma/Git.pm @@ -263,10 +263,13 @@ sub commit_index { } # make the commit - my @cmd = (qw/git commit-tree -m/, $message); - push @cmd, '-p', $parent if $parent; + my @cmd = qw/git commit-tree/; push @cmd, $tree; - my $commit = $self->qx_sha1(join(' ', @cmd)); + push @cmd, '-p', $parent if $parent; + + # git commit-tree -m didn't work in older git versions + $message =~ /\A\w+\z/ or die "message must be \\w+ only\n"; + my $commit = $self->qx_sha1("echo $message |". join(' ', @cmd)); # update the ref @cmd = (qw/git update-ref/, $ref, $commit); -- 2.26.2