From 92e0d42539a34e90f5c9bf29eb741f0d87173027 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 29 Mar 2011 16:59:42 -0400 Subject: revision.c: make --no-notes reset --notes list With most command line options, later instances of an option override earlier ones. With cumulative options like "--notes", however, there is no way to say "forget the --notes I gave you before". Let's have --no-notes trigger this forgetting, so that: git log --notes=foo --no-notes --notes=bar will show only the "bar" notes. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- revision.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'revision.c') diff --git a/revision.c b/revision.c index c4ffee464..541f09e21 100644 --- a/revision.c +++ b/revision.c @@ -1389,6 +1389,12 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg } else if (!strcmp(arg, "--no-notes")) { revs->show_notes = 0; revs->show_notes_given = 1; + revs->notes_opt.use_default_notes = -1; + /* we have been strdup'ing ourselves, so trick + * string_list into free()ing strings */ + revs->notes_opt.extra_notes_refs.strdup_strings = 1; + string_list_clear(&revs->notes_opt.extra_notes_refs, 0); + revs->notes_opt.extra_notes_refs.strdup_strings = 0; } else if (!strcmp(arg, "--standard-notes")) { revs->show_notes_given = 1; revs->notes_opt.use_default_notes = 1; -- cgit v1.2.1