summaryrefslogtreecommitdiff
path: root/csum-file.h
diff options
context:
space:
mode:
authorJacob Keller <jacob.keller@gmail.com>2016-08-31 16:27:22 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-31 18:07:10 -0700
commit99b43a61f2daf5fe183056e5bf2a75a8a81a28bf (patch)
tree1d1b35c5f3f04c9b60c37e26ca165769ba1d922e /csum-file.h
parent61cfbc054d8341c3276efbf1380a2be0ee435dba (diff)
downloadgit-99b43a61f2daf5fe183056e5bf2a75a8a81a28bf.tar.gz
allow do_submodule_path to work even if submodule isn't checked out
Currently, do_submodule_path will attempt locating the .git directory by using read_gitfile on <path>/.git. If this fails it just assumes the <path>/.git is actually a git directory. This is good because it allows for handling submodules which were cloned in a regular manner first before being added to the superproject. Unfortunately this fails if the <path> is not actually checked out any longer, such as by removing the directory. Fix this by checking if the directory we found is actually a gitdir. In the case it is not, attempt to lookup the submodule configuration and find the name of where it is stored in the .git/modules/ directory of the superproject. If we can't locate the submodule configuration, this might occur because for example a submodule gitlink was added but the corresponding .gitmodules file was not properly updated. A die() here would not be pleasant to the users of submodule diff formats, so instead, modify do_submodule_path() to return an error code: - git_pathdup_submodule() returns NULL when we fail to find a path. - strbuf_git_path_submodule() propagates the error code to the caller. Modify the callers of these functions to check the error code and fail properly. This ensures we don't attempt to use a bad path that doesn't match the corresponding submodule. Because this change fixes add_submodule_odb() to work even if the submodule is not checked out, update the wording of the submodule log diff format to correctly display that the submodule is "not initialized" instead of "not checked out" Add tests to ensure this change works as expected. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'csum-file.h')
0 files changed, 0 insertions, 0 deletions