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

Re: [PATCH v2 1/2] read-cache: factor out get_sha1_from_index() helper

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 27, 2016, 19:57 UTC
Message-ID
<xmqqinsd5zuz.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20161012134726.28326-1-tboegi@web.de>
tboegi@web.de writes:
Show 26 quoted lines
> From: Torsten Bögershausen <tboegi@web.de>
>
> Factor out the retrieval of the sha1 for a given path in
> read_blob_data_from_index() into the function get_sha1_from_index().
>
> This will be used in the next commit, when convert.c can do the
> analyze for "text=auto" without slurping the whole blob into memory
> at once.
>
> Add a wrapper definition get_sha1_from_cache().
>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---
>  cache.h      |  3 +++
>  read-cache.c | 29 ++++++++++++++++++-----------
>  2 files changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/cache.h b/cache.h
> index 1604e29..04de209 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -380,6 +380,7 @@ extern void free_name_hash(struct index_state *istate);
>  #define unmerge_cache_entry_at(at) unmerge_index_entry_at(&the_index, at)
>  #define unmerge_cache(pathspec) unmerge_index(&the_index, pathspec)
>  #define read_blob_data_from_cache(path, sz) read_blob_data_from_index(&the_index, (path), (sz))
> +#define get_sha1_from_cache(path)  get_sha1_from_index (&the_index, (path))

Should have caught this earlier, but there is an extra SP after "from_index" which I'll remove (the topic is not in 'next' yet, lucky us).

I re-read this to ensure that it does not break read_blob_data_from_index() the new function borrows the logic from.

Thanks.
Previous: tboegi@web.deNext: Duy Nguyen
Message 4 of 11 in “convert: stream and early out”
  1. 0/2 convert: stream and early outtboegi@web.de, Oct 9, 2016
  2. Junio C HamanoOct 10, 2016
  3. 1/2 read-cache: factor out get_sha1_from_index() helpertboegi@web.de, Oct 12, 2016
  4. Junio C HamanoOct 27, 2016
  5. Duy NguyenOct 29, 2016
  6. 0/2 Stream and fast searchtboegi@web.de, Oct 12, 2016
  7. Junio C HamanoOct 27, 2016
  8. 2/2 convert.c: stream and fast search for binarytboegi@web.de, Oct 12, 2016
  9. Junio C HamanoOct 27, 2016
  10. Torsten BögershausenNov 1, 2016
  11. Duy NguyenOct 29, 2016

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.