diff mbox series

[4/5] parse-remote: move used code to git-submodule.sh

Message ID 20201111151754.31527-5-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/5] parse-remote: remove unused GIT_DIR variable | expand

Commit Message

Ævar Arnfjörð Bjarmason Nov. 11, 2020, 3:17 p.m. UTC
Move the only code in git-parse-remote.sh that was actually used to
git-submodule.sh.

This leaves just a comment in git-parse-remote.sh for ease of review,
a later commit will remove it and its build system configuration.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-parse-remote.sh | 7 -------
 git-submodule.sh    | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 864519eecf..b8d6a215e6 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -1,10 +1,3 @@ 
 # This is a shell library to calculate the remote repository and
 # upstream branch that should be pulled by "git pull" from the current
 # branch.
-
-get_default_remote () {
-	curr_branch=$(git symbolic-ref -q HEAD)
-	curr_branch="${curr_branch#refs/heads/}"
-	origin=$(git config --get "branch.$curr_branch.remote")
-	echo ${origin:-origin}
-}
diff --git a/git-submodule.sh b/git-submodule.sh
index 7ce52872b7..a6219c34e2 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -413,6 +413,13 @@  is_tip_reachable () (
 	test -z "$rev"
 )
 
+get_default_remote () {
+	curr_branch=$(git symbolic-ref -q HEAD)
+	curr_branch="${curr_branch#refs/heads/}"
+	origin=$(git config --get "branch.$curr_branch.remote")
+	echo ${origin:-origin}
+}
+
 fetch_in_submodule () (
 	sanitize_submodule_env &&
 	cd "$1" &&