All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] push: respect --no-thin
@ 2013-08-10 10:10 Nguyễn Thái Ngọc Duy
  2013-08-10 10:31 ` Jeff King
  2013-08-11  1:24 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-08-10 10:10 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Ramkumar Ramachandra, Martin Fick,
	Nguyễn Thái Ngọc Duy

Over the time the default value for --thin has been switched between
on and off. As of now it's always on, even if --no-thin is given.
Correct the code to respect --no-thin.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/push.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 04f0eaf..333a1fb 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
 	NULL,
 };
 
-static int thin;
+static int thin = 1;
 static int deleterefs;
 static const char *receivepack;
 static int verbosity;
@@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (receivepack)
 		transport_set_option(transport,
 				     TRANS_OPT_RECEIVEPACK, receivepack);
-	if (thin)
-		transport_set_option(transport, TRANS_OPT_THIN, "yes");
+	transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
 
 	if (verbosity > 0)
 		fprintf(stderr, _("Pushing to %s\n"), transport->url);
-- 
1.8.2.83.gc99314b

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] push: respect --no-thin
  2013-08-10 10:10 [PATCH] push: respect --no-thin Nguyễn Thái Ngọc Duy
@ 2013-08-10 10:31 ` Jeff King
  2013-08-10 11:45   ` Duy Nguyen
  2013-08-11  1:24 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
  1 sibling, 1 reply; 10+ messages in thread
From: Jeff King @ 2013-08-10 10:31 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Junio C Hamano, Ramkumar Ramachandra, Martin Fick

On Sat, Aug 10, 2013 at 05:10:07PM +0700, Nguyen Thai Ngoc Duy wrote:

> Over the time the default value for --thin has been switched between
> on and off. As of now it's always on, even if --no-thin is given.
> Correct the code to respect --no-thin.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

This makes sense, and I confirmed with the script I posted earlier that
it does work (and didn't before). Thanks.

It might be nice to have a test, but I am not sure of a good way to
check whether a push was thin. I guess we can grep the output of
GIT_TRACE, though it feels a bit hacky.

-Peff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] push: respect --no-thin
  2013-08-10 10:31 ` Jeff King
@ 2013-08-10 11:45   ` Duy Nguyen
  0 siblings, 0 replies; 10+ messages in thread
From: Duy Nguyen @ 2013-08-10 11:45 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano, Ramkumar Ramachandra, Martin Fick

On Sat, Aug 10, 2013 at 06:31:23AM -0400, Jeff King wrote:
> It might be nice to have a test, but I am not sure of a good way to
> check whether a push was thin. I guess we can grep the output of
> GIT_TRACE, though it feels a bit hacky.

In theory, if we have a way to tell receive-pack not to pass
--fix-thin to index-pack, then it should barf on the thin pack
received from push/send-pack. But it does not work this way, or at
least I set up the test the wrong way, or pack-objects decides not to
create deltas.. anybody sees what's wrong in this test?

-- 8< --
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e3eb5fc..da60817 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -38,6 +38,7 @@ static int quiet;
 static int prefer_ofs_delta = 1;
 static int auto_update_server_info;
 static int auto_gc = 1;
+static int fix_thin = 1;
 static const char *head_name;
 static void *head_name_to_free;
 static int sent_capabilities;
@@ -869,7 +870,8 @@ static const char *unpack(int err_fd)
 		keeper[i++] = "--stdin";
 		if (fsck_objects)
 			keeper[i++] = "--strict";
-		keeper[i++] = "--fix-thin";
+		if (fix_thin)
+			keeper[i++] = "--fix-thin";
 		keeper[i++] = hdr_arg;
 		keeper[i++] = keep_arg;
 		keeper[i++] = NULL;
@@ -975,6 +977,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 				stateless_rpc = 1;
 				continue;
 			}
+			if (!strcmp(arg, "--no-thin")) {
+				fix_thin = 0;
+				continue;
+			}
 
 			usage(receive_pack_usage);
 		}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4691d51..9c9d43c 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -126,6 +126,16 @@ test_expect_success setup '
 
 '
 
+test_expect_success 'push --no-thin' '
+	git init no-thin &&
+	git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
+	git push no-thin/.git refs/heads/master:refs/heads/foo &&
+	echo modified >> path1 &&
+	git commit -am modified &&
+	git push --no-thin --receive-pack="git receive-pack --no-thin" no-thin/.git refs/heads/master:refs/heads/foo
+	false
+'
+
 test_expect_success 'fetch without wildcard' '
 	mk_empty testrepo &&
 	(
-- 8< --

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2] push: respect --no-thin
  2013-08-10 10:10 [PATCH] push: respect --no-thin Nguyễn Thái Ngọc Duy
  2013-08-10 10:31 ` Jeff King
