aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/git-svn/git-svn.perl
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-03-21 00:15:21 -0800
committerJunio C Hamano <junkio@cox.net>2006-03-21 00:15:21 -0800
commitf1250edff5356cba7d8e71ec68418a4233b8bed0 (patch)
treef4db547180350e555fb267c24f3badad21ef7911 /contrib/git-svn/git-svn.perl
parentMerge branch 'jc/clone' into next (diff)
parentcore.warnambiguousrefs: warns when "name" is used and both "name" branch and ... (diff)
downloadgit-f1250edff5356cba7d8e71ec68418a4233b8bed0.tar.gz
git-f1250edff5356cba7d8e71ec68418a4233b8bed0.zip
Merge branch 'jc/name' into next
* jc/name: core.warnambiguousrefs: warns when "name" is used and both "name" branch and tag exists. contrib/git-svn: allow rebuild to work on non-linear remote heads http-push: don't assume char is signed http-push: add support for deleting remote branches Be verbose when !initial commit Fix multi-paragraph list items in OPTIONS section http-fetch: nicer warning for a server with unreliable 404 status
Diffstat (limited to 'contrib/git-svn/git-svn.perl')
-rwxr-xr-xcontrib/git-svn/git-svn.perl14
1 files changed, 13 insertions, 1 deletions
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index cf233ef6ed..f3fc3ec1a9 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -850,11 +850,23 @@ sub assert_revision_unknown {
}
}
+sub trees_eq {
+ my ($x, $y) = @_;
+ my @x = safe_qx('git-cat-file','commit',$x);
+ my @y = safe_qx('git-cat-file','commit',$y);
+ if (($y[0] ne $x[0]) || $x[0] !~ /^tree $sha1\n$/
+ || $y[0] !~ /^tree $sha1\n$/) {
+ print STDERR "Trees not equal: $y[0] != $x[0]\n";
+ return 0
+ }
+ return 1;
+}
+
sub assert_revision_eq_or_unknown {
my ($revno, $commit) = @_;
if (-f "$REV_DIR/$revno") {
my $current = file_to_s("$REV_DIR/$revno");
- if ($commit ne $current) {
+ if (($commit ne $current) && !trees_eq($commit, $current)) {
croak "$REV_DIR/$revno already exists!\n",
"current: $current\nexpected: $commit\n";
}