Merge branch 'ow/ref-filter-omit-empty'
"git branch --format=..." and "git format-patch --format=..." learns "--omit-empty" to hide refs that whose formatting result becomes an empty string from the output. * ow/ref-filter-omit-empty: branch, for-each-ref, tag: add option to omit empty lines
This commit is contained in:
@ -41,6 +41,7 @@ static const char * const git_tag_usage[] = {
|
||||
static unsigned int colopts;
|
||||
static int force_sign_annotate;
|
||||
static int config_sign_tag = -1; /* unspecified */
|
||||
static int omit_empty = 0;
|
||||
|
||||
static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
|
||||
struct ref_format *format)
|
||||
@ -79,7 +80,8 @@ static int list_tags(struct ref_filter *filter, struct ref_sorting *sorting,
|
||||
if (format_ref_array_item(array.items[i], format, &output, &err))
|
||||
die("%s", err.buf);
|
||||
fwrite(output.buf, 1, output.len, stdout);
|
||||
putchar('\n');
|
||||
if (output.len || !omit_empty)
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
strbuf_release(&err);
|
||||
@ -474,6 +476,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
|
||||
OPT_WITHOUT(&filter.no_commit, N_("print only tags that don't contain the commit")),
|
||||
OPT_MERGED(&filter, N_("print only tags that are merged")),
|
||||
OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
|
||||
OPT_BOOL(0, "omit-empty", &omit_empty,
|
||||
N_("do not output a newline after empty formatted refs")),
|
||||
OPT_REF_SORT(&sorting_options),
|
||||
{
|
||||
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
||||
|
Reference in New Issue
Block a user