Commit eac58de
object-name: backend-generic
The function `get_short_oid()` takes as input an abbreviated object ID
and tries to turn that object ID into the full object ID. This is done
by iterating through all objects that have the user-provided prefix. If
that yields exactly one object we know that the abbreviated object ID is
unambiguous, otherwise it is ambiguous and we print the list of objects
that match the prefix.
We iterate through all objects with the given prefix by calling both
`find_short_packed_object()` and `find_short_object_filename()`, which
is of course specific to the "files" backend. But we now have a generic
way to iterate through objects with a specific prefix.
Refactor the code to use `odb_for_each_object()` instead so that it
works with object backends different than the "files" backend.
Remove the now-unused `find_short_packed_object()` function.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>get_short_oid()
1 parent d2612fe commit eac58de
1 file changed
Lines changed: 6 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | 123 | | |
146 | 124 | | |
147 | 125 | | |
| |||
499 | 477 | | |
500 | 478 | | |
501 | 479 | | |
| 480 | + | |
502 | 481 | | |
503 | 482 | | |
504 | 483 | | |
| |||
526 | 505 | | |
527 | 506 | | |
528 | 507 | | |
529 | | - | |
530 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
531 | 512 | | |
532 | 513 | | |
533 | 514 | | |
| |||
537 | 518 | | |
538 | 519 | | |
539 | 520 | | |
540 | | - | |
541 | | - | |
| 521 | + | |
542 | 522 | | |
543 | 523 | | |
544 | 524 | | |
| |||
0 commit comments