parse-remote: remove this now-unused library

The previous two commits removed the last use of a function in this library, but most of it had been dead code for a while[1][2]. Only the "get_default_remote" function was still being used. Even though we had a manual page for this library it was never intended (or I expect, actually) used outside of git.git. Let's just remove it, if anyone still cares about a function here they can pull them into their own project[3]. 1. Last use of error_on_missing_default_upstream(): d03ebd411c ("rebase: remove the rebase.useBuiltin setting", 2019-03-18) 2. Last use of get_remote_merge_branch(): 49eb8d39c7 ("Remove contrib/examples/*", 2018-03-25) 3. https://lore.kernel.org/git/87a6vmhdka.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Nov 14, 2020 at 13:21 UTC a89a2fbfccd88bc8a3c8cce8d7bc03de3830ea25
6 files changed -129
.gitignore
-1
@@ -114,7 +114,6 @@
114 /git-pack-redundant
115 /git-pack-objects
116 /git-pack-refs
117 -/git-parse-remote
117 /git-patch-id
118 /git-prune
119 /git-prune-packed
Documentation/git-parse-remote.txt deleted
-23
@@ -1,23 +0,0 @@
1 -git-parse-remote(1)
2 -===================
3 -
4 -NAME
5 -----
6 -git-parse-remote - Routines to help parsing remote repository access parameters
7 -
8 -
9 -SYNOPSIS
10 ---------
11 -[verse]
12 -'. "$(git --exec-path)/git-parse-remote"'
13 -
14 -DESCRIPTION
15 ------------
16 -This script is included in various scripts to supply
17 -routines to parse files under $GIT_DIR/remotes/ and
18 -$GIT_DIR/branches/ and configuration variables that are related
19 -to fetching, pulling and pushing.
20 -
21 -GIT
22 ----
23 -Part of the linkgit:git[1] suite
Makefile
-2
@@ -613,7 +613,6 @@ SCRIPT_SH += git-submodule.sh
613 SCRIPT_SH += git-web--browse.sh
614
615 SCRIPT_LIB += git-mergetool--lib
616 -SCRIPT_LIB += git-parse-remote
616 SCRIPT_LIB += git-rebase--preserve-merges
617 SCRIPT_LIB += git-sh-i18n
618 SCRIPT_LIB += git-sh-setup
@@ -2577,7 +2576,6 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --language=Perl \
2576 --keyword=__ --keyword=N__ --keyword="__n:1,2"
2577 LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)
2578 LOCALIZED_SH = $(SCRIPT_SH)
2580 -LOCALIZED_SH += git-parse-remote.sh
2579 LOCALIZED_SH += git-rebase--preserve-merges.sh
2580 LOCALIZED_SH += git-sh-setup.sh
2581 LOCALIZED_PERL = $(SCRIPT_PERL)
command-list.txt
-1
@@ -135,7 +135,6 @@ git-p4 foreignscminterface
135 git-pack-objects plumbingmanipulators
136 git-pack-redundant plumbinginterrogators
137 git-pack-refs ancillarymanipulators
138 -git-parse-remote synchelpers
138 git-patch-id purehelpers
139 git-prune ancillarymanipulators complete
140 git-prune-packed plumbingmanipulators
git-parse-remote.sh deleted
-101
@@ -1,101 +0,0 @@
1 -# This is a shell library to calculate the remote repository and
2 -# upstream branch that should be pulled by "git pull" from the current
3 -# branch.
4 -
5 -# git-ls-remote could be called from outside a git managed repository;
6 -# this would fail in that case and would issue an error message.
7 -GIT_DIR=$(git rev-parse -q --git-dir) || :;
8 -
9 -get_default_remote () {
10 - curr_branch=$(git symbolic-ref -q HEAD)
11 - curr_branch="${curr_branch#refs/heads/}"
12 - origin=$(git config --get "branch.$curr_branch.remote")
13 - echo ${origin:-origin}
14 -}
15 -
16 -get_remote_merge_branch () {
17 - case "$#" in
18 - 0|1)
19 - origin="$1"
20 - default=$(get_default_remote)
21 - test -z "$origin" && origin=$default
22 - curr_branch=$(git symbolic-ref -q HEAD) &&
23 - [ "$origin" = "$default" ] &&
24 - echo $(git for-each-ref --format='%(upstream)' $curr_branch)
25 - ;;
26 - *)
27 - repo=$1
28 - shift
29 - ref=$1
30 - # FIXME: It should return the tracking branch
31 - # Currently only works with the default mapping
32 - case "$ref" in
33 - +*)
34 - ref=$(expr "z$ref" : 'z+\(.*\)')
35 - ;;
36 - esac
37 - expr "z$ref" : 'z.*:' >/dev/null || ref="${ref}:"
38 - remote=$(expr "z$ref" : 'z\([^:]*\):')
39 - case "$remote" in
40 - '' | HEAD ) remote=HEAD ;;
41 - heads/*) remote=${remote#heads/} ;;
42 - refs/heads/*) remote=${remote#refs/heads/} ;;
43 - refs/* | tags/* | remotes/* ) remote=
44 - esac
45 - [ -n "$remote" ] && case "$repo" in
46 - .)
47 - echo "refs/heads/$remote"
48 - ;;
49 - *)
50 - echo "refs/remotes/$repo/$remote"
51 - ;;
52 - esac
53 - esac
54 -}
55 -
56 -error_on_missing_default_upstream () {
57 - cmd="$1"
58 - op_type="$2"
59 - op_prep="$3" # FIXME: op_prep is no longer used
60 - example="$4"
61 - branch_name=$(git symbolic-ref -q HEAD)
62 - display_branch_name="${branch_name#refs/heads/}"
63 - # If there's only one remote, use that in the suggestion
64 - remote="$(gettext "<remote>")"
65 - branch="$(gettext "<branch>")"
66 - if test $(git remote | wc -l) = 1
67 - then
68 - remote=$(git remote)
69 - fi
70 -
71 - if test -z "$branch_name"
72 - then
73 - gettextln "You are not currently on a branch."
74 - else
75 - gettextln "There is no tracking information for the current branch."
76 - fi
77 - case "$op_type" in
78 - rebase)
79 - gettextln "Please specify which branch you want to rebase against."
80 - ;;
81 - merge)
82 - gettextln "Please specify which branch you want to merge with."
83 - ;;
84 - *)
85 - echo >&2 "BUG: unknown operation type: $op_type"
86 - exit 1
87 - ;;
88 - esac
89 - eval_gettextln "See git-\${cmd}(1) for details."
90 - echo
91 - echo " $example"
92 - echo
93 - if test -n "$branch_name"
94 - then
95 - gettextln "If you wish to set tracking information for this branch you can do so with:"
96 - echo
97 - echo " git branch --set-upstream-to=$remote/$branch $display_branch_name"
98 - echo
99 - fi
100 - exit 1
101 -}
git-submodule.sh
-1
@@ -20,7 +20,6 @@ USAGE="[--quiet] [--cached]
20 OPTIONS_SPEC=
21 SUBDIRECTORY_OK=Yes
22 . git-sh-setup
23 -. git-parse-remote
23 require_work_tree
24 wt_prefix=$(git rev-parse --show-prefix)
25 cd_to_toplevel