Re: Strangeness with git-add and nested repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]