summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c0c35d5)
raw | patch | inline | side by side (parent: c0c35d5)
author | Pavel Roskin <proski@gnu.org> | |
Wed, 16 Nov 2005 18:27:28 +0000 (13:27 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 16 Nov 2005 21:19:18 +0000 (13:19 -0800) |
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>
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-archimport.perl | patch | blob | history | |
git-cvsimport.perl | patch | blob | history | |
git-svnimport.perl | patch | blob | history |
diff --git a/git-archimport.perl b/git-archimport.perl
index e22c81628dbde8a16c0bef5f64d3e6b34fba4f26..23becb7962b3fdf3b31db7b492467fc158015de1 100755 (executable)
--- a/git-archimport.perl
+++ b/git-archimport.perl
open HEAD, ">$git_dir/refs/heads/$ps->{branch}";
print HEAD $commitid;
close HEAD;
- unlink ("$git_dir/HEAD");
- symlink("refs/heads/$ps->{branch}","$git_dir/HEAD");
+ system('git-update-ref', 'HEAD', "$ps->{branch}");
# tag accordingly
ptag($ps->{id}, $commitid); # private tag
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 7bd9136205f46d4334b7272e6617c0f7f553f5e8..efe193439bda26d72be3f94b9dd164013967b14f 100755 (executable)
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
"Either use the correct '-o branch' option,\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) {
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
$last_branch = "master";
print "DONE; creating $orig_branch branch\n" if $opt_v;
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
unless -f "$git_dir/refs/heads/master";
- unlink("$git_dir/HEAD");
- symlink("refs/heads/$orig_branch","$git_dir/HEAD");
+ system('git-update-ref', 'HEAD', "$orig_branch");
unless ($opt_i) {
system('git checkout');
die "checkout failed: $?\n" if $?;
diff --git a/git-svnimport.perl b/git-svnimport.perl
index af13fdd8e40c0c2e13e6b0391badcf921e34bb9b..45d77c5bae9c055641c416676c1d783c73fc28bb 100755 (executable)
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
-f "$git_dir/svn2git"
or die "'$git_dir/svn2git' does not exist.\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) {
warn "Cannot read the last branch name: $! -- assuming 'master'\n";
$last_branch = "master";
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")
unless -f "$git_dir/refs/heads/master";
- unlink("$git_dir/HEAD");
- symlink("refs/heads/$orig_branch","$git_dir/HEAD");
+ system('git-update-ref', 'HEAD', "$orig_branch");
unless ($opt_i) {
system('git checkout');
die "checkout failed: $?\n" if $?;