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

Re: [PATCH v2 1/1] pack-objects: ignore ambiguous object warnings

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 7, 2018, 08:52 UTC
Message-ID
<xmqq7ehpclsa.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<xmqqftwdd54p.fsf@gitster-ct.c.googlers.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> The fix here is similar to 4c30d50 "rev-list: disable object/refname
> ambiguity check with --stdin".  While the get_object_list() method
> reads the objects from stdin, turn warn_on_object_refname_ambiguity
> flag (which is usually true) to false.  Just for code hygiene, save
> away the original at the beginning and restore it once we are done.

I actually think this is a bit too broad. The calling process of this program does know that it is feeding list of raw object names (prefixed with ^ for negative ones), but the codepath this patch touches does not know who is calling it with what. It would be safer to introduce a mechanism for the caller to tell this codepath not to bother checking refnames, as it knows it is feeding the raw object names and not refnames.

After all, you can feed things like "refs/heads/master" from the standard input of "git pack-objects --revs", no?

Show 37 quoted lines
> Helped-by: Jeff King <peff@peff.net>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  builtin/pack-objects.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index d1144a8f7e..f703e6df9b 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -2988,6 +2988,7 @@ static void get_object_list(int ac, const char **av)
>  	struct rev_info revs;
>  	char line[1000];
>  	int flags = 0;
> +	int save_warning;
>  
>  	init_revisions(&revs, NULL);
>  	save_commit_buffer = 0;
> @@ -2996,6 +2997,9 @@ static void get_object_list(int ac, const char **av)
>  	/* make sure shallows are read */
>  	is_repository_shallow(the_repository);
>  
> +	save_warning = warn_on_object_refname_ambiguity;
> +	warn_on_object_refname_ambiguity = 0;
> +
>  	while (fgets(line, sizeof(line), stdin) != NULL) {
>  		int len = strlen(line);
>  		if (len && line[len - 1] == '\n')
> @@ -3022,6 +3026,8 @@ static void get_object_list(int ac, const char **av)
>  			die(_("bad revision '%s'"), line);
>  	}
>  
> +	warn_on_object_refname_ambiguity = save_warning;
> +
>  	if (use_bitmap_index && !get_object_list_from_bitmap(&revs))
>  		return;
Previous: Junio C HamanoNext: Jeff King
Message 11 of 12 in “send-pack: set core.warnAmbiguousRefs=false”
  1. 0/1 send-pack: set core.warnAmbiguousRefs=falseDerrick Stolee via GitGitGadget, Nov 6, 2018
  2. 1/1 send-pack: set core.warnAmbiguousRefs=falseDerrick Stolee via GitGitGadget, Nov 6, 2018
  3. Jeff KingNov 6, 2018
  4. Jeff KingNov 6, 2018
  5. Derrick StoleeNov 6, 2018
  6. Derrick StoleeNov 6, 2018
  7. 0/1 send-pack: set core.warnAmbiguousRefs=falseDerrick Stolee via GitGitGadget, Nov 6, 2018
  8. 1/1 pack-objects: ignore ambiguous object warningsDerrick Stolee via GitGitGadget, Nov 6, 2018
  9. Jeff KingNov 6, 2018
  10. Junio C HamanoNov 7, 2018
  11. Junio C HamanoNov 7, 2018
  12. Jeff KingNov 7, 2018

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.