Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes: > Now look from "git add" perspective, it does not really care where > $GIT_DIR is. > It assumes that $(pwd) is working directory's top. So it Now you confused me. Doesn't it use $GIT_DIR to find the index? And it decides that it is at the top level because it is given GIT_DIR but not GIT_WORKING_TREE which is how working tree discovery is defined. > - reads content of current directory, it sees "clone2" as a directory > - it descends in and see ".git" so "clone2" must be a git link > - because clone2 is a separate repository (again $GIT_DIR is not > consulted), "b" should be managed by "clone2" > - so it stops. > > This is the only place I see a submodule (from the first glance) is > actually top level repository. Yes I guess we can support this, but > it's just too weird to be widely used in pratice.. Where did you get this idea that submodule is somehow involved in this test? I do not see there is any submodules involved; the test uses two repositories 1 and 2 that appear in the working tree of the main repository test infrastructure created, but otherwise there is no sub/super relation among these three, and there are many other tests with "clone" or "mkdir+init" or "init <newdir>" in the main test repository. The clone2 repository tracks a path without having a corresponding file in its working tree (i.e. it has "b" but tracks "clone2/b") which I already is said unusual, but unusual does not mean it is bad or we want to remove a test that covers the unusual case to let a change that regresses the case go unnoticed. >> Running (cd clone2 && git add b) is a _more natural_ thing to do, and it >> will result in a path "b" added to the clone2 repository, so that the >> result is more useful if you are going to chdir to the repository and keep >> working on it. But that does not mean the existing test is incorrect. It >> does not just pass somehow but the test passes by design. >> >> I did not check if later tests look at the contents of commit "new2" to >> make sure it contains "clone2/b", but if they do this change should break >> such tests. >> >> So I am puzzled by this change; what is this trying to achieve? So again, what is this change trying to achieve? -- 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