{"thread":{"id":"38331","subject":"[PATCH] git-svn: make it play nicely with submodules","startedAt":"2015-01-10T14:55:11Z","lastAt":"2015-01-10T22:13:27Z","messageCount":3,"participants":["Ramkumar Ramachandra","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"254531","messageId":"1420901711-81679-1-git-send-email-artagnon@gmail.com","threadId":"38331","inReplyTo":null,"subject":"[PATCH] git-svn: make it play nicely with submodules","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2015-01-10T14:55:11Z","receivedAt":"2015-01-10T14:55:11Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"It's a simple matter of opening the directory specified in the gitfile.\n\nSigned-off-by: Ramkumar Ramachandra <artagnon@gmail.com>\n---\n git-svn.perl | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 6aa156c..8642783 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -337,6 +337,10 @@ for (my $i = 0; $i < @ARGV; $i++) {\n # make sure we're always running at the top-level working directory\n if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n \t$ENV{GIT_DIR} ||= \".git\";\n+\t# catch the submodule case\n+\tif (open(my $fh, '<', $ENV{GIT_DIR})) {\n+\t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n+\t}\n } else {\n \tmy ($git_dir, $cdup);\n \tgit_cmd_try {\n-- \n2.2.1\n"},{"id":"254541","messageId":"20150110221121.GA30202@dcvr.yhbt.net","threadId":"38331","inReplyTo":"1420901711-81679-1-git-send-email-artagnon@gmail.com","subject":"Re: [PATCH] git-svn: make it play nicely with submodules","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2015-01-10T22:11:21Z","receivedAt":"2015-01-10T22:11:21Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n> +++ b/git-svn.perl\n> @@ -337,6 +337,10 @@ for (my $i = 0; $i < @ARGV; $i++) {\n>  # make sure we're always running at the top-level working directory\n>  if ($cmd && $cmd =~ /(?:clone|init|multi-init)$/) {\n>  \t$ENV{GIT_DIR} ||= \".git\";\n> +\t# catch the submodule case\n> +\tif (open(my $fh, '<', $ENV{GIT_DIR})) {\n> +\t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n> +\t}\n\nHow portable is open on a directory?  Perhaps it'd be better to\ncheck if it's a file, first:\n\n\tif (-f $ENV{GIT_DIR}) {\n\t\topen(my $fh, '<', $ENV{GIT_DIR}) or\n\t\t\tdie \"failed to open $ENV{GIT_DIR}: $!\\n\";\n\t\t$ENV{GIT_DIR} = $1 if <$fh> =~ /^gitdir: (.+)$/;\n\t}\n"},{"id":"254543","messageId":"CALkWK0kNZyEedL16fru+hWqw7tDz8q3ftQn4=xGUjb2qv8E4SA@mail.gmail.com","threadId":"38331","inReplyTo":"20150110221121.GA30202@dcvr.yhbt.net","subject":"Re: [PATCH] git-svn: make it play nicely with submodules","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2015-01-10T22:13:27Z","receivedAt":"2015-01-10T22:13:27Z","isPatch":true,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Eric Wong wrote:\n> How portable is open on a directory?  Perhaps it'd be better to\n> check if it's a file, first:\n\nSure, that works; feel free to fix it up locally before committing.\n"}]}