git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Branchaud <marcnarc@xiplink.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Duy Nguyen <pclouds@gmail.com>,
	Stefan Beller <sbeller@google.com>
Subject: Re: [PATCH] new-workdir: Never try to recurse into submodules on the initial checkout.
Date: Tue, 15 Jan 2019 10:01:59 -0500	[thread overview]
Message-ID: <d1e1ceb3-a1b8-ff5b-8ebc-79d2ee9267dc@xiplink.com> (raw)
In-Reply-To: <20190114213430.GC162110@google.com>

On 2019-01-14 4:34 p.m., Jonathan Nieder wrote:
> Hi,
> 
> Marc Branchaud wrote:
> 
>> The new workdir is empty before the checkout, so attempts to recurse into
>> a non-existent submodule directory fail.
>>
>> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
>> ---
> 
> Thanks for reporting.  Can you describe the error message when it fails
> here?

The error is:

fatal: exec '--super-prefix=external/submodule/': cd to 
'external/submodule' failed: No such file or directory

The created workdir has only the .git directory.  The .git/HEAD file 
contains the expected ref, so the workdir repo's status simply shows 
that everything has been deleted.


Note that git-worktree also fails when submodule.recurse=true, with the 
same error:

# git worktree add ~/Code/foo/test-worktree
Preparing worktree (new branch 'test-worktree')
fatal: exec '--super-prefix=external/submodule/': cd to 
'external/submodule' failed: No such file or directory
error: Submodule 'external/submodule' could not be updated.
error: Submodule 'external/submodule' cannot checkout new HEAD.
fatal: Could not reset index file to revision 'HEAD'.

I had assumed that this was simply an aspect of submodules not working, 
so I was holding off reporting it until more of the submodule support 
was complete.

>> Until the worktree command supports submodules I've gone back to using the
>> git-new-workdir script, but it fails if my config has
>> submdodule.recurse=true.
> 
> Oh, dear.  In general, the project does a better job at supporting "git
> worktree" than "git new-workdir", but I don't blame you about this.
> 
> Noting locally as another vote for getting submodules to play well with
> worktrees soon.
> 
> [...]
>>   contrib/workdir/git-new-workdir | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/contrib/workdir/git-new-workdir b/contrib/workdir/git-new-workdir
>> index 888c34a521..5de1dc3c58 100755
>> --- a/contrib/workdir/git-new-workdir
>> +++ b/contrib/workdir/git-new-workdir
>> @@ -102,4 +102,4 @@ trap - $siglist
>>
>>   # checkout the branch (either the same as HEAD from the original repository,
>>   # or the one that was asked for)
>> -git checkout -f $branch
>> +git -c submodule.recurse=false checkout -f $branch
> 
> nit: can this use "git checkout --no-recurse-submodules" instead
> of -c?
> 
> In general, we tend to recommend that kind of option instead of
> --config in scripts.

--no-recurse-submodules does work.  I'll send a v2.

		M.

> Thanks,
> Jonathan
> 

  parent reply	other threads:[~2019-01-15 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-14 17:27 [PATCH] new-workdir: Never try to recurse into submodules on the initial checkout Marc Branchaud
2019-01-14 21:34 ` Jonathan Nieder
2019-01-14 21:44   ` Junio C Hamano
2019-01-14 21:58     ` Jonathan Nieder
2019-01-15 15:02       ` Marc Branchaud
2019-01-15 18:38       ` Junio C Hamano
2019-01-15 15:01   ` Marc Branchaud [this message]
2019-01-15 15:07 ` [PATCHv2] " Marc Branchaud

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=d1e1ceb3-a1b8-ff5b-8ebc-79d2ee9267dc@xiplink.com \
    --to=marcnarc@xiplink.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=sbeller@google.com \
    /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).