@ 2013-08-11  1:24 ` Nguyễn Thái Ngọc Duy
  2013-08-11  5:12   ` Eric Sunshine
  2013-08-11  8:52   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
  1 sibling, 2 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-08-11  1:24 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Ramkumar Ramachandra, Martin Fick,
	Nguyễn Thái Ngọc Duy

Over the time the default value for --thin has been switched between
on and off. As of now it's always on, even if --no-thin is given.
Correct the code to respect --no-thin.

receive-pack learns about --no-thin only for testing purposes, hence
no document update.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 v2 adds a test for push --no-thin. I figured out the problem in my
 test. I hit size filtering heuristics in pack-objects.c:try_delta().

 builtin/push.c         |  5 ++---
 builtin/receive-pack.c |  8 +++++++-
 t/t5516-fetch-push.sh  | 12 ++++++++++++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 04f0eaf..333a1fb 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
 	NULL,
 };
 
-static int thin;
+static int thin = 1;
 static int deleterefs;
 static const char *receivepack;
 static int verbosity;
@@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (receivepack)
 		transport_set_option(transport,
 				     TRANS_OPT_RECEIVEPACK, receivepack);
-	if (thin)
-		transport_set_option(transport, TRANS_OPT_THIN, "yes");
+	transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
 
 	if (verbosity > 0)
 		fprintf(stderr, _("Pushing to %s\n"), transport->url);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e3eb5fc..da60817 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -38,6 +38,7 @@ static int quiet;
 static int prefer_ofs_delta = 1;
 static int auto_update_server_info;
 static int auto_gc = 1;
+static int fix_thin = 1;
 static const char *head_name;
 static void *head_name_to_free;
 static int sent_capabilities;
@@ -869,7 +870,8 @@ static const char *unpack(int err_fd)
 		keeper[i++] = "--stdin";
 		if (fsck_objects)
 			keeper[i++] = "--strict";
-		keeper[i++] = "--fix-thin";
+		if (fix_thin)
+			keeper[i++] = "--fix-thin";
 		keeper[i++] = hdr_arg;
 		keeper[i++] = keep_arg;
 		keeper[i++] = NULL;
@@ -975,6 +977,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 				stateless_rpc = 1;
 				continue;
 			}
+			if (!strcmp(arg, "--no-thin")) {
+				fix_thin = 0;
+				continue;
+			}
 
 			usage(receive_pack_usage);
 		}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4691d51..e80247b 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1172,4 +1172,16 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
 	test_cmp expect actual
 '
 
+test_expect_success 'push --no-thin must produce non-thin pack' '
+	for i in `seq 100`; do echo modified >> path1; done &&
+	git commit -am "path1 big enough to pass size heuristics in try_delta" &&
+	git init no-thin &&
+	git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
+	git push no-thin/.git refs/heads/master:refs/heads/foo &&
+	echo modified >> path1 &&
+	git commit -am modified &&
+	git repack -adf &&
+	git push --no-thin --receive-pack="git receive-pack --no-thin" no-thin/.git refs/heads/master:refs/heads/foo
+'
+
 test_done
-- 
1.8.2.83.gc99314b

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] push: respect --no-thin
  2013-08-11  1:24 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
@ 2013-08-11  5:12   ` Eric Sunshine
  2013-08-11  8:52   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
  1 sibling, 0 replies; 10+ messages in thread
From: Eric Sunshine @ 2013-08-11  5:12 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: Git List, Junio C Hamano, Jeff King, Ramkumar Ramachandra,
	Martin Fick

On Sat, Aug 10, 2013 at 9:24 PM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> Over the time the default value for --thin has been switched between
> on and off. As of now it's always on, even if --no-thin is given.
> Correct the code to respect --no-thin.
>
> receive-pack learns about --no-thin only for testing purposes, hence
> no document update.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index 4691d51..e80247b 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -1172,4 +1172,16 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
>         test_cmp expect actual
>  '
>
> +test_expect_success 'push --no-thin must produce non-thin pack' '
> +       for i in `seq 100`; do echo modified >> path1; done &&

s/seq/test_seq/

d17cf5f3a32f07bf (tests: Introduce test_seq;  2012-08-03)

> +       git commit -am "path1 big enough to pass size heuristics in try_delta" &&
> +       git init no-thin &&
> +       git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
> +       git push no-thin/.git refs/heads/master:refs/heads/foo &&
> +       echo modified >> path1 &&
> +       git commit -am modified &&
> +       git repack -adf &&
> +       git push --no-thin --receive-pack="git receive-pack --no-thin" no-thin/.git refs/heads/master:refs/heads/foo
> +'
> +
>  test_done
> --
> 1.8.2.83.gc99314b

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] push: respect --no-thin
  2013-08-11  1:24 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
  2013-08-11  5:12   ` Eric Sunshine
@ 2013-08-11  8:52   ` Nguyễn Thái Ngọc Duy
  2013-08-12  5:59     ` Junio C Hamano
  2013-08-12 13:55     ` [PATCH v4] " Nguyễn Thái Ngọc Duy
  1 sibling, 2 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-08-11  8:52 UTC (permalink / raw)
  To: git
  Cc: Eric Sunshine, Junio C Hamano, Jeff King, Ramkumar Ramachandra,
	Martin Fick, Nguyễn Thái Ngọc Duy

Over the time the default value for --thin has been switched between
on and off. As of now it's always on, even if --no-thin is given.
Correct the code to respect --no-thin.

receive-pack learns about --no-thin only for testing purposes, hence
no document update.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 v3 gets rid of seq in the test.

 builtin/push.c         |  5 ++---
 builtin/receive-pack.c |  8 +++++++-
 t/t5516-fetch-push.sh  | 16 ++++++++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 04f0eaf..333a1fb 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
 	NULL,
 };
 
-static int thin;
+static int thin = 1;
 static int deleterefs;
 static const char *receivepack;
 static int verbosity;
@@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (receivepack)
 		transport_set_option(transport,
 				     TRANS_OPT_RECEIVEPACK, receivepack);
-	if (thin)
-		transport_set_option(transport, TRANS_OPT_THIN, "yes");
+	transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
 
 	if (verbosity > 0)
 		fprintf(stderr, _("Pushing to %s\n"), transport->url);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e3eb5fc..da60817 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -38,6 +38,7 @@ static int quiet;
 static int prefer_ofs_delta = 1;
 static int auto_update_server_info;
 static int auto_gc = 1;
+static int fix_thin = 1;
 static const char *head_name;
 static void *head_name_to_free;
 static int sent_capabilities;
@@ -869,7 +870,8 @@ static const char *unpack(int err_fd)
 		keeper[i++] = "--stdin";
 		if (fsck_objects)
 			keeper[i++] = "--strict";
-		keeper[i++] = "--fix-thin";
+		if (fix_thin)
+			keeper[i++] = "--fix-thin";
 		keeper[i++] = hdr_arg;
 		keeper[i++] = keep_arg;
 		keeper[i++] = NULL;
@@ -975,6 +977,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 				stateless_rpc = 1;
 				continue;
 			}
+			if (!strcmp(arg, "--no-thin")) {
+				fix_thin = 0;
+				continue;
+			}
 
 			usage(receive_pack_usage);
 		}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4691d51..3cfd1cd 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1172,4 +1172,20 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
 	test_cmp expect actual
 '
 
+test_expect_success 'push --no-thin must produce non-thin pack' '
+	cat >>path1 <<\EOF &&
+keep base version of path1 big enough, compared to the new changes
+later, in order to pass size heuristics in
+builtin/pack-objects.c:try_delta()
+EOF
+	git commit -am initial &&
+	git init no-thin &&
+	git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
+	git push no-thin/.git refs/heads/master:refs/heads/foo &&
+	echo modified >> path1 &&
+	git commit -am modified &&
+	git repack -adf &&
+	git push --no-thin --receive-pack="git receive-pack --no-thin" no-thin/.git refs/heads/master:refs/heads/foo
+'
+
 test_done
-- 
1.8.2.83.gc99314b

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] push: respect --no-thin
  2013-08-11  8:52   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
@ 2013-08-12  5:59     ` Junio C Hamano
  2013-08-12 11:30       ` Duy Nguyen
  2013-08-12 13:55     ` [PATCH v4] " Nguyễn Thái Ngọc Duy
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2013-08-12  5:59 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy
  Cc: git, Eric Sunshine, Jeff King, Ramkumar Ramachandra, Martin Fick

Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:

> Over the time the default value for --thin has been switched between
> on and off. As of now it's always on, even if --no-thin is given.
> Correct the code to respect --no-thin.
>
> receive-pack learns about --no-thin only for testing purposes, hence
> no document update.

