Commit 5707d2c
authored
[2.51.0 Bug] Missing singleton objects in 'git repack -adf --path-walk' (#796)
This is a port of gitgitgadget#1956, and I
deem it one of the blockers against making a full release of Microsoft
Git v2.51. Here is what Stolee wrote in the cover letter:
Now that the `--path-walk` feature for `git repack` is out in the wild
and getting more visibility than it did in the Git for Windows fork, the
following issue was brought to my attention:
Some folks would report missing objects after `git repack -adf
--path-walk`!
It turns out that this snuck through the cracks because it was pretty
difficult to create a reproducing test case (patch 1) but it boils down
to:
1. A path has exactly one version across all of the history being
repacked.
2. That path is in the index.
3. The object at that path is not a loose object.
4. pack.useSparse=true in the config (this is the default)
It is also something where users don't necessarily notice the missing
objects until they fetch and a missing object is used as a delta base.
Doing normal checkouts doesn't cause changes to these files, so they are
never opened by Git. Users hitting this issue can usually recover using
`git fetch --refetch` to repopulate the missing objects from a remote
(unless they never had a remote at all).
Patch 1 introduces the fix for this issue, which is related to
forgetting to initialize a struct indicator when walking the pending
objects.
When reflecting on the ways that I missed this when building the
feature, I think the core issue was an overreliance on using bare repos
in testing. I also think that the way that the UNINTERESTING object
exploration was implemented was particularly fragile to missing updates
to the initialization of the struct, so patch 2 adds a new initializer
to reduce duplicate code and to help avoid this mistake in the future.2 files changed
+88
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
108 | 126 | | |
109 | 127 | | |
110 | 128 | | |
| |||
129 | 147 | | |
130 | 148 | | |
131 | 149 | | |
132 | | - | |
133 | 150 | | |
134 | 151 | | |
135 | 152 | | |
| |||
190 | 207 | | |
191 | 208 | | |
192 | 209 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 210 | + | |
| 211 | + | |
202 | 212 | | |
203 | | - | |
| 213 | + | |
204 | 214 | | |
205 | 215 | | |
206 | 216 | | |
| |||
377 | 387 | | |
378 | 388 | | |
379 | 389 | | |
380 | | - | |
381 | 390 | | |
382 | 391 | | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 392 | + | |
389 | 393 | | |
390 | 394 | | |
391 | 395 | | |
| |||
396 | 400 | | |
397 | 401 | | |
398 | 402 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
410 | 406 | | |
411 | | - | |
412 | 407 | | |
413 | 408 | | |
414 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
841 | 904 | | |
0 commit comments