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

Re: [PATCHv2] Documentation: describe --thin more accurately

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2010, 17:36 UTC
Message-ID
<7vhbpm2w6n.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1265961646-28585-1-git-send-email-bebarino@gmail.com>
Stephen Boyd <bebarino@gmail.com> writes:
Show 5 quoted lines
> The description for --thin was misleading and downright wrong. Correct
> it with some inspiration from the description of index-pack's --fix-thin
> and some background information from Nicolas Pitre <nico@fluxnic.net>.
>
> Signed-off-by: Stephen Boyd <bebarino@gmail.com>
Looks better, but...
Show 14 quoted lines
> diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
> index e9952e8..c428f6d 100644
> --- a/Documentation/git-fetch-pack.txt
> +++ b/Documentation/git-fetch-pack.txt
> @@ -44,8 +44,10 @@ OPTIONS
>  	locked against repacking.
>  
>  --thin::
> -	Spend extra cycles to minimize the number of objects to be sent.
> -	Use it on slower connection.
> +	Fetch a "thin" pack, which records objects in deltified form based
> +	on objects not included in the pack to reduce network traffic.
> +	The excluded objects are expected to be present on the receiving
> +	end.

It is useless and misleading to say "expected to be" for fetch-pack and send-pack. Imagine you are a first time reader of this documentation and read the above. Wouldn't it be very natural to ask yourself: "I want to take advantage of reduced network traffic by using --thin. How do I make sure that my local repository (i.e. receiving end) satisfies that expectation?"

The answer is, "nothing"---the protocol exchange ensures that condition.
Show 17 quoted lines
> diff --git a/Documentation/git-index-pack.txt b/Documentation/git-index-pack.txt
> index 65a301b..73fe51a 100644
> --- a/Documentation/git-index-pack.txt
> +++ b/Documentation/git-index-pack.txt
> @@ -46,10 +46,10 @@ OPTIONS
>  	'git repack'.
>  
>  --fix-thin::
> -	It is possible for 'git pack-objects' to build
> +	It is possible for 'git pack-objects' to build a
>  	"thin" pack, which records objects in deltified form based on
>  	objects not included in the pack to reduce network traffic.
> -	Those objects are expected to be present on the receiving end
> +	The excluded objects are expected to be present on the receiving end
>  	and they must be included in the pack for that pack to be self
>  	contained and indexable. Without this option any attempt to
>  	index a thin pack will fail. This option only makes sense in

This "expected to be present and they must be included" is correct, but "running index-pack with this option is how you 'fix' the thin pack by including them" is missing (not your patch's fault---but because you are touching in the vicinity on this exact topic anyway...).

Show 15 quoted lines
> diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
> index ffd5025..f32c322 100644
> --- a/Documentation/git-pack-objects.txt
> +++ b/Documentation/git-pack-objects.txt
> @@ -179,6 +179,14 @@ base-name::
>  	Add --no-reuse-object if you want to force a uniform compression
>  	level on all data no matter the source.
>  
> +--thin::
> +	Create a "thin" pack, which records objects in deltified form based
> +	on objects not included in the pack to reduce network traffic.
> +	The excluded objects are expected to be present on the receiving end
> +	and eventually must be included in the pack for that pack to be self
> +	contained and indexable. This option only makes sense in
> +	conjunction with --stdout.

Before using such a "thin" pack, the receiving end must add excluded objects back to make it self-contained and indexable by running index-pack with its --fix-thin option.

Show 15 quoted lines
> diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
> index bd79119..c67b06c 100644
> --- a/Documentation/git-push.txt
> +++ b/Documentation/git-push.txt
> @@ -141,9 +141,10 @@ useful if you write an alias or script around 'git push'.
>  
>  --thin::
>  --no-thin::
> -	These options are passed to 'git send-pack'.  Thin
> -	transfer spends extra cycles to minimize the number of
> -	objects to be sent and meant to be used on slower connection.
> +	These options are passed to linkgit:git-send-pack[1]. A thin transfer
> +	significantly reduces the number of sent objects when the sender and
> +	receiver share many of the same objects in common. The default is
> +	\--thin.

It is sometimes true that "number of" send objects is reduced, but the significant reduction comes from sending smaller amount of data.

If both sides start out with a file with 10000 lines, and you have two commits since then, one adding a line A and then adding another line B on top of it. Without --thin, you would send the last version (10000 original lines plus A and B) in full and a delta that says "starting from that version, delete line B", in order to represent the two versions (one with addition of line A, the other with addition of both line A and B). With --thin, you would instead send two deltas that say "starting from the 10000-line file you have, add line A" and "starting from that result, add line B", without sending any full version. The sent number of objects in these two cases are the same (the version with A added, and the version with both A and B added).

Show 14 quoted lines
> diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
> index 8178d92..1d7c4d4 100644
> --- a/Documentation/git-send-pack.txt
> +++ b/Documentation/git-send-pack.txt
> @@ -48,8 +48,10 @@ OPTIONS
>  	Run verbosely.
>  
>  --thin::
> -	Spend extra cycles to minimize the number of objects to be sent.
> -	Use it on slower connection.
> +	Send a "thin" pack, which records objects in deltified form based
> +	on objects not included in the pack to reduce network traffic.
> +	The excluded objects are expected to be present on the receiving
> +	end.
The same comment as fetch-pack one applies here.
Thanks.
Previous: Stephen BoydNext: Stephen Boyd
Message 7 of 11 in “Documentation: reword --thin description”
  1. Documentation: reword --thin descriptionStephen Boyd, Feb 10, 2010
  2. Nicolas PitreFeb 10, 2010
  3. Stephen BoydFeb 10, 2010
  4. Junio C HamanoFeb 10, 2010
  5. Nicolas PitreFeb 10, 2010
  6. [PATCHv2] Documentation: describe --thin more accuratelyStephen Boyd, Feb 12, 2010
  7. Junio C HamanoFeb 12, 2010
  8. [PATCHv3] Documentation: describe --thin more accuratelyStephen Boyd, Feb 15, 2010
  9. Junio C HamanoFeb 15, 2010
  10. Stephen BoydFeb 18, 2010
  11. [PATCHv4] Documentation: describe --thin more accuratelyStephen Boyd, Feb 18, 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.