99#include "argv-array.h"
1010
1111static int delta_base_offset = 1 ;
12+ static int pack_kept_objects = -1 ;
1213static char * packdir , * packtmp ;
1314
1415static const char * const git_repack_usage [] = {
@@ -22,6 +23,10 @@ static int repack_config(const char *var, const char *value, void *cb)
2223 delta_base_offset = git_config_bool (var , value );
2324 return 0 ;
2425 }
26+ if (!strcmp (var , "repack.packkeptobjects" )) {
27+ pack_kept_objects = git_config_bool (var , value );
28+ return 0 ;
29+ }
2530 return git_default_config (var , value , cb );
2631}
2732
@@ -175,6 +180,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
175180 N_ ("limits the maximum delta depth" )),
176181 OPT_STRING (0 , "max-pack-size" , & max_pack_size , N_ ("bytes" ),
177182 N_ ("maximum size of each packfile" )),
183+ OPT_BOOL (0 , "pack-kept-objects" , & pack_kept_objects ,
184+ N_ ("repack objects in packs marked with .keep" )),
178185 OPT_END ()
179186 };
180187
@@ -183,14 +190,18 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
183190 argc = parse_options (argc , argv , prefix , builtin_repack_options ,
184191 git_repack_usage , 0 );
185192
193+ if (pack_kept_objects < 0 )
194+ pack_kept_objects = write_bitmap ;
195+
186196 packdir = mkpathdup ("%s/pack" , get_object_directory ());
187197 packtmp = mkpathdup ("%s/.tmp-%d-pack" , packdir , (int )getpid ());
188198
189199 sigchain_push_common (remove_pack_on_signal );
190200
191201 argv_array_push (& cmd_args , "pack-objects" );
192202 argv_array_push (& cmd_args , "--keep-true-parents" );
193- argv_array_push (& cmd_args , "--honor-pack-keep" );
203+ if (!pack_kept_objects )
204+ argv_array_push (& cmd_args , "--honor-pack-keep" );
194205 argv_array_push (& cmd_args , "--non-empty" );
195206 argv_array_push (& cmd_args , "--all" );
196207 argv_array_push (& cmd_args , "--reflog" );
0 commit comments