[PATCH v2 1/2] parse-remote: move used code to git-submodule.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>

Move the get_default_remote () helper from git-parse-remote.sh to
git-submodule.sh, as the latter is the only user.

There are two more helper functions, get_remote_merge_branch() and
error_on_missing_default_upstream(), in the git-parse-remote shell
function library, but they are not referenced by git-submodule.sh;
stop dot-sourcing the git-parse-remote.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 git-parse-remote.sh | 7 -------
 git-submodule.sh    | 8 +++++++-
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index d3c39980f3..0c2a5ef6c4 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -6,13 +6,6 @@
 # this would fail in that case and would issue an error message.
 GIT_DIR=$(git rev-parse -q --git-dir) || :;
 
-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}
-}
-
 get_remote_merge_branch () {
 	case "$#" in
 	0|1)
diff --git a/git-submodule.sh b/git-submodule.sh
index 7ce52872b7..e7962e1a45 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -20,7 +20,6 @@ USAGE="[--quiet] [--cached]
 OPTIONS_SPEC=
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
-. git-parse-remote
 require_work_tree
 wt_prefix=$(git rev-parse --show-prefix)
 cd_to_toplevel
@@ -413,6 +412,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" &&
-- 
2.29.2-442-ga30192deef





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux