Merge branch 'mh/git-svn-automkdirs'
* mh/git-svn-automkdirs: git-svn: add an option to skip the creation of empty directories
This commit is contained in:
@ -350,6 +350,8 @@ Any other arguments are passed directly to 'git log'
|
|||||||
Empty directories are automatically recreated when using
|
Empty directories are automatically recreated when using
|
||||||
"git svn clone" and "git svn rebase", so "mkdirs" is intended
|
"git svn clone" and "git svn rebase", so "mkdirs" is intended
|
||||||
for use after commands like "git checkout" or "git reset".
|
for use after commands like "git checkout" or "git reset".
|
||||||
|
(See the svn-remote.<name>.automkdirs config file option for
|
||||||
|
more information.)
|
||||||
|
|
||||||
'commit-diff'::
|
'commit-diff'::
|
||||||
Commits the diff of two tree-ish arguments from the
|
Commits the diff of two tree-ish arguments from the
|
||||||
@ -680,6 +682,14 @@ svn.pathnameencoding::
|
|||||||
locales to avoid corrupted file names with non-ASCII characters.
|
locales to avoid corrupted file names with non-ASCII characters.
|
||||||
Valid encodings are the ones supported by Perl's Encode module.
|
Valid encodings are the ones supported by Perl's Encode module.
|
||||||
|
|
||||||
|
svn-remote.<name>.automkdirs::
|
||||||
|
Normally, the "git svn clone" and "git svn rebase" commands
|
||||||
|
attempt to recreate empty directories that are in the
|
||||||
|
Subversion repository. If this option is set to "false", then
|
||||||
|
empty directories will only be created if the "git svn mkdirs"
|
||||||
|
command is run explicitly. If unset, 'git svn' assumes this
|
||||||
|
option to be "true".
|
||||||
|
|
||||||
Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
|
Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
|
||||||
options all affect the metadata generated and used by 'git svn'; they
|
options all affect the metadata generated and used by 'git svn'; they
|
||||||
*must* be set in the configuration file before any history is imported
|
*must* be set in the configuration file before any history is imported
|
||||||
|
17
git-svn.perl
17
git-svn.perl
@ -784,6 +784,15 @@ sub cmd_find_rev {
|
|||||||
print "$result\n" if $result;
|
print "$result\n" if $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub auto_create_empty_directories {
|
||||||
|
my ($gs) = @_;
|
||||||
|
my $var = eval { command_oneline('config', '--get', '--bool',
|
||||||
|
"svn-remote.$gs->{repo_id}.automkdirs") };
|
||||||
|
# By default, create empty directories by consulting the unhandled log,
|
||||||
|
# but allow setting it to 'false' to skip it.
|
||||||
|
return !($var && $var eq 'false');
|
||||||
|
}
|
||||||
|
|
||||||
sub cmd_rebase {
|
sub cmd_rebase {
|
||||||
command_noisy(qw/update-index --refresh/);
|
command_noisy(qw/update-index --refresh/);
|
||||||
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
my ($url, $rev, $uuid, $gs) = working_head_info('HEAD');
|
||||||
@ -807,7 +816,9 @@ sub cmd_rebase {
|
|||||||
$_fetch_all ? $gs->fetch_all : $gs->fetch;
|
$_fetch_all ? $gs->fetch_all : $gs->fetch;
|
||||||
}
|
}
|
||||||
command_noisy(rebase_cmd(), $gs->refname);
|
command_noisy(rebase_cmd(), $gs->refname);
|
||||||
$gs->mkemptydirs;
|
if (auto_create_empty_directories($gs)) {
|
||||||
|
$gs->mkemptydirs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cmd_show_ignore {
|
sub cmd_show_ignore {
|
||||||
@ -1245,7 +1256,9 @@ sub post_fetch_checkout {
|
|||||||
command_noisy(qw/read-tree -m -u -v HEAD HEAD/);
|
command_noisy(qw/read-tree -m -u -v HEAD HEAD/);
|
||||||
print STDERR "Checked out HEAD:\n ",
|
print STDERR "Checked out HEAD:\n ",
|
||||||
$gs->full_url, " r", $gs->last_rev, "\n";
|
$gs->full_url, " r", $gs->last_rev, "\n";
|
||||||
$gs->mkemptydirs($gs->last_rev);
|
if (auto_create_empty_directories($gs)) {
|
||||||
|
$gs->mkemptydirs($gs->last_rev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub complete_svn_url {
|
sub complete_svn_url {
|
||||||
|
@ -28,6 +28,23 @@ test_expect_success 'empty directories exist' '
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'option automkdirs set to false' '
|
||||||
|
(
|
||||||
|
git svn init "$svnrepo" cloned-no-mkdirs &&
|
||||||
|
cd cloned-no-mkdirs &&
|
||||||
|
git config svn-remote.svn.automkdirs false &&
|
||||||
|
git svn fetch &&
|
||||||
|
for i in a b c d d/e d/e/f "weird file name"
|
||||||
|
do
|
||||||
|
if test -d "$i"
|
||||||
|
then
|
||||||
|
echo >&2 "$i exists"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'more emptiness' '
|
test_expect_success 'more emptiness' '
|
||||||
svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
|
svn_cmd mkdir -m "bang bang" "$svnrepo"/"! !"
|
||||||
'
|
'
|
||||||
|
Reference in New Issue
Block a user