@@ -441,6 +441,8 @@ struct gh__request_params {
441
441
struct progress * progress ;
442
442
443
443
struct strbuf e2eid ;
444
+
445
+ struct string_list * result_list ; /* we do not own this */
444
446
};
445
447
446
448
#define GH__REQUEST_PARAMS_INIT { \
@@ -469,6 +471,7 @@ struct gh__request_params {
469
471
.progress_msg = STRBUF_INIT, \
470
472
.progress = NULL, \
471
473
.e2eid = STRBUF_INIT, \
474
+ .result_list = NULL, \
472
475
}
473
476
474
477
static void gh__request_params__release (struct gh__request_params * params )
@@ -501,6 +504,8 @@ static void gh__request_params__release(struct gh__request_params *params)
501
504
params -> progress = NULL ;
502
505
503
506
strbuf_release (& params -> e2eid );
507
+
508
+ params -> result_list = NULL ; /* we do not own this */
504
509
}
505
510
506
511
/*
@@ -1858,6 +1863,16 @@ static void install_packfile(struct gh__request_params *params,
1858
1863
goto cleanup ;
1859
1864
}
1860
1865
1866
+
1867
+ if (params -> result_list ) {
1868
+ struct strbuf result_msg = STRBUF_INIT ;
1869
+
1870
+ strbuf_addf (& result_msg , "packfile %s" ,
1871
+ params -> final_packfile_filename .buf );
1872
+ string_list_append (params -> result_list , result_msg .buf );
1873
+ strbuf_release (& result_msg );
1874
+ }
1875
+
1861
1876
cleanup :
1862
1877
child_process_clear (& ip );
1863
1878
}
@@ -1914,8 +1929,19 @@ static void install_loose(struct gh__request_params *params,
1914
1929
"could not install loose object '%s'" ,
1915
1930
params -> loose_path .buf );
1916
1931
status -> ec = GH__ERROR_CODE__COULD_NOT_INSTALL_LOOSE ;
1932
+ goto cleanup ;
1933
+ }
1934
+
1935
+ if (params -> result_list ) {
1936
+ struct strbuf result_msg = STRBUF_INIT ;
1937
+
1938
+ strbuf_addf (& result_msg , "loose %s" ,
1939
+ oid_to_hex (& params -> loose_oid ));
1940
+ string_list_append (params -> result_list , result_msg .buf );
1941
+ strbuf_release (& result_msg );
1917
1942
}
1918
1943
1944
+ cleanup :
1919
1945
strbuf_release (& tmp_path );
1920
1946
}
1921
1947
@@ -2534,7 +2560,7 @@ static void setup_gvfs_objects_progress(struct gh__request_params *params,
2534
2560
if (!gh__cmd_opts .show_progress )
2535
2561
return ;
2536
2562
2537
- if (params -> b_is_post && params -> object_count > 1 ) {
2563
+ if (params -> b_is_post ) {
2538
2564
strbuf_addf (& params -> progress_base_phase3_msg ,
2539
2565
"Receiving packfile %ld/%ld with %ld objects" ,
2540
2566
num , den , params -> object_count );
@@ -2566,6 +2592,8 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2566
2592
2567
2593
params .object_count = 1 ;
2568
2594
2595
+ params .result_list = result_list ;
2596
+
2569
2597
params .headers = http_copy_default_headers ();
2570
2598
params .headers = curl_slist_append (params .headers ,
2571
2599
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2578,16 +2606,6 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2578
2606
2579
2607
do_req__with_fallback (component_url .buf , & params , status );
2580
2608
2581
- if (status -> ec == GH__ERROR_CODE__OK ) {
2582
- struct strbuf msg = STRBUF_INIT ;
2583
-
2584
- strbuf_addf (& msg , "loose %s" ,
2585
- oid_to_hex (& params .loose_oid ));
2586
-
2587
- string_list_append (result_list , msg .buf );
2588
- strbuf_release (& msg );
2589
- }
2590
-
2591
2609
gh__request_params__release (& params );
2592
2610
strbuf_release (& component_url );
2593
2611
}
@@ -2599,7 +2617,7 @@ static void do__http_get__gvfs_object(struct gh__response_status *status,
2599
2617
* consumed (along with the filename of the resulting packfile).
2600
2618
*
2601
2619
* However, if we only have 1 oid (remaining) in the OIDSET, the
2602
- * server will respond to our POST with a loose object rather than
2620
+ * server *MAY* respond to our POST with a loose object rather than
2603
2621
* a packfile with 1 object.
2604
2622
*
2605
2623
* Append a message to the result_list describing the result.
@@ -2630,6 +2648,8 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2630
2648
2631
2649
params .post_payload = & jw_req .json ;
2632
2650
2651
+ params .result_list = result_list ;
2652
+
2633
2653
params .headers = http_copy_default_headers ();
2634
2654
params .headers = curl_slist_append (params .headers ,
2635
2655
"X-TFS-FedAuthRedirect: Suppress" );
@@ -2657,20 +2677,6 @@ static void do__http_post__gvfs_objects(struct gh__response_status *status,
2657
2677
2658
2678
do_req__with_fallback ("gvfs/objects" , & params , status );
2659
2679
2660
- if (status -> ec == GH__ERROR_CODE__OK ) {
2661
- struct strbuf msg = STRBUF_INIT ;
2662
-
2663
- if (params .object_count > 1 )
2664
- strbuf_addf (& msg , "packfile %s" ,
2665
- params .final_packfile_filename .buf );
2666
- else
2667
- strbuf_addf (& msg , "loose %s" ,
2668
- oid_to_hex (& params .loose_oid ));
2669
-
2670
- string_list_append (result_list , msg .buf );
2671
- strbuf_release (& msg );
2672
- }
2673
-
2674
2680
gh__request_params__release (& params );
2675
2681
jw_release (& jw_req );
2676
2682
}
0 commit comments