"J. Bruce Fields" [off-list ref] writes:
quoted
I wonder what should happen when you do not have anything
defined for "linus-nfs" shorthand.
Oops; I didn't notice that!
quoted
Should it fetch HEAD?
In my case I'd want it to either default to what I actually wanted
(+refs/heads/*:refs/remotes/linux-nfs/*), or just fail with something
helpful:
"Nothing to fetch"?
"No refspec given, and no default fetch configured for linux-nfs"?
"What do you want me to fetch?"?
I don't know.
Saying "let's grab everything" is certainly tempting, but I
think it is a bit too much. How about doing this instead, then?
-- >8 --
[PATCH] parse-remote: do not barf on a remote shorthand without any refs to fetch.
Signed-off-by: Junio C Hamano <redacted>
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 1122c83..7e87f2e 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -81,7 +81,14 @@ get_remote_default_refs_for_push () {
# is to help prevent randomly "globbed" ref from being chosen as
# a merge candidate
expand_refs_wildcard () {
+ remote="$1"
+ shift
first_one=yes
+ if test "$#" = 0
+ then
+ echo empty
+ echo >&2 "Nothing specified for fetching with remote.$remote.fetch"
+ fi
for ref
do
lref=${ref#'+'}@@ -132,7 +139,7 @@ canon_refs_list_for_fetch () {
if test "$1" = "-d"
then
shift ; remote="$1" ; shift
- set $(expand_refs_wildcard "$@")
+ set $(expand_refs_wildcard "$remote" "$@")
is_explicit="$1"
shift
if test "$remote" = "$(get_default_remote)"