Revert "send-pack --keep: do not explode into loose objects on the receiving end."
This reverts commit c7740a943e
. There should
be a way to make this controllable from the receiver end.
This commit is contained in:
parent
5ca807842f
commit
4508dde169
@ -8,14 +8,10 @@
|
|||||||
static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
|
static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
|
||||||
|
|
||||||
static const char *unpacker[] = { "unpack-objects", NULL };
|
static const char *unpacker[] = { "unpack-objects", NULL };
|
||||||
static const char *keep_packer[] = {
|
|
||||||
"index-pack", "--stdin", "--fix-thin", NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static int report_status;
|
static int report_status;
|
||||||
static int keep_pack;
|
|
||||||
|
|
||||||
static char capabilities[] = "report-status keep-pack";
|
static char capabilities[] = "report-status";
|
||||||
static int capabilities_sent;
|
static int capabilities_sent;
|
||||||
|
|
||||||
static int show_ref(const char *path, const unsigned char *sha1)
|
static int show_ref(const char *path, const unsigned char *sha1)
|
||||||
@ -265,8 +261,6 @@ static void read_head_info(void)
|
|||||||
if (reflen + 82 < len) {
|
if (reflen + 82 < len) {
|
||||||
if (strstr(refname + reflen + 1, "report-status"))
|
if (strstr(refname + reflen + 1, "report-status"))
|
||||||
report_status = 1;
|
report_status = 1;
|
||||||
if (strstr(refname + reflen + 1, "keep-pack"))
|
|
||||||
keep_pack = 1;
|
|
||||||
}
|
}
|
||||||
cmd = xmalloc(sizeof(struct command) + len - 80);
|
cmd = xmalloc(sizeof(struct command) + len - 80);
|
||||||
hashcpy(cmd->old_sha1, old_sha1);
|
hashcpy(cmd->old_sha1, old_sha1);
|
||||||
@ -281,14 +275,7 @@ static void read_head_info(void)
|
|||||||
|
|
||||||
static const char *unpack(int *error_code)
|
static const char *unpack(int *error_code)
|
||||||
{
|
{
|
||||||
int code;
|
int code = run_command_v_opt(1, unpacker, RUN_GIT_CMD);
|
||||||
|
|
||||||
if (keep_pack)
|
|
||||||
code = run_command_v_opt(ARRAY_SIZE(keep_packer) - 1,
|
|
||||||
keep_packer, RUN_GIT_CMD);
|
|
||||||
else
|
|
||||||
code = run_command_v_opt(ARRAY_SIZE(unpacker) - 1,
|
|
||||||
unpacker, RUN_GIT_CMD);
|
|
||||||
|
|
||||||
*error_code = 0;
|
*error_code = 0;
|
||||||
switch (code) {
|
switch (code) {
|
||||||
|
23
send-pack.c
23
send-pack.c
@ -6,14 +6,13 @@
|
|||||||
#include "exec_cmd.h"
|
#include "exec_cmd.h"
|
||||||
|
|
||||||
static const char send_pack_usage[] =
|
static const char send_pack_usage[] =
|
||||||
"git-send-pack [--all] [--keep] [--exec=git-receive-pack] <remote> [<head>...]\n"
|
"git-send-pack [--all] [--exec=git-receive-pack] <remote> [<head>...]\n"
|
||||||
" --all and explicit <head> specification are mutually exclusive.";
|
" --all and explicit <head> specification are mutually exclusive.";
|
||||||
static const char *exec = "git-receive-pack";
|
static const char *exec = "git-receive-pack";
|
||||||
static int verbose;
|
static int verbose;
|
||||||
static int send_all;
|
static int send_all;
|
||||||
static int force_update;
|
static int force_update;
|
||||||
static int use_thin_pack;
|
static int use_thin_pack;
|
||||||
static int keep_pack;
|
|
||||||
|
|
||||||
static int is_zero_sha1(const unsigned char *sha1)
|
static int is_zero_sha1(const unsigned char *sha1)
|
||||||
{
|
{
|
||||||
@ -271,7 +270,6 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
|
|||||||
int new_refs;
|
int new_refs;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int ask_for_status_report = 0;
|
int ask_for_status_report = 0;
|
||||||
int ask_to_keep_pack = 0;
|
|
||||||
int expect_status_report = 0;
|
int expect_status_report = 0;
|
||||||
|
|
||||||
/* No funny business with the matcher */
|
/* No funny business with the matcher */
|
||||||
@ -281,8 +279,6 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
|
|||||||
/* Does the other end support the reporting? */
|
/* Does the other end support the reporting? */
|
||||||
if (server_supports("report-status"))
|
if (server_supports("report-status"))
|
||||||
ask_for_status_report = 1;
|
ask_for_status_report = 1;
|
||||||
if (server_supports("keep-pack") && keep_pack)
|
|
||||||
ask_to_keep_pack = 1;
|
|
||||||
|
|
||||||
/* match them up */
|
/* match them up */
|
||||||
if (!remote_tail)
|
if (!remote_tail)
|
||||||
@ -359,17 +355,12 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
|
|||||||
strcpy(old_hex, sha1_to_hex(ref->old_sha1));
|
strcpy(old_hex, sha1_to_hex(ref->old_sha1));
|
||||||
new_hex = sha1_to_hex(ref->new_sha1);
|
new_hex = sha1_to_hex(ref->new_sha1);
|
||||||
|
|
||||||
if (ask_for_status_report || ask_to_keep_pack) {
|
if (ask_for_status_report) {
|
||||||
packet_write(out, "%s %s %s%c%s%s",
|
packet_write(out, "%s %s %s%c%s",
|
||||||
old_hex, new_hex, ref->name, 0,
|
old_hex, new_hex, ref->name, 0,
|
||||||
ask_for_status_report
|
"report-status");
|
||||||
? " report-status" : "",
|
|
||||||
ask_to_keep_pack
|
|
||||||
? " keep-pack" : "");
|
|
||||||
if (ask_for_status_report)
|
|
||||||
expect_status_report = 1;
|
|
||||||
ask_for_status_report = 0;
|
ask_for_status_report = 0;
|
||||||
ask_to_keep_pack = 0;
|
expect_status_report = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
packet_write(out, "%s %s %s",
|
packet_write(out, "%s %s %s",
|
||||||
@ -428,10 +419,6 @@ int main(int argc, char **argv)
|
|||||||
verbose = 1;
|
verbose = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--keep")) {
|
|
||||||
keep_pack = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp(arg, "--thin")) {
|
if (!strcmp(arg, "--thin")) {
|
||||||
use_thin_pack = 1;
|
use_thin_pack = 1;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1757,10 +1757,7 @@ int has_sha1_file(const unsigned char *sha1)
|
|||||||
|
|
||||||
if (find_pack_entry(sha1, &e, NULL))
|
if (find_pack_entry(sha1, &e, NULL))
|
||||||
return 1;
|
return 1;
|
||||||
if (find_sha1_file(sha1, &st))
|
return find_sha1_file(sha1, &st) ? 1 : 0;
|
||||||
return 1;
|
|
||||||
reprepare_packed_git();
|
|
||||||
return find_pack_entry(sha1, &e, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -78,13 +78,4 @@ test_expect_success \
|
|||||||
! diff -u .git/refs/heads/master victim/.git/refs/heads/master
|
! diff -u .git/refs/heads/master victim/.git/refs/heads/master
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'push with --keep' '
|
|
||||||
t=`cd victim && git-rev-parse --verify refs/heads/master` &&
|
|
||||||
git-update-ref refs/heads/master $t &&
|
|
||||||
: > foo &&
|
|
||||||
git add foo &&
|
|
||||||
git commit -m "one more" &&
|
|
||||||
git-send-pack --keep ./victim/.git/ master
|
|
||||||
'
|
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user