Skip to content

Commit 6d05660

Browse files
committed
Support Git v1.7
Some options used did not work with earlier versions of Git. For example, options with a value must be specified as a single argument. Make small changes to work with older versions of Git (possibly earlier than v1.7). Issue: #38
1 parent 8e4fa11 commit 6d05660

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

bin/git-svn-diff

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,10 @@ sub getFirstCommitBeforeRevision {
224224
my $revision = shift;
225225
fatal "Invalid revision string: $revision" if $revision =~ /\D/;
226226

227-
my $time = eval { command_oneline("log", "--all", "--format=format:%ci", "--max-count=1", "--grep", "^git-svn-id: .*\\\@$revision\\b") };
227+
my $time = eval { command_oneline("log", "--all", "--format=format:%ci", "--max-count=1", "--grep=^git-svn-id: .*\\\@$revision\\b") };
228228
return undef unless $time;
229229

230-
my $commit = eval { command_oneline("log", "--before", $time, "--format=format:%H", "--max-count=1") };
230+
my $commit = eval { command_oneline("log", "--before=$time", "--format=format:%H", "--max-count=1") };
231231
while (getSvnRevision($commit) > $revision) {
232232
($commit) = getParentCommits($commit);
233233
}
@@ -244,7 +244,7 @@ sub getCommitFromRevision {
244244
# are added. This corresponds to the git "empty tree".
245245
return getGitEmptyTree() if $revision == 0;
246246

247-
return eval { command_oneline("log", "--format=format:%H", "--max-count=1", "--grep", "^git-svn-id: .*\\\@$revision\\b") };
247+
return eval { command_oneline("log", "--format=format:%H", "--max-count=1", "--grep=^git-svn-id: .*\\\@$revision\\b") };
248248
}
249249

250250
# Returns the commit of the given revision, accepting special SVN keywords,
@@ -256,7 +256,7 @@ sub getCommitFromSvnIdentifier {
256256
my @files;
257257
@files = @_ unless $revision eq "BASE";
258258

259-
my $commit = eval { command_oneline("log", "--format=format:%H", "--max-count=1", "--grep", "^git-svn-id: ", "--", @files) };
259+
my $commit = eval { command_oneline("log", "--format=format:%H", "--max-count=1", "--grep=^git-svn-id: ", "--", @files) };
260260
($commit) = getParentCommits($commit) if $revision eq "PREV";
261261
return $commit;
262262
}
@@ -274,7 +274,7 @@ sub getSvnRevision {
274274

275275
return 0 if $commit eq getGitEmptyTree();
276276

277-
my $body = eval { command("log", "--format=format:%B", "--max-count=1", $commit, "--", @files) };
277+
my $body = eval { command("log", "--format=format:%b", "--max-count=1", $commit, "--", @files) };
278278
return undef unless $body;
279279

280280
return $1 if $body =~ m/^git-svn-id:\s+[^@]+\@(\d+)\b/m;

0 commit comments

Comments
 (0)