block alloc: add lifecycle APIs for cache_entry structs
[gitweb.git] / merge-recursive.c
index ac27abbd4cd708fdc2526c6508680b7d246773b6..a580cff886d5d0a30dbffeae167cfd999ce6dfee 100644 (file)
@@ -315,7 +315,7 @@ static int add_cacheinfo(struct merge_options *o,
        struct cache_entry *ce;
        int ret;
 
-       ce = make_cache_entry(mode, oid ? oid->hash : null_sha1, path, stage, 0);
+       ce = make_cache_entry(&the_index, mode, oid ? oid : &null_oid, path, stage, 0);
        if (!ce)
                return err(o, _("add_cacheinfo failed for path '%s'; merge aborting."), path);
 
@@ -323,7 +323,7 @@ static int add_cacheinfo(struct merge_options *o,
        if (refresh) {
                struct cache_entry *nce;
 
-               nce = refresh_cache_entry(ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
+               nce = refresh_cache_entry(&the_index, ce, CE_MATCH_REFRESH | CE_MATCH_IGNORE_MISSING);
                if (!nce)
                        return err(o, _("add_cacheinfo failed to refresh for path '%s'; merge aborting."), path);
                if (nce != ce)
@@ -1208,7 +1208,7 @@ static int merge_submodule(struct merge_options *o,
                        output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
                        output_commit_title(o, commit_b);
                } else if (show(o, 2))
-                       output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(b));
+                       output(o, 2, _("Fast-forwarding submodule %s"), path);
                else
                        ; /* no output */
 
@@ -1220,7 +1220,7 @@ static int merge_submodule(struct merge_options *o,
                        output(o, 3, _("Fast-forwarding submodule %s to the following commit:"), path);
                        output_commit_title(o, commit_a);
                } else if (show(o, 2))
-                       output(o, 2, _("Fast-forwarding submodule %s to %s"), path, oid_to_hex(a));
+                       output(o, 2, _("Fast-forwarding submodule %s"), path);
                else
                        ; /* no output */
 
@@ -2211,18 +2211,18 @@ static struct hashmap *get_directory_renames(struct diff_queue_struct *pairs,
 static struct dir_rename_entry *check_dir_renamed(const char *path,
                                                  struct hashmap *dir_renames)
 {
-       char temp[PATH_MAX];
+       char *temp = xstrdup(path);
        char *end;
-       struct dir_rename_entry *entry;
+       struct dir_rename_entry *entry = NULL;;
 
-       strcpy(temp, path);
        while ((end = strrchr(temp, '/'))) {
                *end = '\0';
                entry = dir_rename_find_entry(dir_renames, temp);
                if (entry)
-                       return entry;
+                       break;
        }
-       return NULL;
+       free(temp);
+       return entry;
 }
 
 static void compute_collisions(struct hashmap *collisions,