git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Heiko Voigt <hvoigt@hvoigt.net>,
	Brandon Williams <bmwill@google.com>,
	Git Mailing List <git@vger.kernel.org>,
	Stefan Beller <sbeller@google.com>
Subject: Re: Adding nested repository with slash adds files instead of gitlink
Date: Tue, 19 Jun 2018 08:56:56 -0700	[thread overview]
Message-ID: <xmqqmuvqwz07.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CACsJy8DQ-GGEDiV0iA2kTgNgHcT1sSX2Oqb7VZcjyK1nBOFv+A@mail.gmail.com> (Duy Nguyen's message of "Tue, 19 Jun 2018 17:16:17 +0200")

Duy Nguyen <pclouds@gmail.com> writes:

> On Tue, Jun 19, 2018 at 12:36 PM Heiko Voigt <hvoigt@hvoigt.net> wrote:
>>
>> On Mon, Jun 18, 2018 at 11:12:15AM -0700, Brandon Williams wrote:
>> > On 06/18, Duy Nguyen wrote:
>> > > This sounds like the submodule specific code in pathspec.c, which has
>> > > been replaced with something else in bw/pathspec-sans-the-index. If
>> > > you have time, try a version without those changes (e.g. v2.13 or
>> > > before) to see if it's a possible culprit.
>> >
>> > I just tested this with v2.13 and saw the same issue.  I don't actually
>> > think this ever worked in the way you want it to Heiko.  Maybe git add
>> > needs to be taught to be more intelligent when trying to add a submodule
>> > which doesn't exist in the index.
>>
>> That was also my guess, since my feeling is that this is a quite rare
>> use case. Adding submodules alone is not a daily thing, let alone
>> selecting different changes after 'git submodule add'.
>>
>> I also think git could be more intelligent here.
>
> Ah.. the "submodule not registered in index" case. I think I remember
> this (because I remember complaining about it once or two times).
> Definitely agreed that git-add should do the right thing here.

I am not sure if this even needs to be implemented as "look for the
submodule in the index".  Even before submodule was added, we knew
that "git add foo/bar" should reject the request if we find foo is a
symbolic link, and we should do the same when foo/ is a directory
that is the top of a working tree under control of another
repository, no?

Hmm, what happens when we do this?

	git init
	ln -s /tmp foo
	>foo/bar
	git add foo/

I think we should say either "let's add foo symlink" or
"foo/. (directory) is beyond symlink" (the latter is preferrable,
but the former is acceptable as long as foo is pointing at a
directory; but foo could be a dangling symlink whose pointee's type
may not be discernable by "git add").

Shouldn't we be reacting pretty much the same when we see this?

	git init
	git init foo
	>foo/bar
	git add foo/

That is, either drop '/' and add 'foo' as a submodule, or say
"foo/. (directory) belongs to another repository, cannot add here"
(again, the latter is preferrable for consistency with the symlink
behaviour above).


  reply	other threads:[~2018-06-19 15:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 11:19 Adding nested repository with slash adds files instead of gitlink Heiko Voigt
2018-06-18 15:06 ` Duy Nguyen
2018-06-18 18:12   ` Brandon Williams
2018-06-19 10:36     ` Heiko Voigt
2018-06-19 15:16       ` Duy Nguyen
2018-06-19 15:56         ` Junio C Hamano [this message]
2018-06-19 16:11           ` Duy Nguyen
2018-06-19 16:09         ` Duy Nguyen
2018-06-19 16:20           ` Duy Nguyen
2018-06-18 15:55 ` Kevin Daudt
2018-06-19 10:27   ` Heiko Voigt
2018-06-19 22:29     ` Rafael Ascensão
2018-06-20  4:39       ` Kevin Daudt
2018-06-20 11:52         ` Rafael Ascensão
2018-06-20 14:57           ` Duy Nguyen
2018-06-20 16:21             ` Rafael Ascensão
2024-08-08 11:20             ` Phil Sainty
2024-08-08 16:35               ` Junio C Hamano
2024-08-13 12:48                 ` Johannes Schindelin
2024-08-13 17:18                   ` Junio C Hamano
2024-08-13 23:13                     ` Phil Sainty
2024-08-14 12:00                       ` Johannes Schindelin

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=xmqqmuvqwz07.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=hvoigt@hvoigt.net \
    --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).