There was something wrong with my git installation. I uninstalled and reinstalled it the error went away.
Considering the current version of git-submodule.sh
fails on:
if ! git submodule--helper config --check-writeable >/dev/null 2>&1
If it possible you had a process keeping an handle on your .gitmodules
, preventing any "git submodule add
" command to modify it.
Note that this will slightly change With Git 2.33 (Q3 2021), with the rewrite of "git submodule
"(man) in C, which does impact git submodule add
:
See commit bbe3165 (23 Jul 2021) by Jeff King (peff
).
See commit 8c8195e, commit a98b02c, commit 0008d12 (10 Jul 2021), and commit 84069fc (06 Jul 2021) by Atharva Raykar (tfidfwastaken
).
(Merged by Junio C Hamano -- gitster
-- in commit 10f57e0, 04 Aug 2021)
submodule
: prefix die messages with 'fatal'
Signed-off-by: Atharva Raykar
Mentored-by: Christian Couder
Mentored-by: Shourya Shukla
The standard die()
function that is used in C code prefixes all the messages passed to it with 'fatal: '.
This does not happen with the die
used in 'git-submodule.sh'.
Let's prefix each of the shell die messages with 'fatal: ' so that when they are converted to C code, the error messages stay the same as before the conversion.
Note that the shell version of die
exits with error code 1, while the C version exits with error code 128. In practice, this does not change any behaviour, as no functionality in 'submodule add' and 'submodule update' relies on the value of the exit code.
And:
Signed-off-by: Atharva Raykar
Mentored-by: Christian Couder
Mentored-by: Shourya Shukla
Based-on-patch-by: Shourya Shukla
Based-on-patch-by: Prathamesh Chavan
Helped-by: Đoàn Trần Công Danh
Let's add a new "add-clone
" subcommand to git submodule--helper
with the goal of converting part of the shell code in git-submodule.sh
related to git submodule add
(man) into C code.
This new subcommand clones the repository that is to be added, and checks out to the appropriate branch.
This is meant to be a faithful conversion that leaves the behavior of 'cmd_add()
' script unchanged.