@@ -451,6 +451,8 @@ struct gh__request_params {
451
451
struct progress * progress ;
452
452
453
453
struct strbuf e2eid ;
454
+
455
+ struct string_list * result_list ; /* we do not own this */
454
456
};
455
457
456
458
#define GH__REQUEST_PARAMS_INIT { \
@@ -479,6 +481,7 @@ struct gh__request_params {
479
481
.progress_msg = STRBUF_INIT, \
480
482
.progress = NULL, \
481
483
.e2eid = STRBUF_INIT, \
484
+ .result_list = NULL, \
482
485
}
483
486
484
487
static void gh__request_params__release (struct gh__request_params * params )
@@ -511,6 +514,8 @@ static void gh__request_params__release(struct gh__request_params *params)
511
514
params -> progress = NULL ;
512
515
513
516
strbuf_release (& params -> e2eid );
517
+
518
+ params -> result_list = NULL ; /* we do not own this */
514
519
}
515
520
516
521
/*
@@ -1871,6 +1876,16 @@ static void install_packfile(struct gh__request_params *params,
1871
1876
goto cleanup ;
1872
1877
}
1873
1878
1879
+
1880
+ if (params -> result_list ) {
1881
+ struct strbuf result_msg = STRBUF_INIT ;
1882
+
1883
+ strbuf_addf (& result_msg , "packfile %s" ,
1884
+ params -> final_packfile_filename .buf );
1885
+ string_list_append (params -> result_list , result_msg .buf );
1886
+ strbuf_release (& result_msg );
1887
+ }
1888
+
1874
1889
cleanup :
1875
1890
child_process_clear (& ip );
1876
1891
}
@@ -1927,8 +1942,19 @@ static void install_loose(struct gh__request_params *params,
1927
1942
"could not install loose object '%s'" ,
1928
1943
params -> loose_path .buf );
1929
1944
status -> ec = GH__ERROR_CODE__COULD_NOT_INSTALL_LOOSE ;
1945
+ goto cleanup ;
1946
+ }
1947
+
1948
+ if (params -> result_list ) {
1949
+ struct strbuf result_msg = STRBUF_INIT ;
1950
+
1951
+ strbuf_addf (& result_msg , "loose %s" ,
1952
+ oid_to_hex (& params -> loose_oid ));
1953
+ string_list_append (params -> result_list , result_msg .buf );
1954
+ strbuf_release (& result_msg );
1930
1955
}
1931
1956
1957
+ cleanup :
1932
1958
strbuf_release (& tmp_path );
1933
1959
}
1934
1960
@@ -2597,7 +2623,7 @@ static void setup_gvfs_objects_progress(struct gh__request_params *params,
2597
2623
if (!gh__cmd_opts .show_progress )
2598
2624
return ;
2599
2625
2600
- if (params -> b_is_post && params -> object_count > 1 ) {
2626
+ if (params -> b_is_post ) {
2601
2627
strbuf_addf (& params -> progress_base_phase3_msg ,
2602
2628
"Receiving packfile %ld/%ld with %ld objects" ,
2603
2629
num , den , params -> object_count );
@@ -2629,6 +2655,8 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2629
2655
2630
2656
params .object_count = 1 ;
2631
2657
2658
+ params .result_list = result_list ;
2659
+
2632
2660
params .headers = http_copy_default_headers ();
2633
2661
params .headers = curl_slist_append (params .headers ,
2634
2662
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2641,16 +2669,6 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2641
2669
2642
2670
do_req__with_fallback (component_url .buf , & params , status );
2643
2671
2644
- if (status -> ec == GH__ERROR_CODE__OK ) {
2645
- struct strbuf msg = STRBUF_INIT ;
2646
-
2647
- strbuf_addf (& msg , "loose %s" ,
2648
- oid_to_hex (& params .loose_oid ));
2649
-
2650
- string_list_append (result_list , msg .buf );
2651
- strbuf_release (& msg );
2652
- }
2653
-
2654
2672
gh__request_params__release (& params );
2655
2673
strbuf_release (& component_url );
2656
2674
}
@@ -2662,7 +2680,7 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2662
2680
* consumed (along with the filename of the resulting packfile).
2663
2681
*
2664
2682
* However, if we only have 1 oid (remaining) in the OIDSET, the
2665
- * server will respond to our POST with a loose object rather than
2683
+ * server *MAY* respond to our POST with a loose object rather than
2666
2684
* a packfile with 1 object.
2667
2685
*
2668
2686
* Append a message to the result_list describing the result.
@@ -2693,6 +2711,8 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2693
2711
2694
2712
params .post_payload = & jw_req .json ;
2695
2713
2714
+ params .result_list = result_list ;
2715
+
2696
2716
params .headers = http_copy_default_headers ();
2697
2717
params .headers = curl_slist_append (params .headers ,
2698
2718
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2720,20 +2740,6 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2720
2740
2721
2741
do_req__with_fallback ("gvfs/objects" , & params , status );
2722
2742
2723
- if (status -> ec == GH__ERROR_CODE__OK ) {
2724
- struct strbuf msg = STRBUF_INIT ;
2725
-
2726
- if (params .object_count > 1 )
2727
- strbuf_addf (& msg , "packfile %s" ,
2728
- params .final_packfile_filename .buf );
2729
- else
2730
- strbuf_addf (& msg , "loose %s" ,
2731
- oid_to_hex (& params .loose_oid ));
2732
-
2733
- string_list_append (result_list , msg .buf );
2734
- strbuf_release (& msg );
2735
- }
2736
-
2737
2743
gh__request_params__release (& params );
2738
2744
jw_release (& jw_req );
2739
2745
}
0 commit comments