@@ -75,6 +75,8 @@ static int use_bitmap_index = -1;
7575static int write_bitmap_index ;
7676static uint16_t write_bitmap_options ;
7777
78+ static int exclude_promisor_objects ;
79+
7880static unsigned long delta_cache_size = 0 ;
7981static unsigned long max_delta_cache_size = 256 * 1024 * 1024 ;
8082static unsigned long cache_max_small_delta_size = 1000 ;
@@ -84,8 +86,9 @@ static unsigned long window_memory_limit = 0;
8486static struct list_objects_filter_options filter_options ;
8587
8688enum missing_action {
87- MA_ERROR = 0 , /* fail if any missing objects are encountered */
88- MA_ALLOW_ANY , /* silently allow ALL missing objects */
89+ MA_ERROR = 0 , /* fail if any missing objects are encountered */
90+ MA_ALLOW_ANY , /* silently allow ALL missing objects */
91+ MA_ALLOW_PROMISOR , /* silently allow all missing PROMISOR objects */
8992};
9093static enum missing_action arg_missing_action ;
9194static show_object_fn fn_show_object ;
@@ -2577,6 +2580,20 @@ static void show_object__ma_allow_any(struct object *obj, const char *name, void
25772580 show_object (obj , name , data );
25782581}
25792582
2583+ static void show_object__ma_allow_promisor (struct object * obj , const char * name , void * data )
2584+ {
2585+ assert (arg_missing_action == MA_ALLOW_PROMISOR );
2586+
2587+ /*
2588+ * Quietly ignore EXPECTED missing objects. This avoids problems with
2589+ * staging them now and getting an odd error later.
2590+ */
2591+ if (!has_object_file (& obj -> oid ) && is_promisor_object (& obj -> oid ))
2592+ return ;
2593+
2594+ show_object (obj , name , data );
2595+ }
2596+
25802597static int option_parse_missing_action (const struct option * opt ,
25812598 const char * arg , int unset )
25822599{
@@ -2591,10 +2608,18 @@ static int option_parse_missing_action(const struct option *opt,
25912608
25922609 if (!strcmp (arg , "allow-any" )) {
25932610 arg_missing_action = MA_ALLOW_ANY ;
2611+ fetch_if_missing = 0 ;
25942612 fn_show_object = show_object__ma_allow_any ;
25952613 return 0 ;
25962614 }
25972615
2616+ if (!strcmp (arg , "allow-promisor" )) {
2617+ arg_missing_action = MA_ALLOW_PROMISOR ;
2618+ fetch_if_missing = 0 ;
2619+ fn_show_object = show_object__ma_allow_promisor ;
2620+ return 0 ;
2621+ }
2622+
25982623 die (_ ("invalid value for --missing" ));
25992624 return 0 ;
26002625}
@@ -3008,6 +3033,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
30083033 { OPTION_CALLBACK , 0 , "missing" , NULL , N_ ("action" ),
30093034 N_ ("handling for missing objects" ), PARSE_OPT_NONEG ,
30103035 option_parse_missing_action },
3036+ OPT_BOOL (0 , "exclude-promisor-objects" , & exclude_promisor_objects ,
3037+ N_ ("do not pack objects in promisor packfiles" )),
30113038 OPT_END (),
30123039 };
30133040
@@ -3053,6 +3080,12 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
30533080 argv_array_push (& rp , "--unpacked" );
30543081 }
30553082
3083+ if (exclude_promisor_objects ) {
3084+ use_internal_rev_list = 1 ;
3085+ fetch_if_missing = 0 ;
3086+ argv_array_push (& rp , "--exclude-promisor-objects" );
3087+ }
3088+
30563089 if (!reuse_object )
30573090 reuse_delta = 0 ;
30583091 if (pack_compression_level == -1 )
0 commit comments