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

Re: [PATCHv5 2/8] commit.c: new function for looking up a comit by name

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 13, 2010, 21:59 UTC
Message-ID
<7viq15iwjl.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1286478657-61581-3-git-send-email-patnotz@gmail.com>
s/comit/commit/;
"Pat Notz" <patnotz@gmail.com> writes:
Show 20 quoted lines
> diff --git a/commit.c b/commit.c
> index 0094ec1..f51098a 100644
> --- a/commit.c
> +++ b/commit.c
> @@ -49,6 +49,19 @@ struct commit *lookup_commit(const unsigned char *sha1)
>  	return check_commit(obj, sha1, 0);
>  }
>  
> +struct commit *lookup_commit_reference_by_name(const char *name)
> +{
> +	unsigned char sha1[20];
> +	struct commit *commit;
> +
> +	if (get_sha1(name, sha1))
> +		die("could not lookup commit %s", name);
> +	commit = lookup_commit_reference(sha1);
> +	if (!commit || parse_commit(commit))
> +		die("could not parse commit %s", name);
> +	return commit;
> +}

Although this wouldn't _hurt_, not very excited without seeing codepaths that can use this helper to reduce lines (there should be a lot of places, I would think). And when that happens, the helper that dies would not be very useful, as some potential callers that can benefit may want to decide what messages to issue themselves.

Previous: Pat NotzNext: Pat Notz
Message 7 of 17 in “[PATCHv5 0/8] Add commit message options for rebase --autosquash”
  1. Pat NotzOct 7, 2010
  2. 1/8 commit.c: prefer get_header() to manual searchingPat Notz, Oct 7, 2010
  3. Sverre RabbelierOct 7, 2010
  4. Sverre RabbelierOct 7, 2010
  5. Junio C HamanoOct 13, 2010
  6. 2/8 commit.c: new function for looking up a comit by namePat Notz, Oct 7, 2010
  7. Junio C HamanoOct 13, 2010
  8. 3/8 pretty.c: helper methods for getting output encodingsPat Notz, Oct 7, 2010
  9. 4/8 pretty.c: teach format_commit_message() to reencode the outputPat Notz, Oct 7, 2010
  10. Junio C HamanoOct 13, 2010
  11. Pat NotzOct 13, 2010
  12. 5/8 commit: --fixup option for use with rebase --autosquashPat Notz, Oct 7, 2010
  13. 6/8 add tests of commit --fixupPat Notz, Oct 7, 2010
  14. 7/8 commit: --squash option for use with rebase --autosquashPat Notz, Oct 7, 2010
  15. 8/8 add tests of commit --squashPat Notz, Oct 7, 2010
  16. Pat NotzOct 11, 2010
  17. Sverre RabbelierOct 12, 2010

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.