Skip to content

Error in scanSubmodules of Git SCM #375

@Kalabaza

Description

@Kalabaza

It seems I found a corner case for the submodules changes made to bob in the version 1.7.

In the scanSubmodules method, the existence of the file ".gitsubmodules" is checked but, was it considered that this file could be empty? (I don't even know if that file being empty is a valid use case?)

So, if the file ".gitmodules" is empty, the command to get the submodules will fail and the checkout is simply not completed (maybe the same will also happen in updateSubmodulesPost and statusSubmodule):

Build error: Git audit failed: Command '['git', '-C', '.', 'config', '-f', '.gitmodules', '-z', '--get-regexp', 'path']' returned non-zero exit status 1

Here is a sample of the output from the commands directly in the git repository:

$ ls -la | grep .gitmodules
-rw-r--r-- 1 user user    0 Nov 10 10:33 .gitmodules

$ git -C . config -f .gitmodules -z --get-regexp path

$ echo $?
1

$ git submodule add <fancy-module.git>
Cloning into ...

$ ls -la | grep .gitmodules
-rw-r--r--  1 user user  106 Nov 10 10:34 .gitmodules

$ git -C . config -f .gitmodules -z --get-regexp path
submodule.fancy-module.path
fancy-module^@

$ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions