6
#include "exec_cmd.h"
7
8
static const char send_pack_usage[] =
9
-"git-send-pack [--all] [--exec=git-receive-pack] <remote> [<head>...]\n"
9
+"git-send-pack [--all] [--keep] [--exec=git-receive-pack] <remote> [<head>...]\n"
10
" --all and explicit <head> specification are mutually exclusive.";
11
static const char *exec = "git-receive-pack";
12
static int verbose;
13
static int send_all;
14
static int force_update;
15
static int use_thin_pack;
16
+static int keep_pack;
17
18
static int is_zero_sha1(const unsigned char *sha1)
19
{
271
int new_refs;
272
int ret = 0;
273
int ask_for_status_report = 0;
274
+ int ask_to_keep_pack = 0;
275
int expect_status_report = 0;
276
277
/* No funny business with the matcher */
281
/* Does the other end support the reporting? */
282
if (server_supports("report-status"))
283
ask_for_status_report = 1;
284
+ if (server_supports("keep-pack") && keep_pack)
285
+ ask_to_keep_pack = 1;
286
287
/* match them up */
288
if (!remote_tail)
359
strcpy(old_hex, sha1_to_hex(ref->old_sha1));
360
new_hex = sha1_to_hex(ref->new_sha1);
361
358
- if (ask_for_status_report) {
359
- packet_write(out, "%s %s %s%c%s",
362
+ if (ask_for_status_report || ask_to_keep_pack) {
363
+ packet_write(out, "%s %s %s%c%s%s",
364
old_hex, new_hex, ref->name, 0,
361
- "report-status");
365
+ ask_for_status_report
366
+ ? " report-status" : "",
367
+ ask_to_keep_pack
368
+ ? " keep-pack" : "");
369
+ if (ask_for_status_report)
370
+ expect_status_report = 1;
371
ask_for_status_report = 0;
363
- expect_status_report = 1;
372
+ ask_to_keep_pack = 0;
373
}
374
else
375
packet_write(out, "%s %s %s",
428
verbose = 1;
429
continue;
430
}
431
+ if (!strcmp(arg, "--keep")) {
432
+ keep_pack = 1;
433
+ continue;
434
+ }
435
if (!strcmp(arg, "--thin")) {
436
use_thin_pack = 1;
437
continue;