Code

don't dereference NULL upon fdopen failure
[git.git] / builtin-merge.c
index f7db14846ecbca6b0f928237951d9505b68e5d6a..b6b84286b26a4317dfd5185ae83fd861c6f9fa7d 100644 (file)
@@ -375,6 +375,11 @@ static void merge_name(const char *remote, struct strbuf *msg)
                                    sha1_to_hex(branch_head), remote);
                        goto cleanup;
                }
+               if (!prefixcmp(found_ref, "refs/remotes/")) {
+                       strbuf_addf(msg, "%s\t\tremote branch '%s' of .\n",
+                                   sha1_to_hex(branch_head), remote);
+                       goto cleanup;
+               }
        }
 
        /* See if remote matches <name>^^^.. or <name>~<number> */
@@ -593,7 +598,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                discard_cache();
                if (read_cache() < 0)
                        die("failed to read the cache");
-               return -ret;
+               return ret;
        }
 }