Skip to content

Commit cba595a

Browse files
committed
Merge branch 'jk/loose-object-cache-oid'
Code clean-up. * jk/loose-object-cache-oid: prefer "hash mismatch" to "sha1 mismatch" sha1-file: avoid "sha1 file" for generic use in messages sha1-file: prefer "loose object file" to "sha1 file" in messages sha1-file: drop has_sha1_file() convert has_sha1_file() callers to has_object_file() sha1-file: convert pass-through functions to object_id sha1-file: modernize loose header/stream functions sha1-file: modernize loose object file functions http: use struct object_id instead of bare sha1 update comment references to sha1_object_info() sha1-file: fix outdated sha1 comment references
2 parents 96e6547 + 01f8d59 commit cba595a

22 files changed

+159
-183
lines changed

Documentation/git-fsck.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ dangling <type> <object>::
140140
The <type> object <object>, is present in the database but never
141141
'directly' used. A dangling commit could be a root node.
142142

143-
sha1 mismatch <object>::
144-
The database has an object who's sha1 doesn't match the
145-
database value.
143+
hash mismatch <object>::
144+
The database has an object whose hash doesn't match the
145+
object database value.
146146
This indicates a serious data integrity problem.
147147

148148
Environment Variables

apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3182,7 +3182,7 @@ static int apply_binary(struct apply_state *state,
31823182
return 0; /* deletion patch */
31833183
}
31843184

3185-
if (has_sha1_file(oid.hash)) {
3185+
if (has_object_file(&oid)) {
31863186
/* We already have the postimage */
31873187
enum object_type type;
31883188
unsigned long size;

builtin/cat-file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,14 @@ struct expand_data {
211211

212212
/*
213213
* After a mark_query run, this object_info is set up to be
214-
* passed to sha1_object_info_extended. It will point to the data
214+
* passed to oid_object_info_extended. It will point to the data
215215
* elements above, so you can retrieve the response from there.
216216
*/
217217
struct object_info info;
218218

219219
/*
220220
* This flag will be true if the requested batch format and options
221-
* don't require us to call sha1_object_info, which can then be
221+
* don't require us to call oid_object_info, which can then be
222222
* optimized out.
223223
*/
224224
unsigned skip_object_info : 1;
@@ -496,7 +496,7 @@ static int batch_objects(struct batch_options *opt)
496496

497497
/*
498498
* Expand once with our special mark_query flag, which will prime the
499-
* object_info to be handed to sha1_object_info_extended for each
499+
* object_info to be handed to oid_object_info_extended for each
500500
* object.
501501
*/
502502
memset(&data, 0, sizeof(data));

builtin/fetch.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,7 @@ static void find_non_local_tags(const struct ref *refs,
317317
!has_object_file_with_flags(&ref->old_oid,
318318
OBJECT_INFO_QUICK) &&
319319
!will_fetch(head, ref->old_oid.hash) &&
320-
!has_sha1_file_with_flags(item->oid.hash,
321-
OBJECT_INFO_QUICK) &&
320+
!has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) &&
322321
!will_fetch(head, item->oid.hash))
323322
oidclr(&item->oid);
324323
item = NULL;
@@ -332,7 +331,7 @@ static void find_non_local_tags(const struct ref *refs,
332331
* fetch.
333332
*/
334333
if (item &&
335-
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
334+
!has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) &&
336335
!will_fetch(head, item->oid.hash))
337336
oidclr(&item->oid);
338337

@@ -353,7 +352,7 @@ static void find_non_local_tags(const struct ref *refs,
353352
* checked to see if it needs fetching.
354353
*/
355354
if (item &&
356-
!has_sha1_file_with_flags(item->oid.hash, OBJECT_INFO_QUICK) &&
355+
!has_object_file_with_flags(&item->oid, OBJECT_INFO_QUICK) &&
357356
!will_fetch(head, item->oid.hash))
358357
oidclr(&item->oid);
359358

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
772772
if (startup_info->have_repository) {
773773
read_lock();
774774
collision_test_needed =
775-
has_sha1_file_with_flags(oid->hash, OBJECT_INFO_QUICK);
775+
has_object_file_with_flags(oid, OBJECT_INFO_QUICK);
776776
read_unlock();
777777
}
778778

builtin/pack-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ static void check_object(struct object_entry *entry)
16431643

16441644
/*
16451645
* No choice but to fall back to the recursive delta walk
1646-
* with sha1_object_info() to find about the object type
1646+
* with oid_object_info() to find about the object type
16471647
* at this point...
16481648
*/
16491649
give_up:
@@ -1719,7 +1719,7 @@ static void drop_reused_delta(struct object_entry *entry)
17191719
if (packed_object_info(the_repository, IN_PACK(entry), entry->in_pack_offset, &oi) < 0) {
17201720
/*
17211721
* We failed to get the info from this pack for some reason;
1722-
* fall back to sha1_object_info, which may find another copy.
1722+
* fall back to oid_object_info, which may find another copy.
17231723
* And if that fails, the error will be recorded in oe_type(entry)
17241724
* and dealt with in prepare_pack().
17251725
*/

builtin/reflog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int tree_is_complete(const struct object_id *oid)
9494
init_tree_desc(&desc, tree->buffer, tree->size);
9595
complete = 1;
9696
while (tree_entry(&desc, &entry)) {
97-
if (!has_sha1_file(entry.oid.hash) ||
97+
if (!has_object_file(&entry.oid) ||
9898
(S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {
9999
tree->object.flags |= INCOMPLETE;
100100
complete = 0;

builtin/show-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void show_one(const char *refname, const struct object_id *oid)
2323
const char *hex;
2424
struct object_id peeled;
2525

26-
if (!has_sha1_file(oid->hash))
26+
if (!has_object_file(oid))
2727
die("git show-ref: bad ref %s (%s)", refname,
2828
oid_to_hex(oid));
2929

bulk-checkin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static int already_written(struct bulk_checkin_state *state, struct object_id *o
6767
int i;
6868

6969
/* The object may already exist in the repository */
70-
if (has_sha1_file(oid->hash))
70+
if (has_object_file(oid))
7171
return 1;
7272

7373
/* Might want to keep the list sorted */

cache-tree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ int cache_tree_fully_valid(struct cache_tree *it)
225225
int i;
226226
if (!it)
227227
return 0;
228-
if (it->entry_count < 0 || !has_sha1_file(it->oid.hash))
228+
if (it->entry_count < 0 || !has_object_file(&it->oid))
229229
return 0;
230230
for (i = 0; i < it->subtree_nr; i++) {
231231
if (!cache_tree_fully_valid(it->down[i]->cache_tree))
@@ -253,7 +253,7 @@ static int update_one(struct cache_tree *it,
253253

254254
*skip_count = 0;
255255

256-
if (0 <= it->entry_count && has_sha1_file(it->oid.hash))
256+
if (0 <= it->entry_count && has_object_file(&it->oid))
257257
return it->entry_count;
258258

259259
/*

0 commit comments

Comments
 (0)