зеркало из https://github.com/microsoft/git.git
symref support for import scripts
Fix git import script not to assume that .git/HEAD is a symlink. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
c0c35d5e41
Коммит
8366a10ab2
|
@ -410,8 +410,7 @@ foreach my $ps (@psets) {
|
||||||
open HEAD, ">$git_dir/refs/heads/$ps->{branch}";
|
open HEAD, ">$git_dir/refs/heads/$ps->{branch}";
|
||||||
print HEAD $commitid;
|
print HEAD $commitid;
|
||||||
close HEAD;
|
close HEAD;
|
||||||
unlink ("$git_dir/HEAD");
|
system('git-update-ref', 'HEAD', "$ps->{branch}");
|
||||||
symlink("refs/heads/$ps->{branch}","$git_dir/HEAD");
|
|
||||||
|
|
||||||
# tag accordingly
|
# tag accordingly
|
||||||
ptag($ps->{id}, $commitid); # private tag
|
ptag($ps->{id}, $commitid); # private tag
|
||||||
|
|
|
@ -437,7 +437,11 @@ unless(-d $git_dir) {
|
||||||
"Either use the correct '-o branch' option,\n".
|
"Either use the correct '-o branch' option,\n".
|
||||||
"or import to a new repository.\n";
|
"or import to a new repository.\n";
|
||||||
|
|
||||||
$last_branch = basename(readlink("$git_dir/HEAD"));
|
open(F, "git-symbolic-ref HEAD |") or
|
||||||
|
die "Cannot run git-symbolic-ref: $!\n";
|
||||||
|
chomp ($last_branch = <F>);
|
||||||
|
$last_branch = basename($last_branch);
|
||||||
|
close(F);
|
||||||
unless($last_branch) {
|
unless($last_branch) {
|
||||||
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
||||||
$last_branch = "master";
|
$last_branch = "master";
|
||||||
|
@ -829,8 +833,7 @@ if($orig_branch) {
|
||||||
print "DONE; creating $orig_branch branch\n" if $opt_v;
|
print "DONE; creating $orig_branch branch\n" if $opt_v;
|
||||||
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
|
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
|
||||||
unless -f "$git_dir/refs/heads/master";
|
unless -f "$git_dir/refs/heads/master";
|
||||||
unlink("$git_dir/HEAD");
|
system('git-update-ref', 'HEAD', "$orig_branch");
|
||||||
symlink("refs/heads/$orig_branch","$git_dir/HEAD");
|
|
||||||
unless ($opt_i) {
|
unless ($opt_i) {
|
||||||
system('git checkout');
|
system('git checkout');
|
||||||
die "checkout failed: $?\n" if $?;
|
die "checkout failed: $?\n" if $?;
|
||||||
|
|
|
@ -216,7 +216,11 @@ unless(-d $git_dir) {
|
||||||
-f "$git_dir/svn2git"
|
-f "$git_dir/svn2git"
|
||||||
or die "'$git_dir/svn2git' does not exist.\n".
|
or die "'$git_dir/svn2git' does not exist.\n".
|
||||||
"You need that file for incremental imports.\n";
|
"You need that file for incremental imports.\n";
|
||||||
$last_branch = basename(readlink("$git_dir/HEAD"));
|
open(F, "git-symbolic-ref HEAD |") or
|
||||||
|
die "Cannot run git-symbolic-ref: $!\n";
|
||||||
|
chomp ($last_branch = <F>);
|
||||||
|
$last_branch = basename($last_branch);
|
||||||
|
close(F);
|
||||||
unless($last_branch) {
|
unless($last_branch) {
|
||||||
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
|
||||||
$last_branch = "master";
|
$last_branch = "master";
|
||||||
|
@ -766,8 +770,7 @@ if($orig_branch) {
|
||||||
print "DONE; creating $orig_branch branch\n" if $opt_v and (not defined $opt_l or $opt_l > 0);
|
print "DONE; creating $orig_branch branch\n" if $opt_v and (not defined $opt_l or $opt_l > 0);
|
||||||
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
|
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
|
||||||
unless -f "$git_dir/refs/heads/master";
|
unless -f "$git_dir/refs/heads/master";
|
||||||
unlink("$git_dir/HEAD");
|
system('git-update-ref', 'HEAD', "$orig_branch");
|
||||||
symlink("refs/heads/$orig_branch","$git_dir/HEAD");
|
|
||||||
unless ($opt_i) {
|
unless ($opt_i) {
|
||||||
system('git checkout');
|
system('git checkout');
|
||||||
die "checkout failed: $?\n" if $?;
|
die "checkout failed: $?\n" if $?;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче