Skip to content

Commit e96fb9b

Browse files
drafnelgitster
authored andcommitted
pack-objects: new option --honor-pack-keep
This adds a new option to pack-objects which will cause it to ignore an object which appears in a local pack which has a .keep file, even if it was specified for packing. This option will be used by the porcelain repack. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8d25931 commit e96fb9b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Documentation/git-pack-objects.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ base-name::
109109
The default is unlimited, unless the config variable
110110
`pack.packSizeLimit` is set.
111111

112+
--honor-pack-keep::
113+
This flag causes an object already in a local pack that
114+
has a .keep file to be ignored, even if it appears in the
115+
standard input.
116+
112117
--incremental::
113118
This flag causes an object already in a pack ignored
114119
even if it appears in the standard input.

builtin-pack-objects.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ static int reuse_delta = 1, reuse_object = 1;
7171
static int keep_unreachable, unpack_unreachable, include_tag;
7272
static int local;
7373
static int incremental;
74+
static int ignore_packed_keep;
7475
static int allow_ofs_delta;
7576
static const char *base_name;
7677
static int progress = 1;
@@ -703,6 +704,8 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
703704
return 0;
704705
if (local && !p->pack_local)
705706
return 0;
707+
if (ignore_packed_keep && p->pack_local && p->pack_keep)
708+
return 0;
706709
}
707710
}
708711

@@ -2042,6 +2045,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
20422045
incremental = 1;
20432046
continue;
20442047
}
2048+
if (!strcmp("--honor-pack-keep", arg)) {
2049+
ignore_packed_keep = 1;
2050+
continue;
2051+
}
20452052
if (!prefixcmp(arg, "--compression=")) {
20462053
char *end;
20472054
int level = strtoul(arg+14, &end, 0);

0 commit comments

Comments
 (0)