git-name-rev: allow --name-only in combination with --stdin
Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
e8b55fab62
commit
b003c00b7b
|
@ -38,8 +38,7 @@ OPTIONS
|
||||||
Instead of printing both the SHA-1 and the name, print only
|
Instead of printing both the SHA-1 and the name, print only
|
||||||
the name. If given with --tags the usual tag prefix of
|
the name. If given with --tags the usual tag prefix of
|
||||||
"tags/" is also omitted from the name, matching the output
|
"tags/" is also omitted from the name, matching the output
|
||||||
of linkgit:git-describe[1] more closely. This option
|
of linkgit:git-describe[1] more closely.
|
||||||
cannot be combined with --stdin.
|
|
||||||
|
|
||||||
--no-undefined::
|
--no-undefined::
|
||||||
Die with error code != 0 when a reference is undefined,
|
Die with error code != 0 when a reference is undefined,
|
||||||
|
|
|
@ -204,8 +204,13 @@ static void name_rev_line(char *p, struct name_ref_data *data)
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fwrite(p_start, p - p_start + 1, 1, stdout);
|
if (data->name_only) {
|
||||||
printf(" (%s)", name);
|
fwrite(p_start, p - p_start + 1 - 40, 1, stdout);
|
||||||
|
printf(name);
|
||||||
|
} else {
|
||||||
|
fwrite(p_start, p - p_start + 1, 1, stdout);
|
||||||
|
printf(" (%s)", name);
|
||||||
|
}
|
||||||
p_start = p + 1;
|
p_start = p + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue