All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] git-svn: make it play nicely with submodules
Date: Sat, 10 Jan 2015 22:11:21 +0000	[thread overview]
Message-ID: <20150110221121.GA30202@dcvr.yhbt.net> (raw)
In-Reply-To: <1420901711-81679-1-git-send-email-artagnon@gmail.com>

Ramkumar Ramachandra <artagnon@gmail.com> 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: (.+)$/;
	}

  reply	other threads:[~2015-01-10 22:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10 14:55 [PATCH] git-svn: make it play nicely with submodules Ramkumar Ramachandra
2015-01-10 22:11 ` Eric Wong [this message]
2015-01-10 22:13   ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150110221121.GA30202@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.