Strangeness with git-add and nested repositories
- From
- Andrew J <andj2223@gmail.com>
- Date
- Apr 27, 2016, 08:31 UTC
- Message-ID
- <CAH6n4TdG9LQOPaaw_H6vuCgia0-4JXhPsSiAJPa5GtjfduQoSw@mail.gmail.com>
I've noticed some strangeness with git-add and nested repos.
This tar.gz has a reproduction script, parent repo, and nested repo that exhibits the issue: https://drive.google.com/uc?export=download&id=0Bwjufq6oAZMfcGVxZ2dlMElEVlE
If you extract the archive and do the following (on linux please, I haven't even tried this on Windows): cd git-add-bug ./bad-git-add.sh (Examine the script before running, please)
It will echo what I'm encountering to the screen, so it should be straightforward to follow, but I will summarize here: If I run a git-add command where one or more of the files live in nested repositories, like so (command is shortened here, includes more files in the script): git add -v -f -- src/chromium/src/third_party/libFuzzer/src/FuzzerInterface.h testfile As confirmed by git-status, this results in testfile being added, but FuzzerInterface.h not being added. FuzzerInterface.h is inside of a nested repository (src/chromium/src/third_party/libFuzzer/src/), while testfile is in the current main repository.
On the other hand, the following command: git add -v -f -- src/chromium/src/third_party/libFuzzer/src/FuzzerInterface.h Results in FuzzerInterface.h being added, as confirmed by git-status. Excluding testfile from the git-add command seems to do the trick.
My expectation: Both testfile and FuzzerInterface.h should be added if they are specified in the git-add command, regardless of whether they are specified along with another file that doesn't happen to live in a nested repository ("testfile" in this example).
If someone could help me understand what's going on here, I'd appreciate it.
Thanks,
Andrew