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

Re: [PATCH 1/3] make index-pâck able to complete thin packs

From
Junio C Hamano <junkio@cox.net>
Date
Oct 27, 2006, 22:28 UTC
Message-ID
<7vmz7hcs0o.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0610252323100.12418@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
Show 37 quoted lines
> +static void fix_unresolved_deltas(int nr_unresolved)
> +{
> +	struct delta_entry **sorted_by_pos;
> +	int i, n = 0;
> +
> +	/*
> +	 * Since many unresolved deltas may well be themselves base objects
> +	 * for more unresolved deltas, we really want to include the
> +	 * smallest number of base objects that would cover as much delta
> +	 * as possible by picking the
> +	 * trunc deltas first, allowing for other deltas to resolve without
> +	 * additional base objects.  Since most base objects are to be found
> +	 * before deltas depending on them, a good heuristic is to start
> +	 * resolving deltas in the same order as their position in the pack.
> +	 */
> +	sorted_by_pos = xmalloc(nr_unresolved * sizeof(*sorted_by_pos));
>  	for (i = 0; i < nr_deltas; i++) {
> -		if (deltas[i].obj->real_type == OBJ_REF_DELTA ||
> -		    deltas[i].obj->real_type == OBJ_OFS_DELTA)
> -			die("pack has unresolved deltas");
> +		if (objects[deltas[i].obj_no].real_type != OBJ_REF_DELTA)
> +			continue;
> +		sorted_by_pos[n++] = &deltas[i];
>  	}
>
> +	qsort(sorted_by_pos, n, sizeof(*sorted_by_pos), delta_pos_compare);
> +
> +	for (i = 0; i < n; i++) {
> +		struct delta_entry *d = sorted_by_pos[i];
> +		void *data;
> +		unsigned long size;
> +		char type[10];
> +		enum object_type obj_type;
> +		int j, first, last;
> +
> +		if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
> +			continue;
Just for the sake of my own sanity checking,...

Is it because base objects of OFS_DELTA _must_ exist in the same pack (even when --thin) that we do not have to worry about them in this function?

Previous: Karl HasselströmNext: Nicolas Pitre
Message 14 of 15 in “make index-pâck able to complete thin packs”
  1. 1/3 make index-pâck able to complete thin packsNicolas Pitre, Oct 26, 2006
  2. Junio C HamanoOct 26, 2006
  3. Jakub NarebskiOct 26, 2006
  4. Karl HasselströmOct 26, 2006
  5. Junio C HamanoOct 26, 2006
  6. Karl HasselströmOct 26, 2006
  7. Jakub NarebskiOct 26, 2006
  8. Nicolas PitreOct 26, 2006
  9. Catalin MarinasOct 26, 2006
  10. Karl HasselströmOct 26, 2006
  11. Catalin MarinasOct 26, 2006
  12. Catalin MarinasOct 26, 2006
  13. stg mailKarl Hasselström, Oct 26, 2006
  14. Junio C HamanoOct 27, 2006
  15. Nicolas PitreOct 28, 2006

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.