summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorLibravatar Atharva Raykar <raykar.ath@gmail.com>2022-03-04 16:13:53 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-04 16:39:11 -0800
commita77c3fcb5ec535507e1e71da4f642151f65b4b17 (patch)
tree22189ac524605bd52cdbcc3f1d266ce1ae121613 /git-submodule.sh
parentsubmodule--helper run-update-procedure: remove --suboid (diff)
downloadtgif-a77c3fcb5ec535507e1e71da4f642151f65b4b17.tar.xz
submodule--helper: get remote names from any repository
`get_default_remote()` retrieves the name of a remote by resolving the refs from of the current repository's ref store. Thus in order to use it for retrieving the remote name of a submodule, we have to start a new subprocess which runs from the submodule directory. Let's instead introduce a function called `repo_get_default_remote()` which takes any repository object and retrieves the remote accordingly. `get_default_remote()` is then defined as a call to `repo_get_default_remote()` with 'the_repository' passed to it. Now that we have `repo_get_default_remote()`, we no longer have to start a subprocess that called `submodule--helper get-default-remote` from within the submodule directory. So let's make a function called `get_default_remote_submodule()` which takes a submodule path, and returns the default remote for that submodule, all within the same process. We can now use this function to save an unnecessary subprocess spawn in `sync_submodule()`, and also in a subsequent patch, which will require this functionality. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Shourya Shukla <periperidip@gmail.com> Helped-by: Glen Choo <chooglen@google.com> Signed-off-by: Atharva Raykar <raykar.ath@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
0 files changed, 0 insertions, 0 deletions