summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 960bba0)
raw | patch | inline | side by side (parent: 960bba0)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Sun, 3 Jul 2005 20:08:40 +0000 (13:08 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Sun, 3 Jul 2005 20:08:40 +0000 (13:08 -0700) |
It won't add an object that is already in a pack to the new pack.
pack-objects.c | patch | blob | history |
diff --git a/pack-objects.c b/pack-objects.c
index d95f45ebfefc6f696d57b5273ea3f049d4f1ffd2..780418dcec524fa294064e26a8403d4411cced62 100644 (file)
--- a/pack-objects.c
+++ b/pack-objects.c
#include "pack.h"
#include "csum-file.h"
-static const char pack_usage[] = "git-pack-objects [--window=N] [--depth=N] {--stdout | base-name} < object-list";
+static const char pack_usage[] = "git-pack-objects [--incremental] [--window=N] [--depth=N] {--stdout | base-name} < object-list";
struct object_entry {
unsigned char sha1[20];
struct object_entry *delta;
};
+static int incremental = 0;
static struct object_entry **sorted_by_sha, **sorted_by_type;
static struct object_entry *objects = NULL;
static int nr_objects = 0, nr_alloc = 0;
unsigned int idx = nr_objects;
struct object_entry *entry;
+ if (incremental && has_sha1_pack(sha1))
+ return;
+
if (idx >= nr_alloc) {
unsigned int needed = (idx + 1024) * 3 / 2;
objects = xrealloc(objects, needed * sizeof(*entry));
const char *arg = argv[i];
if (*arg == '-') {
+ if (!strcmp("--incremental", arg)) {
+ incremental = 1;
+ continue;
+ }
if (!strncmp("--window=", arg, 9)) {
char *end;
window = strtoul(arg+9, &end, 0);