X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-blame.c;h=bfd562d7d2b897ad4ab3d35dda33701e315b7d5d;hb=6c41b80153a2e4ee347d0e968ee8d0d9abfc8862;hp=c7e68874e7f02ac150343ab6d7a0aa95601f2ba3;hpb=e3560df69d5ff8047bb82524ef23f7c08c729b64;p=git.git diff --git a/builtin-blame.c b/builtin-blame.c index c7e68874e..bfd562d7d 100644 --- a/builtin-blame.c +++ b/builtin-blame.c @@ -123,8 +123,7 @@ static inline struct origin *origin_incref(struct origin *o) static void origin_decref(struct origin *o) { if (o && --o->refcnt <= 0) { - if (o->file.ptr) - free(o->file.ptr); + free(o->file.ptr); free(o); } } @@ -1894,9 +1893,7 @@ static unsigned parse_score(const char *arg) static const char *add_prefix(const char *prefix, const char *path) { - if (!prefix || !prefix[0]) - return path; - return prefix_path(prefix, strlen(prefix), path); + return prefix_path(prefix, prefix ? strlen(prefix) : 0, path); } /* @@ -2073,7 +2070,7 @@ static struct commit *fake_working_tree_commit(const char *path, const char *con if (strbuf_read(&buf, 0, 0) < 0) die("read error %s from stdin", strerror(errno)); } - convert_to_git(path, buf.buf, buf.len, &buf); + convert_to_git(path, buf.buf, buf.len, &buf, 0); origin->file.ptr = buf.buf; origin->file.size = buf.len; pretend_sha1_file(buf.buf, buf.len, OBJ_BLOB, origin->blob_sha1); @@ -2369,7 +2366,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) * bottom commits we would reach while traversing as * uninteresting. */ - prepare_revision_walk(&revs); + if (prepare_revision_walk(&revs)) + die("revision walk setup failed"); if (is_null_sha1(sb.final->object.sha1)) { char *buf;