From aa431f407f9d971d93d6b117989af576dc3728b2 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Thu, 8 Mar 2012 14:28:52 -0600 Subject: Don't try to unlink non-existing alternates file If you clone using alternates, but the checkout you are using as alternates does not have a submodule, there will be no alternates file for this submodule. Change-Id: Ibd9ed5454459587b6df9d420af4d66d61f4317ca Reviewed-by: Oswald Buddenhagen --- init-repository | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'init-repository') diff --git a/init-repository b/init-repository index 4c4d7b03..489680c2 100755 --- a/init-repository +++ b/init-repository @@ -590,7 +590,9 @@ sub git_clone_one_submodule $self->exe('git', 'repack', '-a'); my $alternates_path = '.git/objects/info/alternates'; - unlink($alternates_path) || confess "unlink $alternates_path: $OS_ERROR"; + if (-e $alternates_path) { + unlink($alternates_path) || confess "unlink $alternates_path: $OS_ERROR"; + } } chdir("..") or confess "cd ..: $OS_ERROR"; -- cgit v1.2.3