From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: Andrew J <andj2223@gmail.com>,
"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Strangeness with git-add and nested repositories
Date: Thu, 28 Apr 2016 09:48:18 -0700 [thread overview]
Message-ID: <xmqqtwil65nx.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <xmqq1t5p7kmp.fsf@gitster.mtv.corp.google.com> (Junio C. Hamano's message of "Thu, 28 Apr 2016 09:39:42 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> * "git add -- path/to/subdir/file", when any of path/, path/to/,
> path/to/subdir/ is a Git repository that is different from the
> current Git repository, must fail.
If any of the leading directories in that long path is actually a
git repository that is different from the current one, it shouldn't
have added it. IOW, adding the path is a bug.
"git add A/B/C" usually enforces this rule by
- check A; if A is a separate repository (A/.git exists, etc.),
do not add this path;
- check A/B; if A/B is a separate repository, ignore;
- check A/B/C; if A/B/C is a separate repository, ignore.
otherwise add it.
When given multiple paths, e.g. "git add A/B/C A/D", it tries to
"optimize" things by first finding common leading directory (in this
case "A/") and doing something slightly different, and I think the
bug Andrew saw lies in that codepath. It is likely that the code is
forgetting to make sure that there is no top of enclosed working
tree in the common leading directory part of the path.
next prev parent reply other threads:[~2016-04-28 16:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 8:31 Strangeness with git-add and nested repositories Andrew J
2016-04-27 16:08 ` Stefan Beller
2016-04-28 6:10 ` Andrew J
2016-04-28 16:35 ` Stefan Beller
2016-04-28 16:39 ` Junio C Hamano
2016-04-28 16:48 ` Junio C Hamano [this message]
2016-04-29 2:11 ` Andrew J
2016-04-28 16:54 ` Stefan Beller
2016-04-29 2:51 ` Junio C Hamano
2016-04-29 2:54 ` 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=xmqqtwil65nx.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=andj2223@gmail.com \
--cc=git@vger.kernel.org \
--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).