Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn: git-svn: set auto_props when renaming files t9124: clean up chdir usage git-svn: fix 'info' tests for unknown items git-svn: match SVN 1.5 behaviour of info' on unknown item git svn info: always quote URLs in 'info' output git svn info: make info relative to the current directory git svn info: tests: fix ptouch argument order in setup git svn info: tests: use test_cmp instead of git-diff git svn info: tests: do not use set -e git svn info: tests: let 'init' test run with SVN 1.5 git svn: catch lack of upstream info for dcommit earlier git-svn: check error code of send_txstream git-svn: Send deltas during commits git-svn: Introduce SVN::Git::Editor::_chg_file_get_blob git-svn: extract base blob in generate_diffmaint
commit
af9552f030
107
git-svn.perl
107
git-svn.perl
|
|
@ -421,15 +421,15 @@ sub cmd_dcommit {
|
||||||
$head ||= 'HEAD';
|
$head ||= 'HEAD';
|
||||||
my @refs;
|
my @refs;
|
||||||
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
my ($url, $rev, $uuid, $gs) = working_head_info($head, \@refs);
|
||||||
|
unless ($gs) {
|
||||||
|
die "Unable to determine upstream SVN information from ",
|
||||||
|
"$head history.\nPerhaps the repository is empty.";
|
||||||
|
}
|
||||||
$url = defined $_commit_url ? $_commit_url : $gs->full_url;
|
$url = defined $_commit_url ? $_commit_url : $gs->full_url;
|
||||||
my $last_rev = $_revision if defined $_revision;
|
my $last_rev = $_revision if defined $_revision;
|
||||||
if ($url) {
|
if ($url) {
|
||||||
print "Committing to $url ...\n";
|
print "Committing to $url ...\n";
|
||||||
}
|
}
|
||||||
unless ($gs) {
|
|
||||||
die "Unable to determine upstream SVN information from ",
|
|
||||||
"$head history.\nPerhaps the repository is empty.";
|
|
||||||
}
|
|
||||||
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
|
my ($linear_refs, $parents) = linearize_history($gs, \@refs);
|
||||||
if ($_no_rebase && scalar(@$linear_refs) > 1) {
|
if ($_no_rebase && scalar(@$linear_refs) > 1) {
|
||||||
warn "Attempting to commit more than one change while ",
|
warn "Attempting to commit more than one change while ",
|
||||||
|
|
@ -803,8 +803,28 @@ sub cmd_commit_diff {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub escape_uri_only {
|
||||||
|
my ($uri) = @_;
|
||||||
|
my @tmp;
|
||||||
|
foreach (split m{/}, $uri) {
|
||||||
|
s/([^\w.%+-]|%(?![a-fA-F0-9]{2}))/sprintf("%%%02X",ord($1))/eg;
|
||||||
|
push @tmp, $_;
|
||||||
|
}
|
||||||
|
join('/', @tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub escape_url {
|
||||||
|
my ($url) = @_;
|
||||||
|
if ($url =~ m#^([^:]+)://([^/]*)(.*)$#) {
|
||||||
|
my ($scheme, $domain, $uri) = ($1, $2, escape_uri_only($3));
|
||||||
|
$url = "$scheme://$domain$uri";
|
||||||
|
}
|
||||||
|
$url;
|
||||||
|
}
|
||||||
|
|
||||||
sub cmd_info {
|
sub cmd_info {
|
||||||
my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
|
my $path = canonicalize_path(defined($_[0]) ? $_[0] : ".");
|
||||||
|
my $fullpath = canonicalize_path($cmd_dir_prefix . $path);
|
||||||
if (exists $_[1]) {
|
if (exists $_[1]) {
|
||||||
die "Too many arguments specified\n";
|
die "Too many arguments specified\n";
|
||||||
}
|
}
|
||||||
|
|
@ -812,8 +832,8 @@ sub cmd_info {
|
||||||
my ($file_type, $diff_status) = find_file_type_and_diff_status($path);
|
my ($file_type, $diff_status) = find_file_type_and_diff_status($path);
|
||||||
|
|
||||||
if (!$file_type && !$diff_status) {
|
if (!$file_type && !$diff_status) {
|
||||||
print STDERR "$path: (Not a versioned resource)\n\n";
|
print STDERR "svn: '$path' is not under version control\n";
|
||||||
return;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
||||||
|
|
@ -825,21 +845,21 @@ sub cmd_info {
|
||||||
# canonicalize_path() will return "" to make libsvn 1.5.x happy,
|
# canonicalize_path() will return "" to make libsvn 1.5.x happy,
|
||||||
$path = "." if $path eq "";
|
$path = "." if $path eq "";
|
||||||
|
|
||||||
my $full_url = $url . ($path eq "." ? "" : "/$path");
|
my $full_url = $url . ($fullpath eq "" ? "" : "/$fullpath");
|
||||||
|
|
||||||
if ($_url) {
|
if ($_url) {
|
||||||
print $full_url, "\n";
|
print escape_url($full_url), "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $result = "Path: $path\n";
|
my $result = "Path: $path\n";
|
||||||
$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
|
$result .= "Name: " . basename($path) . "\n" if $file_type ne "dir";
|
||||||
$result .= "URL: " . $full_url . "\n";
|
$result .= "URL: " . escape_url($full_url) . "\n";
|
||||||
|
|
||||||
eval {
|
eval {
|
||||||
my $repos_root = $gs->repos_root;
|
my $repos_root = $gs->repos_root;
|
||||||
Git::SVN::remove_username($repos_root);
|
Git::SVN::remove_username($repos_root);
|
||||||
$result .= "Repository Root: $repos_root\n";
|
$result .= "Repository Root: " . escape_url($repos_root) . "\n";
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
$result .= "Repository Root: (offline)\n";
|
$result .= "Repository Root: (offline)\n";
|
||||||
|
|
@ -861,7 +881,7 @@ sub cmd_info {
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($lc_author, $lc_rev, $lc_date_utc);
|
my ($lc_author, $lc_rev, $lc_date_utc);
|
||||||
my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $path);
|
my @args = Git::SVN::Log::git_svn_log_cmd($rev, $rev, "--", $fullpath);
|
||||||
my $log = command_output_pipe(@args);
|
my $log = command_output_pipe(@args);
|
||||||
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
|
my $esc_color = qr/(?:\033\[(?:(?:\d+;)*\d*)?m)*/;
|
||||||
while (<$log>) {
|
while (<$log>) {
|
||||||
|
|
@ -3380,11 +3400,12 @@ sub generate_diff {
|
||||||
while (<$diff_fh>) {
|
while (<$diff_fh>) {
|
||||||
chomp $_; # this gets rid of the trailing "\0"
|
chomp $_; # this gets rid of the trailing "\0"
|
||||||
if ($state eq 'meta' && /^:(\d{6})\s(\d{6})\s
|
if ($state eq 'meta' && /^:(\d{6})\s(\d{6})\s
|
||||||
$::sha1\s($::sha1)\s
|
($::sha1)\s($::sha1)\s
|
||||||
([MTCRAD])\d*$/xo) {
|
([MTCRAD])\d*$/xo) {
|
||||||
push @mods, { mode_a => $1, mode_b => $2,
|
push @mods, { mode_a => $1, mode_b => $2,
|
||||||
sha1_b => $3, chg => $4 };
|
sha1_a => $3, sha1_b => $4,
|
||||||
if ($4 =~ /^(?:C|R)$/) {
|
chg => $5 };
|
||||||
|
if ($5 =~ /^(?:C|R)$/) {
|
||||||
$state = 'file_a';
|
$state = 'file_a';
|
||||||
} else {
|
} else {
|
||||||
$state = 'file_b';
|
$state = 'file_b';
|
||||||
|
|
@ -3636,6 +3657,7 @@ sub R {
|
||||||
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
|
my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
|
||||||
$self->url_path($m->{file_a}), $self->{r});
|
$self->url_path($m->{file_a}), $self->{r});
|
||||||
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
|
print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
|
||||||
|
$self->apply_autoprops($file, $fbat);
|
||||||
$self->chg_file($fbat, $m);
|
$self->chg_file($fbat, $m);
|
||||||
$self->close_file($fbat,undef,$self->{pool});
|
$self->close_file($fbat,undef,$self->{pool});
|
||||||
|
|
||||||
|
|
@ -3662,6 +3684,27 @@ sub change_file_prop {
|
||||||
$self->SUPER::change_file_prop($fbat, $pname, $pval, $self->{pool});
|
$self->SUPER::change_file_prop($fbat, $pname, $pval, $self->{pool});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _chg_file_get_blob ($$$$) {
|
||||||
|
my ($self, $fbat, $m, $which) = @_;
|
||||||
|
my $fh = Git::temp_acquire("git_blob_$which");
|
||||||
|
if ($m->{"mode_$which"} =~ /^120/) {
|
||||||
|
print $fh 'link ' or croak $!;
|
||||||
|
$self->change_file_prop($fbat,'svn:special','*');
|
||||||
|
} elsif ($m->{mode_a} =~ /^120/ && $m->{"mode_$which"} !~ /^120/) {
|
||||||
|
$self->change_file_prop($fbat,'svn:special',undef);
|
||||||
|
}
|
||||||
|
my $blob = $m->{"sha1_$which"};
|
||||||
|
return ($fh,) if ($blob =~ /^0{40}$/);
|
||||||
|
my $size = $::_repository->cat_blob($blob, $fh);
|
||||||
|
croak "Failed to read object $blob" if ($size < 0);
|
||||||
|
$fh->flush == 0 or croak $!;
|
||||||
|
seek $fh, 0, 0 or croak $!;
|
||||||
|
|
||||||
|
my $exp = ::md5sum($fh);
|
||||||
|
seek $fh, 0, 0 or croak $!;
|
||||||
|
return ($fh, $exp);
|
||||||
|
}
|
||||||
|
|
||||||
sub chg_file {
|
sub chg_file {
|
||||||
my ($self, $fbat, $m) = @_;
|
my ($self, $fbat, $m) = @_;
|
||||||
if ($m->{mode_b} =~ /755$/ && $m->{mode_a} !~ /755$/) {
|
if ($m->{mode_b} =~ /755$/ && $m->{mode_a} !~ /755$/) {
|
||||||
|
|
@ -3669,26 +3712,24 @@ sub chg_file {
|
||||||
} elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {
|
} elsif ($m->{mode_b} !~ /755$/ && $m->{mode_a} =~ /755$/) {
|
||||||
$self->change_file_prop($fbat,'svn:executable',undef);
|
$self->change_file_prop($fbat,'svn:executable',undef);
|
||||||
}
|
}
|
||||||
my $fh = Git::temp_acquire('git_blob');
|
my ($fh_a, $exp_a) = _chg_file_get_blob $self, $fbat, $m, 'a';
|
||||||
if ($m->{mode_b} =~ /^120/) {
|
my ($fh_b, $exp_b) = _chg_file_get_blob $self, $fbat, $m, 'b';
|
||||||
print $fh 'link ' or croak $!;
|
|
||||||
$self->change_file_prop($fbat,'svn:special','*');
|
|
||||||
} elsif ($m->{mode_a} =~ /^120/ && $m->{mode_b} !~ /^120/) {
|
|
||||||
$self->change_file_prop($fbat,'svn:special',undef);
|
|
||||||
}
|
|
||||||
my $size = $::_repository->cat_blob($m->{sha1_b}, $fh);
|
|
||||||
croak "Failed to read object $m->{sha1_b}" if ($size < 0);
|
|
||||||
$fh->flush == 0 or croak $!;
|
|
||||||
seek $fh, 0, 0 or croak $!;
|
|
||||||
|
|
||||||
my $exp = ::md5sum($fh);
|
|
||||||
seek $fh, 0, 0 or croak $!;
|
|
||||||
|
|
||||||
my $pool = SVN::Pool->new;
|
my $pool = SVN::Pool->new;
|
||||||
my $atd = $self->apply_textdelta($fbat, undef, $pool);
|
my $atd = $self->apply_textdelta($fbat, $exp_a, $pool);
|
||||||
my $got = SVN::TxDelta::send_stream($fh, @$atd, $pool);
|
if (-s $fh_a) {
|
||||||
die "Checksum mismatch\nexpected: $exp\ngot: $got\n" if ($got ne $exp);
|
my $txstream = SVN::TxDelta::new ($fh_a, $fh_b, $pool);
|
||||||
Git::temp_release($fh, 1);
|
my $res = SVN::TxDelta::send_txstream($txstream, @$atd, $pool);
|
||||||
|
if (defined $res) {
|
||||||
|
die "Unexpected result from send_txstream: $res\n",
|
||||||
|
"(SVN::Core::VERSION: $SVN::Core::VERSION)\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
my $got = SVN::TxDelta::send_stream($fh_b, @$atd, $pool);
|
||||||
|
die "Checksum mismatch\nexpected: $exp_b\ngot: $got\n"
|
||||||
|
if ($got ne $exp_b);
|
||||||
|
}
|
||||||
|
Git::temp_release($fh_b, 1);
|
||||||
|
Git::temp_release($fh_a, 1);
|
||||||
$pool->clear;
|
$pool->clear;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,10 @@ test_description='git-svn info'
|
||||||
|
|
||||||
. ./lib-git-svn.sh
|
. ./lib-git-svn.sh
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Tested with: svn, version 1.4.4 (r25188)
|
# Tested with: svn, version 1.4.4 (r25188)
|
||||||
v=`svn --version | sed -n -e 's/^svn, version \(1\.4\.[0-9]\).*$/\1/p'`
|
v=`svn --version | sed -n -e 's/^svn, version \(1\.[0-9]*\.[0-9]*\).*$/\1/p'`
|
||||||
case $v in
|
case $v in
|
||||||
1.4.*)
|
1.[45].*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
say "skipping svn-info test (SVN version: $v not supported)"
|
say "skipping svn-info test (SVN version: $v not supported)"
|
||||||
|
|
@ -36,6 +34,8 @@ ptouch() {
|
||||||
' "`svn info $2 | grep '^Text Last Updated:'`" "$1"
|
' "`svn info $2 | grep '^Text Last Updated:'`" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quoted_svnrepo="$(echo $svnrepo | sed 's/ /%20/')"
|
||||||
|
|
||||||
test_expect_success 'setup repository and import' '
|
test_expect_success 'setup repository and import' '
|
||||||
mkdir info &&
|
mkdir info &&
|
||||||
cd info &&
|
cd info &&
|
||||||
|
|
@ -47,67 +47,79 @@ test_expect_success 'setup repository and import' '
|
||||||
ln -s directory symlink-directory &&
|
ln -s directory symlink-directory &&
|
||||||
svn import -m "initial" . "$svnrepo" &&
|
svn import -m "initial" . "$svnrepo" &&
|
||||||
cd .. &&
|
cd .. &&
|
||||||
|
svn co "$svnrepo" svnwc &&
|
||||||
|
cd svnwc &&
|
||||||
|
echo foo > foo &&
|
||||||
|
svn add foo &&
|
||||||
|
svn commit -m "change outside directory" &&
|
||||||
|
svn update &&
|
||||||
|
cd .. &&
|
||||||
mkdir gitwc &&
|
mkdir gitwc &&
|
||||||
cd gitwc &&
|
cd gitwc &&
|
||||||
git-svn init "$svnrepo" &&
|
git-svn init "$svnrepo" &&
|
||||||
git-svn fetch &&
|
git-svn fetch &&
|
||||||
cd .. &&
|
cd .. &&
|
||||||
svn co "$svnrepo" svnwc &&
|
ptouch gitwc/file svnwc/file &&
|
||||||
ptouch svnwc/file gitwc/file &&
|
ptouch gitwc/directory svnwc/directory &&
|
||||||
ptouch svnwc/directory gitwc/directory &&
|
ptouch gitwc/symlink-file svnwc/symlink-file &&
|
||||||
ptouch svnwc/symlink-file gitwc/symlink-file &&
|
ptouch gitwc/symlink-directory svnwc/symlink-directory
|
||||||
ptouch svnwc/symlink-directory gitwc/symlink-directory
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info' "
|
test_expect_success 'info' "
|
||||||
(cd svnwc; svn info) > expected.info &&
|
(cd svnwc; svn info) > expected.info &&
|
||||||
(cd gitwc; git-svn info) > actual.info &&
|
(cd gitwc; git-svn info) > actual.info &&
|
||||||
git-diff expected.info actual.info
|
test_cmp expected.info actual.info
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url' '
|
test_expect_success 'info --url' '
|
||||||
test "$(cd gitwc; git-svn info --url)" = "$svnrepo"
|
test "$(cd gitwc; git-svn info --url)" = "$quoted_svnrepo"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info .' "
|
test_expect_success 'info .' "
|
||||||
(cd svnwc; svn info .) > expected.info-dot &&
|
(cd svnwc; svn info .) > expected.info-dot &&
|
||||||
(cd gitwc; git-svn info .) > actual.info-dot &&
|
(cd gitwc; git-svn info .) > actual.info-dot &&
|
||||||
git-diff expected.info-dot actual.info-dot
|
test_cmp expected.info-dot actual.info-dot
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url .' '
|
test_expect_success 'info --url .' '
|
||||||
test "$(cd gitwc; git-svn info --url .)" = "$svnrepo"
|
test "$(cd gitwc; git-svn info --url .)" = "$quoted_svnrepo"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info file' "
|
test_expect_success 'info file' "
|
||||||
(cd svnwc; svn info file) > expected.info-file &&
|
(cd svnwc; svn info file) > expected.info-file &&
|
||||||
(cd gitwc; git-svn info file) > actual.info-file &&
|
(cd gitwc; git-svn info file) > actual.info-file &&
|
||||||
git-diff expected.info-file actual.info-file
|
test_cmp expected.info-file actual.info-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url file' '
|
test_expect_success 'info --url file' '
|
||||||
test "$(cd gitwc; git-svn info --url file)" = "$svnrepo/file"
|
test "$(cd gitwc; git-svn info --url file)" = "$quoted_svnrepo/file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info directory' "
|
test_expect_success 'info directory' "
|
||||||
(cd svnwc; svn info directory) > expected.info-directory &&
|
(cd svnwc; svn info directory) > expected.info-directory &&
|
||||||
(cd gitwc; git-svn info directory) > actual.info-directory &&
|
(cd gitwc; git-svn info directory) > actual.info-directory &&
|
||||||
git-diff expected.info-directory actual.info-directory
|
test_cmp expected.info-directory actual.info-directory
|
||||||
|
"
|
||||||
|
|
||||||
|
test_expect_success 'info inside directory' "
|
||||||
|
(cd svnwc/directory; svn info) > expected.info-inside-directory &&
|
||||||
|
(cd gitwc/directory; git-svn info) > actual.info-inside-directory &&
|
||||||
|
test_cmp expected.info-inside-directory actual.info-inside-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url directory' '
|
test_expect_success 'info --url directory' '
|
||||||
test "$(cd gitwc; git-svn info --url directory)" = "$svnrepo/directory"
|
test "$(cd gitwc; git-svn info --url directory)" = "$quoted_svnrepo/directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info symlink-file' "
|
test_expect_success 'info symlink-file' "
|
||||||
(cd svnwc; svn info symlink-file) > expected.info-symlink-file &&
|
(cd svnwc; svn info symlink-file) > expected.info-symlink-file &&
|
||||||
(cd gitwc; git-svn info symlink-file) > actual.info-symlink-file &&
|
(cd gitwc; git-svn info symlink-file) > actual.info-symlink-file &&
|
||||||
git-diff expected.info-symlink-file actual.info-symlink-file
|
test_cmp expected.info-symlink-file actual.info-symlink-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url symlink-file' '
|
test_expect_success 'info --url symlink-file' '
|
||||||
test "$(cd gitwc; git-svn info --url symlink-file)" \
|
test "$(cd gitwc; git-svn info --url symlink-file)" \
|
||||||
= "$svnrepo/symlink-file"
|
= "$quoted_svnrepo/symlink-file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info symlink-directory' "
|
test_expect_success 'info symlink-directory' "
|
||||||
|
|
@ -115,12 +127,12 @@ test_expect_success 'info symlink-directory' "
|
||||||
> expected.info-symlink-directory &&
|
> expected.info-symlink-directory &&
|
||||||
(cd gitwc; git-svn info symlink-directory) \
|
(cd gitwc; git-svn info symlink-directory) \
|
||||||
> actual.info-symlink-directory &&
|
> actual.info-symlink-directory &&
|
||||||
git-diff expected.info-symlink-directory actual.info-symlink-directory
|
test_cmp expected.info-symlink-directory actual.info-symlink-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url symlink-directory' '
|
test_expect_success 'info --url symlink-directory' '
|
||||||
test "$(cd gitwc; git-svn info --url symlink-directory)" \
|
test "$(cd gitwc; git-svn info --url symlink-directory)" \
|
||||||
= "$svnrepo/symlink-directory"
|
= "$quoted_svnrepo/symlink-directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info added-file' "
|
test_expect_success 'info added-file' "
|
||||||
|
|
@ -135,12 +147,12 @@ test_expect_success 'info added-file' "
|
||||||
cd .. &&
|
cd .. &&
|
||||||
(cd svnwc; svn info added-file) > expected.info-added-file &&
|
(cd svnwc; svn info added-file) > expected.info-added-file &&
|
||||||
(cd gitwc; git-svn info added-file) > actual.info-added-file &&
|
(cd gitwc; git-svn info added-file) > actual.info-added-file &&
|
||||||
git-diff expected.info-added-file actual.info-added-file
|
test_cmp expected.info-added-file actual.info-added-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url added-file' '
|
test_expect_success 'info --url added-file' '
|
||||||
test "$(cd gitwc; git-svn info --url added-file)" \
|
test "$(cd gitwc; git-svn info --url added-file)" \
|
||||||
= "$svnrepo/added-file"
|
= "$quoted_svnrepo/added-file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info added-directory' "
|
test_expect_success 'info added-directory' "
|
||||||
|
|
@ -157,12 +169,12 @@ test_expect_success 'info added-directory' "
|
||||||
> expected.info-added-directory &&
|
> expected.info-added-directory &&
|
||||||
(cd gitwc; git-svn info added-directory) \
|
(cd gitwc; git-svn info added-directory) \
|
||||||
> actual.info-added-directory &&
|
> actual.info-added-directory &&
|
||||||
git-diff expected.info-added-directory actual.info-added-directory
|
test_cmp expected.info-added-directory actual.info-added-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url added-directory' '
|
test_expect_success 'info --url added-directory' '
|
||||||
test "$(cd gitwc; git-svn info --url added-directory)" \
|
test "$(cd gitwc; git-svn info --url added-directory)" \
|
||||||
= "$svnrepo/added-directory"
|
= "$quoted_svnrepo/added-directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info added-symlink-file' "
|
test_expect_success 'info added-symlink-file' "
|
||||||
|
|
@ -179,13 +191,13 @@ test_expect_success 'info added-symlink-file' "
|
||||||
> expected.info-added-symlink-file &&
|
> expected.info-added-symlink-file &&
|
||||||
(cd gitwc; git-svn info added-symlink-file) \
|
(cd gitwc; git-svn info added-symlink-file) \
|
||||||
> actual.info-added-symlink-file &&
|
> actual.info-added-symlink-file &&
|
||||||
git-diff expected.info-added-symlink-file \
|
test_cmp expected.info-added-symlink-file \
|
||||||
actual.info-added-symlink-file
|
actual.info-added-symlink-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url added-symlink-file' '
|
test_expect_success 'info --url added-symlink-file' '
|
||||||
test "$(cd gitwc; git-svn info --url added-symlink-file)" \
|
test "$(cd gitwc; git-svn info --url added-symlink-file)" \
|
||||||
= "$svnrepo/added-symlink-file"
|
= "$quoted_svnrepo/added-symlink-file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info added-symlink-directory' "
|
test_expect_success 'info added-symlink-directory' "
|
||||||
|
|
@ -202,13 +214,13 @@ test_expect_success 'info added-symlink-directory' "
|
||||||
> expected.info-added-symlink-directory &&
|
> expected.info-added-symlink-directory &&
|
||||||
(cd gitwc; git-svn info added-symlink-directory) \
|
(cd gitwc; git-svn info added-symlink-directory) \
|
||||||
> actual.info-added-symlink-directory &&
|
> actual.info-added-symlink-directory &&
|
||||||
git-diff expected.info-added-symlink-directory \
|
test_cmp expected.info-added-symlink-directory \
|
||||||
actual.info-added-symlink-directory
|
actual.info-added-symlink-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url added-symlink-directory' '
|
test_expect_success 'info --url added-symlink-directory' '
|
||||||
test "$(cd gitwc; git-svn info --url added-symlink-directory)" \
|
test "$(cd gitwc; git-svn info --url added-symlink-directory)" \
|
||||||
= "$svnrepo/added-symlink-directory"
|
= "$quoted_svnrepo/added-symlink-directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
# The next few tests replace the "Text Last Updated" value with a
|
# The next few tests replace the "Text Last Updated" value with a
|
||||||
|
|
@ -229,12 +241,12 @@ test_expect_success 'info deleted-file' "
|
||||||
(cd gitwc; git-svn info file) |
|
(cd gitwc; git-svn info file) |
|
||||||
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
||||||
> actual.info-deleted-file &&
|
> actual.info-deleted-file &&
|
||||||
git-diff expected.info-deleted-file actual.info-deleted-file
|
test_cmp expected.info-deleted-file actual.info-deleted-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url file (deleted)' '
|
test_expect_success 'info --url file (deleted)' '
|
||||||
test "$(cd gitwc; git-svn info --url file)" \
|
test "$(cd gitwc; git-svn info --url file)" \
|
||||||
= "$svnrepo/file"
|
= "$quoted_svnrepo/file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info deleted-directory' "
|
test_expect_success 'info deleted-directory' "
|
||||||
|
|
@ -250,12 +262,12 @@ test_expect_success 'info deleted-directory' "
|
||||||
(cd gitwc; git-svn info directory) |
|
(cd gitwc; git-svn info directory) |
|
||||||
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
||||||
> actual.info-deleted-directory &&
|
> actual.info-deleted-directory &&
|
||||||
git-diff expected.info-deleted-directory actual.info-deleted-directory
|
test_cmp expected.info-deleted-directory actual.info-deleted-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url directory (deleted)' '
|
test_expect_success 'info --url directory (deleted)' '
|
||||||
test "$(cd gitwc; git-svn info --url directory)" \
|
test "$(cd gitwc; git-svn info --url directory)" \
|
||||||
= "$svnrepo/directory"
|
= "$quoted_svnrepo/directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info deleted-symlink-file' "
|
test_expect_success 'info deleted-symlink-file' "
|
||||||
|
|
@ -271,13 +283,13 @@ test_expect_success 'info deleted-symlink-file' "
|
||||||
(cd gitwc; git-svn info symlink-file) |
|
(cd gitwc; git-svn info symlink-file) |
|
||||||
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
||||||
> actual.info-deleted-symlink-file &&
|
> actual.info-deleted-symlink-file &&
|
||||||
git-diff expected.info-deleted-symlink-file \
|
test_cmp expected.info-deleted-symlink-file \
|
||||||
actual.info-deleted-symlink-file
|
actual.info-deleted-symlink-file
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url symlink-file (deleted)' '
|
test_expect_success 'info --url symlink-file (deleted)' '
|
||||||
test "$(cd gitwc; git-svn info --url symlink-file)" \
|
test "$(cd gitwc; git-svn info --url symlink-file)" \
|
||||||
= "$svnrepo/symlink-file"
|
= "$quoted_svnrepo/symlink-file"
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info deleted-symlink-directory' "
|
test_expect_success 'info deleted-symlink-directory' "
|
||||||
|
|
@ -293,13 +305,13 @@ test_expect_success 'info deleted-symlink-directory' "
|
||||||
(cd gitwc; git-svn info symlink-directory) |
|
(cd gitwc; git-svn info symlink-directory) |
|
||||||
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
|
||||||
> actual.info-deleted-symlink-directory &&
|
> actual.info-deleted-symlink-directory &&
|
||||||
git-diff expected.info-deleted-symlink-directory \
|
test_cmp expected.info-deleted-symlink-directory \
|
||||||
actual.info-deleted-symlink-directory
|
actual.info-deleted-symlink-directory
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url symlink-directory (deleted)' '
|
test_expect_success 'info --url symlink-directory (deleted)' '
|
||||||
test "$(cd gitwc; git-svn info --url symlink-directory)" \
|
test "$(cd gitwc; git-svn info --url symlink-directory)" \
|
||||||
= "$svnrepo/symlink-directory"
|
= "$quoted_svnrepo/symlink-directory"
|
||||||
'
|
'
|
||||||
|
|
||||||
# NOTE: git does not have the concept of replaced objects,
|
# NOTE: git does not have the concept of replaced objects,
|
||||||
|
|
@ -307,82 +319,59 @@ test_expect_success 'info --url symlink-directory (deleted)' '
|
||||||
|
|
||||||
test_expect_success 'info unknown-file' "
|
test_expect_success 'info unknown-file' "
|
||||||
echo two > gitwc/unknown-file &&
|
echo two > gitwc/unknown-file &&
|
||||||
cp gitwc/unknown-file svnwc/unknown-file &&
|
(cd gitwc; test_must_fail git-svn info unknown-file) \
|
||||||
ptouch gitwc/unknown-file svnwc/unknown-file &&
|
2> actual.info-unknown-file &&
|
||||||
(cd svnwc; svn info unknown-file) 2> expected.info-unknown-file &&
|
grep unknown-file actual.info-unknown-file
|
||||||
(cd gitwc; git-svn info unknown-file) 2> actual.info-unknown-file &&
|
|
||||||
git-diff expected.info-unknown-file actual.info-unknown-file
|
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url unknown-file' '
|
test_expect_success 'info --url unknown-file' '
|
||||||
test -z "$(cd gitwc; git-svn info --url unknown-file \
|
echo two > gitwc/unknown-file &&
|
||||||
2> ../actual.info--url-unknown-file)" &&
|
(cd gitwc; test_must_fail git-svn info --url unknown-file) \
|
||||||
git-diff expected.info-unknown-file actual.info--url-unknown-file
|
2> actual.info-url-unknown-file &&
|
||||||
|
grep unknown-file actual.info-url-unknown-file
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info unknown-directory' "
|
test_expect_success 'info unknown-directory' "
|
||||||
mkdir gitwc/unknown-directory svnwc/unknown-directory &&
|
mkdir gitwc/unknown-directory svnwc/unknown-directory &&
|
||||||
ptouch gitwc/unknown-directory svnwc/unknown-directory &&
|
(cd gitwc; test_must_fail git-svn info unknown-directory) \
|
||||||
touch gitwc/unknown-directory/.placeholder &&
|
2> actual.info-unknown-directory &&
|
||||||
(cd svnwc; svn info unknown-directory) \
|
grep unknown-directory actual.info-unknown-directory
|
||||||
2> expected.info-unknown-directory &&
|
|
||||||
(cd gitwc; git-svn info unknown-directory) \
|
|
||||||
2> actual.info-unknown-directory &&
|
|
||||||
git-diff expected.info-unknown-directory actual.info-unknown-directory
|
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url unknown-directory' '
|
test_expect_success 'info --url unknown-directory' '
|
||||||
test -z "$(cd gitwc; git-svn info --url unknown-directory \
|
(cd gitwc; test_must_fail git-svn info --url unknown-directory) \
|
||||||
2> ../actual.info--url-unknown-directory)" &&
|
2> actual.info-url-unknown-directory &&
|
||||||
git-diff expected.info-unknown-directory \
|
grep unknown-directory actual.info-url-unknown-directory
|
||||||
actual.info--url-unknown-directory
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info unknown-symlink-file' "
|
test_expect_success 'info unknown-symlink-file' "
|
||||||
cd gitwc &&
|
cd gitwc &&
|
||||||
ln -s unknown-file unknown-symlink-file &&
|
ln -s unknown-file unknown-symlink-file &&
|
||||||
cd .. &&
|
cd .. &&
|
||||||
cd svnwc &&
|
(cd gitwc; test_must_fail git-svn info unknown-symlink-file) \
|
||||||
ln -s unknown-file unknown-symlink-file &&
|
2> actual.info-unknown-symlink-file &&
|
||||||
cd .. &&
|
grep unknown-symlink-file actual.info-unknown-symlink-file
|
||||||
ptouch gitwc/unknown-symlink-file svnwc/unknown-symlink-file &&
|
|
||||||
(cd svnwc; svn info unknown-symlink-file) \
|
|
||||||
2> expected.info-unknown-symlink-file &&
|
|
||||||
(cd gitwc; git-svn info unknown-symlink-file) \
|
|
||||||
2> actual.info-unknown-symlink-file &&
|
|
||||||
git-diff expected.info-unknown-symlink-file \
|
|
||||||
actual.info-unknown-symlink-file
|
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url unknown-symlink-file' '
|
test_expect_success 'info --url unknown-symlink-file' '
|
||||||
test -z "$(cd gitwc; git-svn info --url unknown-symlink-file \
|
(cd gitwc; test_must_fail git-svn info --url unknown-symlink-file) \
|
||||||
2> ../actual.info--url-unknown-symlink-file)" &&
|
2> actual.info-url-unknown-symlink-file &&
|
||||||
git-diff expected.info-unknown-symlink-file \
|
grep unknown-symlink-file actual.info-url-unknown-symlink-file
|
||||||
actual.info--url-unknown-symlink-file
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'info unknown-symlink-directory' "
|
test_expect_success 'info unknown-symlink-directory' "
|
||||||
cd gitwc &&
|
cd gitwc &&
|
||||||
ln -s unknown-directory unknown-symlink-directory &&
|
ln -s unknown-directory unknown-symlink-directory &&
|
||||||
cd .. &&
|
cd .. &&
|
||||||
cd svnwc &&
|
(cd gitwc; test_must_fail git-svn info unknown-symlink-directory) \
|
||||||
ln -s unknown-directory unknown-symlink-directory &&
|
2> actual.info-unknown-symlink-directory &&
|
||||||
cd .. &&
|
grep unknown-symlink-directory actual.info-unknown-symlink-directory
|
||||||
ptouch gitwc/unknown-symlink-directory \
|
|
||||||
svnwc/unknown-symlink-directory &&
|
|
||||||
(cd svnwc; svn info unknown-symlink-directory) \
|
|
||||||
2> expected.info-unknown-symlink-directory &&
|
|
||||||
(cd gitwc; git-svn info unknown-symlink-directory) \
|
|
||||||
2> actual.info-unknown-symlink-directory &&
|
|
||||||
git-diff expected.info-unknown-symlink-directory \
|
|
||||||
actual.info-unknown-symlink-directory
|
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'info --url unknown-symlink-directory' '
|
test_expect_success 'info --url unknown-symlink-directory' '
|
||||||
test -z "$(cd gitwc; git-svn info --url unknown-symlink-directory \
|
(cd gitwc; test_must_fail git-svn info --url unknown-symlink-directory) \
|
||||||
2> ../actual.info--url-unknown-symlink-directory)" &&
|
2> actual.info-url-unknown-symlink-directory &&
|
||||||
git-diff expected.info-unknown-symlink-directory \
|
grep unknown-symlink-directory actual.info-url-unknown-symlink-directory
|
||||||
actual.info--url-unknown-symlink-directory
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,11 @@ test_expect_success 'initialize git-svn' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'enable auto-props config' '
|
test_expect_success 'enable auto-props config' '
|
||||||
cd "$gittestrepo" &&
|
|
||||||
mkdir user &&
|
mkdir user &&
|
||||||
generate_auto_props yes >user/config
|
generate_auto_props yes >user/config
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'add files matching auto-props' '
|
test_expect_success 'add files matching auto-props' '
|
||||||
cd "$gittestrepo" &&
|
|
||||||
echo "#!$SHELL_PATH" >exec1.sh &&
|
echo "#!$SHELL_PATH" >exec1.sh &&
|
||||||
chmod +x exec1.sh &&
|
chmod +x exec1.sh &&
|
||||||
echo "hello" >hello.txt &&
|
echo "hello" >hello.txt &&
|
||||||
|
|
@ -46,12 +44,10 @@ test_expect_success 'add files matching auto-props' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'disable auto-props config' '
|
test_expect_success 'disable auto-props config' '
|
||||||
cd "$gittestrepo" &&
|
|
||||||
generate_auto_props no >user/config
|
generate_auto_props no >user/config
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'add files matching disabled auto-props' '
|
test_expect_success 'add files matching disabled auto-props' '
|
||||||
cd "$gittestrepo" &&
|
|
||||||
echo "#$SHELL_PATH" >exec2.sh &&
|
echo "#$SHELL_PATH" >exec2.sh &&
|
||||||
chmod +x exec2.sh &&
|
chmod +x exec2.sh &&
|
||||||
echo "world" >world.txt &&
|
echo "world" >world.txt &&
|
||||||
|
|
@ -62,6 +58,7 @@ test_expect_success 'add files matching disabled auto-props' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'check resulting svn repository' '
|
test_expect_success 'check resulting svn repository' '
|
||||||
|
(
|
||||||
mkdir work &&
|
mkdir work &&
|
||||||
cd work &&
|
cd work &&
|
||||||
svn co "$svnrepo" &&
|
svn co "$svnrepo" &&
|
||||||
|
|
@ -81,6 +78,24 @@ test_expect_success 'check resulting svn repository' '
|
||||||
test "x$(svn propget svn:mime-type world.txt)" = "x" &&
|
test "x$(svn propget svn:mime-type world.txt)" = "x" &&
|
||||||
test "x$(svn propget svn:eol-style world.txt)" = "x" &&
|
test "x$(svn propget svn:eol-style world.txt)" = "x" &&
|
||||||
test "x$(svn propget svn:mime-type zot)" = "x"
|
test "x$(svn propget svn:mime-type zot)" = "x"
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'check renamed file' '
|
||||||
|
test -d user &&
|
||||||
|
generate_auto_props yes > user/config &&
|
||||||
|
git mv foo foo.sh &&
|
||||||
|
git commit -m "foo => foo.sh" &&
|
||||||
|
git svn dcommit --config-dir=user &&
|
||||||
|
(
|
||||||
|
cd work/svnrepo &&
|
||||||
|
svn up &&
|
||||||
|
test ! -e foo &&
|
||||||
|
test -e foo.sh &&
|
||||||
|
test "x$(svn propget svn:mime-type foo.sh)" = \
|
||||||
|
"xapplication/x-shellscript" &&
|
||||||
|
test "x$(svn propget svn:eol-style foo.sh)" = "xLF"
|
||||||
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue