On Thu, Apr 28, 2016 at 9:48 AM, Junio C Hamano <[email protected]> wrote:
> Junio C Hamano <[email protected]> writes:
> 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.
Actually, the very simplest case succeeds in adding a file from a nested repo:
==
$ mkdir parent
$ cd parent
$ git init
Initialized empty Git repository in /home/ajohnson/parent/.git/
$ mkdir subrepo
$ cd subrepo
$ git init
Initialized empty Git repository in /home/ajohnson/parent/subrepo/.git/
$ touch subfile
$ git add subfile
$ git commit -m test
[master (root-commit) 7480a2f] test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 subfile
$ cd ..
$ git add subrepo/subfile
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: subrepo/subfile
==
It is this more complex case that fails to add the file from the nested repo:
==
$ mkdir parent
$ cd parent
$ git init
Initialized empty Git repository in /home/ajohnson/parent/.git/
$ mkdir subrepo
$ cd subrepo
$ git init
Initialized empty Git repository in /home/ajohnson/parent/subrepo/.git/
$ touch subfile
$ git add subfile
$ git commit -m test
[master (root-commit) 36adec4] test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 subfile
$ cd ..
$ touch parentfile
$ git add parentfile subrepo/subfile
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: parentfile
Untracked files:
(use "git add <file>..." to include in what will be committed)
subrepo/
==
Given that the very simplest case of adding a single nested file
succeeds, I had assumed that the intended world order was to be able
to add files from nested repos, and that the more edgy case of adding
a mixture of files from the parent and nested repos failing was the
bug.
For my part, I'd *much* prefer to be able to add files from nested
repos, so all this "adding any files from nested repos is a bug" talk
is bumming me out!
Thanks,
Andrew
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html