@@ -450,6 +450,8 @@ struct gh__request_params {
450
450
struct progress * progress ;
451
451
452
452
struct strbuf e2eid ;
453
+
454
+ struct string_list * result_list ; /* we do not own this */
453
455
};
454
456
455
457
#define GH__REQUEST_PARAMS_INIT { \
@@ -478,6 +480,7 @@ struct gh__request_params {
478
480
.progress_msg = STRBUF_INIT, \
479
481
.progress = NULL, \
480
482
.e2eid = STRBUF_INIT, \
483
+ .result_list = NULL, \
481
484
}
482
485
483
486
static void gh__request_params__release (struct gh__request_params * params )
@@ -510,6 +513,8 @@ static void gh__request_params__release(struct gh__request_params *params)
510
513
params -> progress = NULL ;
511
514
512
515
strbuf_release (& params -> e2eid );
516
+
517
+ params -> result_list = NULL ; /* we do not own this */
513
518
}
514
519
515
520
/*
@@ -1870,6 +1875,16 @@ static void install_packfile(struct gh__request_params *params,
1870
1875
goto cleanup ;
1871
1876
}
1872
1877
1878
+
1879
+ if (params -> result_list ) {
1880
+ struct strbuf result_msg = STRBUF_INIT ;
1881
+
1882
+ strbuf_addf (& result_msg , "packfile %s" ,
1883
+ params -> final_packfile_filename .buf );
1884
+ string_list_append (params -> result_list , result_msg .buf );
1885
+ strbuf_release (& result_msg );
1886
+ }
1887
+
1873
1888
cleanup :
1874
1889
child_process_clear (& ip );
1875
1890
}
@@ -1926,8 +1941,19 @@ static void install_loose(struct gh__request_params *params,
1926
1941
"could not install loose object '%s'" ,
1927
1942
params -> loose_path .buf );
1928
1943
status -> ec = GH__ERROR_CODE__COULD_NOT_INSTALL_LOOSE ;
1944
+ goto cleanup ;
1945
+ }
1946
+
1947
+ if (params -> result_list ) {
1948
+ struct strbuf result_msg = STRBUF_INIT ;
1949
+
1950
+ strbuf_addf (& result_msg , "loose %s" ,
1951
+ oid_to_hex (& params -> loose_oid ));
1952
+ string_list_append (params -> result_list , result_msg .buf );
1953
+ strbuf_release (& result_msg );
1929
1954
}
1930
1955
1956
+ cleanup :
1931
1957
strbuf_release (& tmp_path );
1932
1958
}
1933
1959
@@ -2583,7 +2609,7 @@ static void setup_gvfs_objects_progress(struct gh__request_params *params,
2583
2609
if (!gh__cmd_opts .show_progress )
2584
2610
return ;
2585
2611
2586
- if (params -> b_is_post && params -> object_count > 1 ) {
2612
+ if (params -> b_is_post ) {
2587
2613
strbuf_addf (& params -> progress_base_phase3_msg ,
2588
2614
"Receiving packfile %ld/%ld with %ld objects" ,
2589
2615
num , den , params -> object_count );
@@ -2615,6 +2641,8 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2615
2641
2616
2642
params .object_count = 1 ;
2617
2643
2644
+ params .result_list = result_list ;
2645
+
2618
2646
params .headers = http_copy_default_headers ();
2619
2647
params .headers = curl_slist_append (params .headers ,
2620
2648
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2627,16 +2655,6 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2627
2655
2628
2656
do_req__with_fallback (component_url .buf , & params , status );
2629
2657
2630
- if (status -> ec == GH__ERROR_CODE__OK ) {
2631
- struct strbuf msg = STRBUF_INIT ;
2632
-
2633
- strbuf_addf (& msg , "loose %s" ,
2634
- oid_to_hex (& params .loose_oid ));
2635
-
2636
- string_list_append (result_list , msg .buf );
2637
- strbuf_release (& msg );
2638
- }
2639
-
2640
2658
gh__request_params__release (& params );
2641
2659
strbuf_release (& component_url );
2642
2660
}
@@ -2648,7 +2666,7 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2648
2666
* consumed (along with the filename of the resulting packfile).
2649
2667
*
2650
2668
* However, if we only have 1 oid (remaining) in the OIDSET, the
2651
- * server will respond to our POST with a loose object rather than
2669
+ * server *MAY* respond to our POST with a loose object rather than
2652
2670
* a packfile with 1 object.
2653
2671
*
2654
2672
* Append a message to the result_list describing the result.
@@ -2679,6 +2697,8 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2679
2697
2680
2698
params .post_payload = & jw_req .json ;
2681
2699
2700
+ params .result_list = result_list ;
2701
+
2682
2702
params .headers = http_copy_default_headers ();
2683
2703
params .headers = curl_slist_append (params .headers ,
2684
2704
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2706,20 +2726,6 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2706
2726
2707
2727
do_req__with_fallback ("gvfs/objects" , & params , status );
2708
2728
2709
- if (status -> ec == GH__ERROR_CODE__OK ) {
2710
- struct strbuf msg = STRBUF_INIT ;
2711
-
2712
- if (params .object_count > 1 )
2713
- strbuf_addf (& msg , "packfile %s" ,
2714
- params .final_packfile_filename .buf );
2715
- else
2716
- strbuf_addf (& msg , "loose %s" ,
2717
- oid_to_hex (& params .loose_oid ));
2718
-
2719
- string_list_append (result_list , msg .buf );
2720
- strbuf_release (& msg );
2721
- }
2722
-
2723
2729
gh__request_params__release (& params );
2724
2730
jw_release (& jw_req );
2725
2731
}
0 commit comments