Subject: Re: [WIP/RFC 09/13] git notes merge: Initial implementation handling trivial merges only

From: Johan Herland <[email-masked]>
Date: Sun, 25 Jul 2010 16:14:31 +0200

On Saturday 24 July 2010, Stephen Boyd wrote:
>   On 07/23/2010 03:15 AM, Johan Herland wrote:
> > +	if (1<  argc) {
> > +		error("too many parameters");
> > +		usage_with_options(git_notes_merge_usage, options);
> > +	} else if (1>  argc) {
> > +		error("too few parameters");
> > +		usage_with_options(git_notes_merge_usage, options);
> > +	}
> > +
> 
> Looks like it only takes one <notes_ref>. In that case wouldn't it be
> better to say
> 
>      if (argc != 1) {
>          error("Must specify a note ref to merge");
>          usage_with_options(git_notes_merge_usage, options)
>      }

Thanks. I'll squash the following into the next iteration:

...Johan

diff --git a/builtin/notes.c b/builtin/notes.c
index f2bc767..ca0e4d9 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -780,11 +780,8 @@ static int merge(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, prefix, options,
 			     git_notes_merge_usage, 0);
 
-	if (1 < argc) {
-		error("too many parameters");
-		usage_with_options(git_notes_merge_usage, options);
-	} else if (1 > argc) {
-		error("too few parameters");
+	if (argc != 1) {
+		error("Must specify a notes ref to merge");
 		usage_with_options(git_notes_merge_usage, options);
 	}

-- 
Johan Herland, <[email-masked]>
www.herland.net