Thanks for the reply. However, in this case....

      git clone $URL ./dir2
      git add dir2

how will "dir2" get ever get registered as a submodule? I don't see
how one can reach the "is_submodule_modified" routine for the scenario

My understanding is that a sub-directory can be registered as a
submodule only with the "git submodule add ...." command. In this case
only a gitlink file is created within the sub-directory and not a .git
subdirectory. Please correct me if I am wrong.

Thanks again,

On Mon, Aug 29, 2016 at 1:03 PM, Junio C Hamano <> wrote:
> Uma Srinivasan <> writes:
>> git_dir = read_gitfile(buf.buf);
>> if (!git_dir)
>>                 git_dir = buf.buf;
>> Can anyone explain to me why we are replacing a failed reading of a
>> git file with the original sub directory name?
> A top-level superproject can have a submodule bound at its "dir/"
> directory, and "dir/.git" can either be a gitfile which you can read
> with read_gitfile() and point into somewhere in ".git/modules/" of
> the top-level superproject.  "dir/.git" can _ALSO_ be a fully valid
> Git directory.  So at the top of a superproject, you could do
>         git clone $URL ./dir2
>         git add dir2
> to clone an independent project into dir2 directory, and add it as a
> new submodule.  The fallback is to support such a layout.

Reply via email to