Skip to content

Commit 2de0f39

Browse files
committed
Merge branch 'nd/push-no-thin'
"git push --no-thin" was a no-op by mistake. * nd/push-no-thin: push: respect --no-thin
2 parents bb80ee0 + f7c815c commit 2de0f39

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

builtin/push.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static const char * const push_usage[] = {
1515
NULL,
1616
};
1717

18-
static int thin;
18+
static int thin = 1;
1919
static int deleterefs;
2020
static const char *receivepack;
2121
static int verbosity;
@@ -315,8 +315,7 @@ static int push_with_options(struct transport *transport, int flags)
315315
if (receivepack)
316316
transport_set_option(transport,
317317
TRANS_OPT_RECEIVEPACK, receivepack);
318-
if (thin)
319-
transport_set_option(transport, TRANS_OPT_THIN, "yes");
318+
transport_set_option(transport, TRANS_OPT_THIN, thin ? "yes" : NULL);
320319

321320
if (!is_empty_cas(&cas)) {
322321
if (!transport->smart_options)

builtin/receive-pack.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static int quiet;
3939
static int prefer_ofs_delta = 1;
4040
static int auto_update_server_info;
4141
static int auto_gc = 1;
42+
static int fix_thin = 1;
4243
static const char *head_name;
4344
static void *head_name_to_free;
4445
static int sent_capabilities;
@@ -870,7 +871,8 @@ static const char *unpack(int err_fd)
870871
keeper[i++] = "--stdin";
871872
if (fsck_objects)
872873
keeper[i++] = "--strict";
873-
keeper[i++] = "--fix-thin";
874+
if (fix_thin)
875+
keeper[i++] = "--fix-thin";
874876
keeper[i++] = hdr_arg;
875877
keeper[i++] = keep_arg;
876878
keeper[i++] = NULL;
@@ -976,6 +978,10 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
976978
stateless_rpc = 1;
977979
continue;
978980
}
981+
if (!strcmp(arg, "--reject-thin-pack-for-testing")) {
982+
fix_thin = 0;
983+
continue;
984+
}
979985

980986
usage(receive_pack_usage);
981987
}

t/t5516-fetch-push.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,4 +1172,21 @@ test_expect_success 'push --follow-tag only pushes relevant tags' '
11721172
test_cmp expect actual
11731173
'
11741174

1175+
test_expect_success 'push --no-thin must produce non-thin pack' '
1176+
cat >>path1 <<\EOF &&
1177+
keep base version of path1 big enough, compared to the new changes
1178+
later, in order to pass size heuristics in
1179+
builtin/pack-objects.c:try_delta()
1180+
EOF
1181+
git commit -am initial &&
1182+
git init no-thin &&
1183+
git --git-dir=no-thin/.git config receive.unpacklimit 0 &&
1184+
git push no-thin/.git refs/heads/master:refs/heads/foo &&
1185+
echo modified >> path1 &&
1186+
git commit -am modified &&
1187+
git repack -adf &&
1188+
rcvpck="git receive-pack --reject-thin-pack-for-testing" &&
1189+
git push --no-thin --receive-pack="$rcvpck" no-thin/.git refs/heads/master:refs/heads/foo
1190+
'
1191+
11751192
test_done

0 commit comments

Comments
 (0)