merge_trees(): ensure that the callers release output buffer
[gitweb.git] / builtin / reset.c
index 092c3a5399c731e83058233f8e3e459be493e140..9020ec66c81de0185244d478e588d4a05c2a4f1d 100644 (file)
@@ -103,7 +103,7 @@ static void print_new_head_line(struct commit *commit)
        if (body) {
                const char *eol;
                size_t len;
-               body += 2;
+               body = skip_blank_lines(body + 2);
                eol = strchr(body, '\n');
                len = eol ? eol - body : strlen(body);
                printf(" %.*s\n", (int) len, body);
@@ -121,7 +121,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
 
        for (i = 0; i < q->nr; i++) {
                struct diff_filespec *one = q->queue[i]->one;
-               int is_missing = !(one->mode && !is_null_sha1(one->sha1));
+               int is_missing = !(one->mode && !is_null_oid(&one->oid));
                struct cache_entry *ce;
 
                if (is_missing && !intent_to_add) {
@@ -129,7 +129,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
                        continue;
                }
 
-               ce = make_cache_entry(one->mode, one->sha1, one->path,
+               ce = make_cache_entry(one->mode, one->oid.hash, one->path,
                                      0, 0);
                if (!ce)
                        die(_("make_cache_entry failed for path '%s'"),
@@ -158,7 +158,7 @@ static int read_from_tree(const struct pathspec *pathspec,
                return 1;
        diffcore_std(&opt);
        diff_flush(&opt);
-       free_pathspec(&opt.pathspec);
+       clear_pathspec(&opt.pathspec);
 
        return 0;
 }