aboutsummaryrefslogtreecommitdiff
path: root/git-svnimport.perl
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2005-11-16 13:27:28 -0500
committerJunio C Hamano <junkio@cox.net>2005-11-16 13:19:18 -0800
commit8366a10ab21f22deb7ea4a9dbd02effcd279318c (patch)
tree6e4362e3906fcdcbb006cb60f0e67bf0adeb28a3 /git-svnimport.perl
parentc0c35d5e419f3bf215103b1e26359aca288c2113 (diff)
downloadgit-8366a10ab21f22deb7ea4a9dbd02effcd279318c.tar.gz
git-8366a10ab21f22deb7ea4a9dbd02effcd279318c.tar.xz
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>
Diffstat (limited to 'git-svnimport.perl')
-rwxr-xr-xgit-svnimport.perl9
1 files changed, 6 insertions, 3 deletions
diff --git a/git-svnimport.perl b/git-svnimport.perl
index af13fdd8e..45d77c5ba 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -216,7 +216,11 @@ unless(-d $git_dir) {
-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";
@@ -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);
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 $?;