git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Eric Wong <normalperson@yhbt.net>
Subject: [PATCH] git-svn: make it play nicely with submodules
Date: Sat, 10 Jan 2015 09:55:11 -0500	[thread overview]
Message-ID: <1420901711-81679-1-git-send-email-artagnon@gmail.com> (raw)

It's a simple matter of opening the directory specified in the gitfile.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 git-svn.perl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/git-svn.perl b/git-svn.perl
index 6aa156c..8642783 100755
--- a/git-svn.perl
+++ 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: (.+)$/;
+	}
 } else {
 	my ($git_dir, $cdup);
 	git_cmd_try {
-- 
2.2.1

             reply	other threads:[~2015-01-10 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-10 14:55 Ramkumar Ramachandra [this message]
2015-01-10 22:11 ` [PATCH] git-svn: make it play nicely with submodules Eric Wong
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=1420901711-81679-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).