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

Re: [PATCH v2 2/3] read-cache.c: Optionally tolerate missing files in make_cache_entry

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 24, 2014, 20:39 UTC
Message-ID
<xmqqr47xqflf.fsf@gitster.dls.corp.google.com>
In-Reply-To
<197b46e792c8640d19580f282834052a660d2c05.1390592626.git.brad.king@kitware.com>
Brad King <brad.king@kitware.com> writes:
> +extern struct cache_entry *make_cache_entry(unsigned int mode, const unsigned char *sha1, const char *path, int stage, int refresh, int refresh_flags);

Why a new parameter? If refresh_flags can be ANY when refresh=NoThanks, shouldn't they be a single variable that tells the callee how the entry should be refreshed (e.g. "not at all", "normally", "missing is ok", etc.)?

Show 12 quoted lines
> +static struct cache_entry *refresh_cache_entry(struct cache_entry *ce, int really,
> +					       int flags)
>  {
> -	return refresh_cache_ent(&the_index, ce, really, NULL, NULL);
> +	int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
> +	int cache_errno = 0;
> +	struct cache_entry *new;
> +
> +	new = refresh_cache_ent(&the_index, ce, really, &cache_errno, NULL);
> +
> +	if(!new && not_new && cache_errno == ENOENT)
> +		return ce;

I think this is still one level too high in the abstraction chain. "int really" might be of type signed int by historical accidents, but it is "unsigned int options" for the underlying refresh_cache_ent(). I'd suggest renaming this to "unsigned int refresh_options" or something, and then define a new constatnt similar to the existing CE_MATCH_IGNORE_*.

Previous: Brad KingNext: Brad King
Message 12 of 21 in “merge-recursive: Avoid diagnostic on empty work tree”
  1. 0/3 merge-recursive: Avoid diagnostic on empty work treeBrad King, Jan 24, 2014
  2. 1/3 t3030-merge-recursive: Test known breakage with empty work treeBrad King, Jan 24, 2014
  3. Jonathan NiederJan 24, 2014
  4. Brad KingJan 24, 2014
  5. 2/3 read-cache.c: Thread lstat error through make_cache_entry signatureBrad King, Jan 24, 2014
  6. 3/3 merge-recursive: Tolerate missing file when HEAD is up to dateBrad King, Jan 24, 2014
  7. Junio C HamanoJan 24, 2014
  8. Brad KingJan 24, 2014
  9. 0/3 merge-recursive: Avoid diagnostic on empty work treeBrad King, Jan 24, 2014
  10. 1/3 t3030-merge-recursive: Test known breakage with empty work treeBrad King, Jan 24, 2014
  11. 2/3 read-cache.c: Optionally tolerate missing files in make_cache_entryBrad King, Jan 24, 2014
  12. Junio C HamanoJan 24, 2014
  13. 3/3 merge-recursive.c: Tolerate missing files while refreshing indexBrad King, Jan 24, 2014
  14. 0/3 merge-recursive: Avoid diagnostic on empty work treeBrad King, Jan 27, 2014
  15. 1/4 t3030-merge-recursive: Test known breakage with empty work treeBrad King, Jan 27, 2014
  16. 2/4 read-cache.c: Refactor --ignore-missing implementationBrad King, Jan 27, 2014
  17. Junio C HamanoJan 27, 2014
  18. 3/4 read-cache.c: Extend make_cache_entry refresh flag with optionsBrad King, Jan 27, 2014
  19. 4/4 merge-recursive.c: Tolerate missing files while refreshing indexBrad King, Jan 27, 2014
  20. Fwd: [PATCH/RFC 3/3] merge-recursive: Tolerate missing file when HEAD is up to datenewren, Jan 24, 2014
  21. Brad KingJan 24, 2014

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.