Merge commit
223518fefd8f5c35a97b70a8bf53a11b30109537
Merge branch 'tn/fetch-pack-trace-packfile-uri'
The process of downloading packfile URIs in protocol v2 has been instrumented with a Trace2 region. This visibility allows tracking the cumulative time spent downloading external packs and the number of advertised URIs without emitting a separate event per pack. * tn/fetch-pack-trace-packfile-uri: fetch-pack: trace packfile URI downloads
Junio C Hamano <gitster@pobox.com> · 2026-09-14 04:53 UTC
Combined diff: only what this merge did beyond taking one side. Added lines are colored by the parent they came from; bold lines came from none of them; removed lines are red.
1 file changed,
+19
−5
modified fetch-pack.c
| @@@ -1853,11 -1886,17 +1853,18 @@@ static struct ref *do_fetch_pack_v2(str | ||
| 1853 | } | |
| 1854 | } | |
| 1855 | ||
| 1856 | + | if (packfile_uris.nr) { |
| 1857 | + | trace2_region_enter("fetch-pack", "packfile-uris", |
| 1858 | + | the_repository); |
| 1859 | + | trace2_data_intmax("fetch-pack", the_repository, |
| 1860 | + | "packfile-uris/count", packfile_uris.nr); |
| 1861 | + | } |
| 1862 | + | |
| 1863 | for (i = 0; i < packfile_uris.nr; i++) { | |
| 1864 | + | bool created_keep; |
| 1865 | int j; | |
| 1866 | struct child_process cmd = CHILD_PROCESS_INIT; | |
| - | char packname[GIT_MAX_HEXSZ + 1]; | |
| 1867 | + | char packhash[GIT_MAX_HEXSZ + 1]; |
| 1868 | const char *uri = packfile_uris.items[i].string + | |
| 1869 | the_hash_algo->hexsz + 1; | |
| 1870 | ||
| @@@ -1900,12 -1938,16 +1907,17 @@@ | ||
| 1907 | uri, (int) the_hash_algo->hexsz, | |
| 1908 | packfile_uris.items[i].string); | |
| 1909 | ||
| - | string_list_append_nodup(pack_lockfiles, | |
| - | xstrfmt("%s/pack/pack-%s.keep", | |
| - | repo_get_object_directory(the_repository), | |
| - | packname)); | |
| 1910 | + | if (created_keep) |
| 1911 | + | string_list_append_nodup(pack_lockfiles, |
| 1912 | + | xstrfmt("%s/pack/pack-%s.keep", |
| 1913 | + | repo_get_object_directory(the_repository), |
| 1914 | + | packhash)); |
| 1915 | } | |
| 1916 | + | |
| 1917 | + | if (packfile_uris.nr) |
| 1918 | + | trace2_region_leave("fetch-pack", "packfile-uris", |
| 1919 | + | the_repository); |
| 1920 | + | |
| 1921 | string_list_clear(&packfile_uris, 0); | |
| 1922 | strvec_clear(&index_pack_args); | |
| 1923 | ||