hash: provide per-algorithm null OIDs
Up until recently, object IDs did not have an algorithm member, only a hash. Consequently, it was possible to share one null (all-zeros) object ID among all hash algorithms. Now that we're going to be handling objects from multiple hash algorithms, it's important to make sure that all object IDs have a correct algorithm field. Introduce a per-algorithm null OID, and add it to struct hash_algo. Introduce a wrapper function as well, and use it everywhere we used to use the null_oid constant. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
5a6dce70d7
commit
14228447c9
@ -232,7 +232,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
ce_intent_to_add(ce)) {
|
||||
newmode = ce_mode_from_stat(ce, st.st_mode);
|
||||
diff_addremove(&revs->diffopt, '+', newmode,
|
||||
&null_oid, 0, ce->name, 0);
|
||||
null_oid(), 0, ce->name, 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
|
||||
}
|
||||
oldmode = ce->ce_mode;
|
||||
old_oid = &ce->oid;
|
||||
new_oid = changed ? &null_oid : &ce->oid;
|
||||
new_oid = changed ? null_oid() : &ce->oid;
|
||||
diff_change(&revs->diffopt, oldmode, newmode,
|
||||
old_oid, new_oid,
|
||||
!is_null_oid(old_oid),
|
||||
@ -307,7 +307,7 @@ static int get_stat_data(const struct index_state *istate,
|
||||
0, dirty_submodule);
|
||||
if (changed) {
|
||||
mode = ce_mode_from_stat(ce, st.st_mode);
|
||||
oid = &null_oid;
|
||||
oid = null_oid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user