Please name it "--reject-thin-pack-for-testing" to make it crystal
clear that a documentation patch to "document undocumented option"
is unwanted.

> diff --git a/builtin/push.c b/builtin/push.c
> index 04f0eaf..333a1fb 100644
> --- a/builtin/push.c
> +++ b/builtin/push.c
> @@ -15,7 +15,7 @@ static const char * const push_usage[] = {
>  	NULL,
>  };
>  
> -static int thin;
> +static int thin = 1;
>  static int deleterefs;
>  static const char *receivepack;
>  static int verbosity;
> @@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
>  	if (receivepack)
>  		transport_set_option(transport,
>  				     TRANS_OPT_RECEIVEPACK, receivepack);
> -	if (thin)
> -		transport_set_option(transport, TRANS_OPT_THIN, "yes");
> +	transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
>  
>  	if (verbosity > 0)
>  		fprintf(stderr, _("Pushing to %s\n"), transport->url);

Hmm, I am utterly confused.

How does the original code have thin as an non-overridable default?
The variable is initialized to 0, parse-options specifies it as
OPT_BOOLEAN, and TRANS_OPT_THIN is set only if "thin" is set.

Updated code flips the default to "1" but unconditionally uses
TRANS_OPT_THIN to set it to either "yes" or NULL.  While it is not
wrong per-se, do_push() (i.e. the caller of this function) grabs the
transport from transport_get() which initializes the transport with
the thin option disabled by default, so it is not immediately
obvious to me why "always call TRANS_OPT_THIN but set it explicitly
to NULL when --no-thin is asked" is necessary or improvement.

Puzzled....

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] push: respect --no-thin
  2013-08-12  5:59     ` Junio C Hamano
@ 2013-08-12 11:30       ` Duy Nguyen
  2013-08-13 16:43         ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Duy Nguyen @ 2013-08-12 11:30 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Git Mailing List, Eric Sunshine, Jeff King, Ramkumar Ramachandra,
	Martin Fick

On Mon, Aug 12, 2013 at 12:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> @@ -15,7 +15,7 @@ static const char * const push_usage[] = {
>>       NULL,
>>  };
>>
>> -static int thin;
>> +static int thin = 1;
>>  static int deleterefs;
>>  static const char *receivepack;
>>  static int verbosity;
>> @@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
>>       if (receivepack)
>>               transport_set_option(transport,
>>                                    TRANS_OPT_RECEIVEPACK, receivepack);
>> -     if (thin)
>> -             transport_set_option(transport, TRANS_OPT_THIN, "yes");
>> +     transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
>>
>>       if (verbosity > 0)
>>               fprintf(stderr, _("Pushing to %s\n"), transport->url);
>
> Hmm, I am utterly confused.
>
> How does the original code have thin as an non-overridable default?
> The variable is initialized to 0, parse-options specifies it as
> OPT_BOOLEAN, and TRANS_OPT_THIN is set only if "thin" is set.
>
> Updated code flips the default to "1" but unconditionally uses
> TRANS_OPT_THIN to set it to either "yes" or NULL.  While it is not
> wrong per-se, do_push() (i.e. the caller of this function) grabs the
> transport from transport_get() which initializes the transport with
> the thin option disabled by default,

transport_get() actually sets thin option to 1 by default. If I don't
misread the code, the first version of transport.c already flipped
"thin" from 0 (in push.c) to 1 (in transport.c), see 9b28851 (Push
code for transport library - 2007-09-10). The funny thing is that
commit was just one day after Shawn flipped 'thin' from 1 to 0 in
push.c in a4503a1.

> so it is not immediately
> obvious to me why "always call TRANS_OPT_THIN but set it explicitly
> to NULL when --no-thin is asked" is necessary or improvement.
-- 
Duy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] push: respect --no-thin
  2013-08-11  8:52   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
  2013-08-12  5:59     ` Junio C Hamano
@ 2013-08-12 13:55     ` Nguyễn Thái Ngọc Duy
  1 sibling, 0 replies; 10+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-08-12 13:55 UTC (permalink / raw)
  To: git
  Cc: Eric Sunshine, Junio C Hamano, Jeff King, Ramkumar Ramachandra,
	Martin Fick, Nguyễn Thái Ngọc Duy

- From the beginning of push.c in 755225d, 2006-04-29, "thin" option
  was enabled by default but could be turned off with --no-thin.

