From: Jens Lehmann <Jens.Lehmann@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Duy Nguyen <pclouds@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Subject: Re: [PATCH] pathspec: adjust prefixlen after striping trailing slash
Date: Thu, 23 Apr 2015 00:32:43 +0200 [thread overview]
Message-ID: <5538218B.4010400@web.de> (raw)
In-Reply-To: <xmqq1tjcdjfa.fsf@gitster.dls.corp.google.com>
Am 22.04.2015 um 21:58 schrieb Junio C Hamano:
> Jens Lehmann <Jens.Lehmann@web.de> writes:
>
>> Am 21.04.2015 um 23:08 schrieb Junio C Hamano:
>>
>>> I looked at the test script update. The new test does (I am
>>> rephrasing to make it clearer):
>>>
>>> mkdir -p dir/ectory
>>> git init dir/ectory ;# a new directory inside top-level project
>>> (
>>> cd dir/ectory &&
>>> >test && git add test && git commit -m test
>>> )
>>> git add dir/ectory
>>>
>>> to set it up. At this point, the top-level index knows dir/ectory
>>> is a submodule.
>>>
>>> Then the test goes on to turn it a non submodule by
>>>
>>> mv dir/ectory/.git dir/ectory/dotgit
>>> ...
>>
>> We already do (2) in the cases you describe:
>>
>> $ git add subrepo/a
>> fatal: Pathspec 'subrepo/a' is in submodule 'subrepo'
>> $ git -C subrepo add a
>> fatal: Pathspec 'a' is in submodule 'subrepo'
>> ...
>> So I'd vote to have (2) also for "git -C subrepo add .", which
>> is what started this thread.
>
> Does having "mv subrepo/.git subrepo/dotgit" before that "git add"
> change your conclusion?
>
> It is very clear to me that without that "mv" step, (2) is
> absolutely the right thing to do, and I agree with you.
Huh? Without that mv all files would simply be added to the
submodule repo and this would be a non-issue ... what am I
missing? I'm just advocating to let "git add ." in a submodule
without a .git behave like "git add <file>" already does.
> But it is unclear if we should still do (2) when "subrepo/.git" is
> no longer there. That has to be done manually and it may be an
> indication that is clear enough that the end user wants the
> directory to be a normal directory without any submodule involved,
> in which case it may match the expectation of the user better to
> just nuke the corresponding 160000 entry in the index and replace it
> with files in there. I dunno.
The user having removed subrepo/.git is just one reason for that.
Another is a user adding a file in an unpopulated work tree of a
not initialized submodule. I doubt that simply nuking the 160000
entry would be the right thing to do in this case, I expect this
to be a pilot error we should barf about ;-)
next prev parent reply other threads:[~2015-04-22 22:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 16:55 assert failed in submodule edge case Dennis Kaarsemaker
2015-04-13 16:57 ` Dennis Kaarsemaker
2015-04-16 19:27 ` Jens Lehmann
2015-04-18 1:19 ` [PATCH] pathspec: adjust prefixlen after striping trailing slash Nguyễn Thái Ngọc Duy
2015-04-19 12:53 ` Jens Lehmann
2015-04-20 1:34 ` Duy Nguyen
2015-04-20 5:37 ` Junio C Hamano
2015-04-20 5:52 ` Duy Nguyen
2015-04-21 21:08 ` Junio C Hamano
2015-04-22 19:14 ` Jens Lehmann
2015-04-22 19:58 ` Junio C Hamano
2015-04-22 22:32 ` Jens Lehmann [this message]
2015-04-23 3:47 ` Junio C Hamano
2015-06-14 13:16 ` Duy Nguyen
2015-06-14 21:34 ` Junio C Hamano
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=5538218B.4010400@web.de \
--to=jens.lehmann@web.de \
--cc=dennis@kaarsemaker.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.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).