]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-merge-recursive.c
Merge branch 'sb/describe-long'
[git.git] / builtin-merge-recursive.c
index 45d46015334c03a0273d6e69f0faeddc8ff83827..6fe4102c0cfb29031f7fdce68ca4d1937e2fefd7 100644 (file)
@@ -223,22 +223,11 @@ static int git_merge_trees(int index_only,
        return rc;
 }
 
-static int unmerged_index(void)
-{
-       int i;
-       for (i = 0; i < active_nr; i++) {
-               struct cache_entry *ce = active_cache[i];
-               if (ce_stage(ce))
-                       return 1;
-       }
-       return 0;
-}
-
 struct tree *write_tree_from_memory(void)
 {
        struct tree *result = NULL;
 
-       if (unmerged_index()) {
+       if (unmerged_cache()) {
                int i;
                output(0, "There are unmerged index entries:");
                for (i = 0; i < active_nr; i++) {
@@ -846,8 +835,9 @@ static int read_merge_config(const char *var, const char *value)
        int namelen;
 
        if (!strcmp(var, "merge.default")) {
-               if (value)
-                       default_ll_merge = strdup(value);
+               if (!value)
+                       return config_error_nonbool(var);
+               default_ll_merge = strdup(value);
                return 0;
        }
 
@@ -880,14 +870,14 @@ static int read_merge_config(const char *var, const char *value)
 
        if (!strcmp("name", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                fn->description = strdup(value);
                return 0;
        }
 
        if (!strcmp("driver", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                /*
                 * merge.<name>.driver specifies the command line:
                 *
@@ -910,7 +900,7 @@ static int read_merge_config(const char *var, const char *value)
 
        if (!strcmp("recursive", ep)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                fn->recursive = strdup(value);
                return 0;
        }
@@ -1524,7 +1514,7 @@ int merge_trees(struct tree *head,
                    sha1_to_hex(head->object.sha1),
                    sha1_to_hex(merge->object.sha1));
 
-       if (unmerged_index()) {
+       if (unmerged_cache()) {
                struct path_list *entries, *re_head, *re_merge;
                int i;
                path_list_clear(&current_file_set, 1);
@@ -1674,6 +1664,8 @@ static struct commit *get_ref(const char *ref)
        if (get_sha1(ref, sha1))
                die("Could not resolve ref '%s'", ref);
        object = deref_tag(parse_object(sha1), ref, strlen(ref));
+       if (!object)
+               return NULL;
        if (object->type == OBJ_TREE)
                return make_virtual_commit((struct tree*)object,
                        better_branch_name(ref));