pack-objects: new option --honor-pack-keep
[gitweb.git] / builtin-name-rev.c
index b75c73b2248dea52e70b438d882435ac92c333eb..08c8aabf9428447abad7def693d7b22c5330e180 100644 (file)
@@ -172,7 +172,7 @@ static void show_name(const struct object *obj,
 }
 
 static char const * const name_rev_usage[] = {
-       "git-name-rev [options] ( --all | --stdin | <commit>... )",
+       "git name-rev [options] ( --all | --stdin | <commit>... )",
        NULL
 };
 
@@ -189,6 +189,7 @@ static void name_rev_line(char *p, struct name_ref_data *data)
                        unsigned char sha1[40];
                        const char *name = NULL;
                        char c = *(p+1);
+                       int p_len = p - p_start + 1;
 
                        forty = 0;
 
@@ -204,8 +205,10 @@ static void name_rev_line(char *p, struct name_ref_data *data)
                        if (!name)
                                continue;
 
-                       fwrite(p_start, p - p_start + 1, 1, stdout);
-                       printf(" (%s)", name);
+                       if (data->name_only)
+                               printf("%.*s%s", p_len - 40, p_start, name);
+                       else
+                               printf("%.*s (%s)", p_len, p_start, name);
                        p_start = p + 1;
                }
        }