- Then Shawn changed the default to 0 in favor of saving server
  resources in a4503a1, 2007-09-09. --no-thin worked great.

- One day later, in 9b28851 Daniel extracted some code from push.c to
  create transport.c. He (probably accidentally) flipped the default
  value from 0 to 1 in transport_get().

From then on --no-thin is effectively no-op because git-push still
expects the default value to be false and only calls
transport_set_option() when "thin" variable in push.c is true (which
is unnecessary). Correct the code to respect --no-thin by calling
transport_set_option() in both cases.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 v4 elaborates a bit on the story of "thin" variable in push.c and
 renames receive-pack --no-thin to --reject-thin-pack-for-testing.

 builtin/push.c         |  5 ++---
 builtin/receive-pack.c |  8 +++++++-
 t/t5516-fetch-push.sh  | 17 +++++++++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/builtin/push.c b/builtin/push.c
index 04f0eaf..333a1fb 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
 	NULL,
 };
 
-static int thin;
+static int thin = 1;
 static int deleterefs;
 static const char *receivepack;
 static int verbosity;
@@ -313,8 +313,7 @@ static int push_with_options(struct transport *transport, int flags)
 	if (receivepack)
 		transport_set_option(transport,
 				     TRANS_OPT_RECEIVEPACK, receivepack);
-	if (thin)
-		transport_set_option(transport, TRANS_OPT_THIN, "yes");
+	transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
 
 	if (verbosity > 0)
 		fprintf(stderr, _("Pushing to %s\n"), transport->url);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index e3eb5fc..fc6d53a 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -38,6 +38,7 @@ static int quiet;
 static int prefer_ofs_delta = 1;
 static int auto_update_server_info;
 static int auto_gc = 1;
+static int fix_thin = 1;
 static const char *head_name;
 static void *head_name_to_free;
 static int sent_capabilities;
@@ -869,7 +870,8 @@ static const char *unpack(int err_fd)
 		keeper[i++] = "--stdin";
 		if (fsck_objects)
 			keeper[i++] = "--strict";
-		keeper[i++] = "--fix-thin";
+		if (fix_thin)
+			keeper[i++] = "--fix-thin";
 		keeper[i++] = hdr_arg;
 		keeper[i++] = keep_arg;
 		keeper[i++] = NULL;
@@ -975,6 +977,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 				stateless_rpc = 1;
 				continue;
 			}
+			if (!strcmp(arg, "--reject-thin-pack-for-testing")) {
+				fix_thin = 0;
+				continue;
+			}
 
 			usage(receive_pack_usage);
 		}
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 4691d51..99c32d7 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -1172,4 +1172,21 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
 	test_cmp expect actual
 '
 
+test_expect_success 'push --no-thin must produce non-thin pack' '
+	cat >>path1 <<\EOF &&
+keep base version of path1 big enough, compared to the new changes
+later, in order to pass size heuristics in
+builtin/pack-objects.c:try_delta()
+EOF
+	git commit -am initial &&
+	git init no-thin &&
+	git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
+	git push no-thin/.git refs/heads/master:refs/heads/foo &&
+	echo modified >> path1 &&
+	git commit -am modified &&
+	git repack -adf &&
+	rcvpck="git receive-pack --reject-thin-pack-for-testing" &&
+	git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo
+'
+
 test_done
-- 
1.8.2.83.gc99314b

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] push: respect --no-thin
  2013-08-12 11:30       ` Duy Nguyen
@ 2013-08-13 16:43         ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2013-08-13 16:43 UTC (permalink / raw)
  To: Duy Nguyen
  Cc: Git Mailing List, Eric Sunshine, Jeff King, Ramkumar Ramachandra,
	Martin Fick

Duy Nguyen <pclouds@gmail.com> writes:

> transport_get() actually sets thin option to 1 by default.

Yeah, I missed your message in the nearby thread.  It indeed does.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-08-13 16:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-10 10:10 [PATCH] push: respect --no-thin Nguyễn Thái Ngọc Duy
2013-08-10 10:31 ` Jeff King
2013-08-10 11:45   ` Duy Nguyen
2013-08-11  1:24 ` [PATCH v2] " Nguyễn Thái Ngọc Duy
2013-08-11  5:12   ` Eric Sunshine
2013-08-11  8:52   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2013-08-12  5:59     ` Junio C Hamano
2013-08-12 11:30       ` Duy Nguyen
2013-08-13 16:43         ` Junio C Hamano
2013-08-12 13:55     ` [PATCH v4] " Nguyễn Thái Ngọc Duy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.