Enable reflogs by default in any repository with a working directory.
[gitweb.git] / git-parse-remote.sh
index 19bc3857d17b74324edbad58156a3e3c85fe0497..6ae534bf89a7a1fd0bfeee4248c37b4ea71290b9 100755 (executable)
@@ -116,7 +116,7 @@ expand_refs_wildcard () {
                        while read sha1 name
                        do
                                mapped=${name#"$from"}
-                               if test "z$name" != "z${name#'^{}'}" ||
+                               if test "z$name" != "z${name%'^{}'}" ||
                                        test "z$name" = "z$mapped"
                                then
                                        continue
@@ -134,6 +134,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 +173,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 +197,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)