Skip to content

Commit e89ecfb

Browse files
committed
Merge branch 'ab/retire-parse-remote'
"git-parse-remote" shell script library outlived its usefulness. * ab/retire-parse-remote: submodule: fix fetch_in_submodule logic parse-remote: remove this now-unused library submodule: remove sh function in favor of helper submodule: use "fetch" logic instead of custom remote discovery
2 parents 72ffeb9 + 66d36b9 commit e89ecfb

File tree

6 files changed

+11
-138
lines changed

6 files changed

+11
-138
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
/git-pack-redundant
116116
/git-pack-objects
117117
/git-pack-refs
118-
/git-parse-remote
119118
/git-patch-id
120119
/git-prune
121120
/git-prune-packed

Documentation/git-parse-remote.txt

Lines changed: 0 additions & 23 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ SCRIPT_SH += git-submodule.sh
613613
SCRIPT_SH += git-web--browse.sh
614614

615615
SCRIPT_LIB += git-mergetool--lib
616-
SCRIPT_LIB += git-parse-remote
617616
SCRIPT_LIB += git-rebase--preserve-merges
618617
SCRIPT_LIB += git-sh-i18n
619618
SCRIPT_LIB += git-sh-setup
@@ -2583,7 +2582,6 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
25832582
--keyword=__ --keyword=N__ --keyword="__n:1,2"
25842583
LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
25852584
LOCALIZED_SH = $(SCRIPT_SH)
2586-
LOCALIZED_SH += git-parse-remote.sh
25872585
LOCALIZED_SH += git-rebase--preserve-merges.sh
25882586
LOCALIZED_SH += git-sh-setup.sh
25892587
LOCALIZED_PERL = $(SCRIPT_PERL)

command-list.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ git-p4 foreignscminterface
136136
git-pack-objects plumbingmanipulators
137137
git-pack-redundant plumbinginterrogators
138138
git-pack-refs ancillarymanipulators
139-
git-parse-remote synchelpers
140139
git-patch-id purehelpers
141140
git-prune ancillarymanipulators complete
142141
git-prune-packed plumbingmanipulators

git-parse-remote.sh

Lines changed: 0 additions & 101 deletions
This file was deleted.

git-submodule.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ USAGE="[--quiet] [--cached]
2020
OPTIONS_SPEC=
2121
SUBDIRECTORY_OK=Yes
2222
. git-sh-setup
23-
. git-parse-remote
2423
require_work_tree
2524
wt_prefix=$(git rev-parse --show-prefix)
2625
cd_to_toplevel
@@ -413,16 +412,18 @@ is_tip_reachable () (
413412
test -z "$rev"
414413
)
415414

415+
# usage: fetch_in_submodule <module_path> [<depth>] [<sha1>]
416+
# Because arguments are positional, use an empty string to omit <depth>
417+
# but include <sha1>.
416418
fetch_in_submodule () (
417419
sanitize_submodule_env &&
418420
cd "$1" &&
419-
case "$2" in
420-
'')
421-
git fetch ;;
422-
*)
423-
shift
424-
git fetch $(get_default_remote) "$@" ;;
425-
esac
421+
if test $# -eq 3
422+
then
423+
echo "$3" | git fetch --stdin ${2:+"$2"}
424+
else
425+
git fetch ${2:+"$2"}
426+
fi
426427
)
427428

428429
#
@@ -576,7 +577,7 @@ cmd_update()
576577
fetch_in_submodule "$sm_path" $depth ||
577578
die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
578579
fi
579-
remote_name=$(sanitize_submodule_env; cd "$sm_path" && get_default_remote)
580+
remote_name=$(sanitize_submodule_env; cd "$sm_path" && git submodule--helper print-default-remote)
580581
sha1=$(sanitize_submodule_env; cd "$sm_path" &&
581582
git rev-parse --verify "${remote_name}/${branch}") ||
582583
die "$(eval_gettext "Unable to find current \${remote_name}/\${branch} revision in submodule path '\$sm_path'")"
@@ -602,7 +603,7 @@ cmd_update()
602603
# Now we tried the usual fetch, but $sha1 may
603604
# not be reachable from any of the refs
604605
is_tip_reachable "$sm_path" "$sha1" ||
605-
fetch_in_submodule "$sm_path" $depth "$sha1" ||
606+
fetch_in_submodule "$sm_path" "$depth" "$sha1" ||
606607
die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain \$sha1. Direct fetching of that commit failed.")"
607608
fi
608609

0 commit comments

Comments
 (0)