Add documentation for show-branch --topics
[gitweb.git] / git-parse-remote.sh
index da064a53f666db52ce2341132a117355ad74d2a1..bc881cc5f9d932c40f10bf0448aafa3263724c35 100755 (executable)
@@ -111,16 +111,14 @@ expand_refs_wildcard () {
                local_force=
                test "z$lref" = "z$ref" || local_force='+'
                echo "$ls_remote_result" |
+               sed -e '/\^{}$/d' |
                (
                        IFS='   '
                        while read sha1 name
                        do
+                               # ignore the ones that do not start with $from
                                mapped=${name#"$from"}
-                               if test "z$name" != "z${name%'^{}'}" ||
-                                       test "z$name" = "z$mapped"
-                               then
-                                       continue
-                               fi
+                               test "z$name" = "z$mapped" && continue
                                echo "${local_force}${name}:${to}${mapped}"
                        done
                )
@@ -134,6 +132,8 @@ canon_refs_list_for_fetch () {
        # or the first one otherwise; add prefix . to the rest
        # to prevent the secondary branches to be merged by default.
        merge_branches=
+       found_mergeref=
+       curr_branch=
        if test "$1" = "-d"
        then
                shift ; remote="$1" ; shift
@@ -171,6 +171,10 @@ canon_refs_list_for_fetch () {
                            dot_prefix= && break
                        done
                fi
+               if test -z $dot_prefix
+               then
+                       found_mergeref=true
+               fi
                case "$remote" in
                '') remote=HEAD ;;
                refs/heads/* | refs/tags/* | refs/remotes/*) ;;
@@ -191,6 +195,11 @@ canon_refs_list_for_fetch () {
                fi
                echo "${dot_prefix}${force}${remote}:${local}"
        done
+       if test -z "$found_mergeref" -a "$curr_branch"
+       then
+               echo >&2 "Warning: No merge candidate found because value of config option
+         \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
+       fi
 }
 
 # Returns list of src: (no store), or src:dst (store)