Re: [PATCH] git-svn: make it play nicely with submodules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> wrote:
> +++ b/git-svn.perl
> @@ -337,6 +337,10 @@ for (my $i = 0; $i < @ARGV; $i++) {
>  # make sure we're always running at the top-level working directory
>  if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {
>  	$ENV{GIT_DIR} ||= ".git";
> +	# catch the submodule case
> +	if (open(my $fh, '<', $ENV{GIT_DIR})) {
> +		$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
> +	}

How portable is open on a directory?  Perhaps it'd be better to
check if it's a file, first:

	if (-f $ENV{GIT_DIR}) {
		open(my $fh, '<', $ENV{GIT_DIR}) or
			die "failed to open $ENV{GIT_DIR}: $!\n";
		$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;
	}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]