git-am: add am.threeWay config variable
[gitweb.git] / builtin / name-rev.c
index c824d4ec5f1c076e4833c690dad378125dde6da9..248a3eb260cfa22a11d4b1b5420c42bc608f13c5 100644 (file)
@@ -33,10 +33,7 @@ static void name_rev(struct commit *commit,
                return;
 
        if (deref) {
-               char *new_name = xmalloc(strlen(tip_name)+3);
-               strcpy(new_name, tip_name);
-               strcat(new_name, "^0");
-               tip_name = new_name;
+               tip_name = xstrfmt("%s^0", tip_name);
 
                if (generation)
                        die("generation: %d, but deref?", generation);
@@ -141,9 +138,9 @@ static int tipcmp(const void *a_, const void *b_)
        return hashcmp(a->sha1, b->sha1);
 }
 
-static int name_ref(const char *path, const unsigned char *sha1, int flags, void *cb_data)
+static int name_ref(const char *path, const struct object_id *oid, int flags, void *cb_data)
 {
-       struct object *o = parse_object(sha1);
+       struct object *o = parse_object(oid->hash);
        struct name_ref_data *data = cb_data;
        int can_abbreviate_output = data->tags_only && data->name_only;
        int deref = 0;
@@ -163,7 +160,7 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void
                }
        }
 
-       add_to_tip_table(sha1, path, can_abbreviate_output);
+       add_to_tip_table(oid->hash, path, can_abbreviate_output);
 
        while (o && o->type == OBJ_TAG) {
                struct tag *t = (struct tag *) o;
@@ -255,9 +252,9 @@ static void show_name(const struct object *obj,
 }
 
 static char const * const name_rev_usage[] = {
-       N_("git name-rev [options] <commit>..."),
-       N_("git name-rev [options] --all"),
-       N_("git name-rev [options] --stdin"),
+       N_("git name-rev [<options>] <commit>..."),
+       N_("git name-rev [<options>] --all"),
+       N_("git name-rev [<options>] --stdin"),
        NULL
 };