git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] log: Handle new repository case.

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 25, 2012, 23:13 UTC
Message-ID
<7vobo7dlyl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1340664813-96891-1-git-send-email-muhtasib@gmail.com>
Leila Muhtasib <muhtasib@gmail.com> writes:
Show 13 quoted lines
> @@ -553,8 +562,13 @@ int cmd_log(int argc, const char **argv, const char *prefix)
>  	init_revisions(&rev, prefix);
>  	rev.always_show_header = 1;
>  	memset(&opt, 0, sizeof(opt));
> -	opt.def = "HEAD";
> +	opt.def = default_to_head_if_exists();
> +
>  	cmd_log_init(argc, argv, prefix, &rev, &opt);
> +
> +	if (!opt.def && !rev.cmdline.nr)
> +		return 0;
> +
>  	return cmd_log_walk(&rev);

Do you even need these four new lines if you do not error out? Doesn't log_walk() return successfully if there is nothing in the queue anyway?

Show 6 quoted lines
> @@ -1128,7 +1142,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>  	DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
>  	rev.subject_prefix = fmt_patch_subject_prefix;
>  	memset(&s_r_opt, 0, sizeof(s_r_opt));
> -	s_r_opt.def = "HEAD";
> +	s_r_opt.def = default_to_head_if_exists();

I didn't think about other commands, but I do not think format-patch wants to silently succeed without doing anything---it is definitely a user error, no?

Previous: Leila MuhtasibNext: Leila
Message 2 of 4 in “log: Handle new repository case.”
  1. log: Handle new repository case.Leila Muhtasib, Jun 25, 2012
  2. Junio C HamanoJun 25, 2012
  3. LeilaJun 26, 2012
  4. Junio C HamanoJun 26, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.