Skip to content

Commit

Permalink
Merge branch 'bk/maint-cvsexportcommit'
Browse files Browse the repository at this point in the history
* bk/maint-cvsexportcommit:
  cvsexportcommit: fix for commits that do not have parents
  • Loading branch information
Junio C Hamano committed Nov 1, 2007
2 parents f31dfa6 + 6b6012e commit 5fb1948
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions git-cvsexportcommit.perl
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
}
}

my $noparent = "0000000000000000000000000000000000000000";
if ($parent) {
my $found;
# double check that it's a valid parent
Expand All @@ -95,8 +96,10 @@
} else { # we don't have a parent from the cmdline...
if (@parents == 1) { # it's safe to get it from the commit
$parent = $parents[0];
} else { # or perhaps not!
die "This commit has more than one parent -- please name the parent you want to use explicitly";
} elsif (@parents == 0) { # there is no parent
$parent = $noparent;
} else { # cannot choose automatically from multiple parents
die "This commit has more than one parent -- please name the parent you want to use explicitly";
}
}

Expand All @@ -116,7 +119,11 @@
}
close MSG;

`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
if ($parent eq $noparent) {
`git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
} else {
`git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
}

## apply non-binary changes

Expand Down

0 comments on commit 5fb1948

Please sign in to comment.