cocci & cache-tree.h: migrate "write_cache_as_tree" to "*_index_*"
Add a trivial rule for "write_cache_as_tree" to
"index-compatibility.cocci", and apply it. This was left out of the
rules added in 0e6550a2c6
(cocci: add a
index-compatibility.pending.cocci, 2022-11-19) because this
compatibility wrapper lived in "cache-tree.h", not "cache.h"
But it's like the other "USE_THE_INDEX_COMPATIBILITY_MACROS", so let's
migrate it too.
The replacement of "USE_THE_INDEX_COMPATIBILITY_MACROS" here with
"USE_THE_INDEX_VARIABLE" is a manual change on top, now that these
files only use "&the_index", and don't need any compatibility
macros (or functions).
The wrapping of some argument lists is likewise manual, as coccinelle
would otherwise give us overly long argument lists.
The reason for putting the "O" in the cocci rule on the "-" and "+"
lines is because I couldn't get correct whitespacing otherwise,
i.e. I'd end up with "oid,&the_index", not "oid, &the_index".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
babed893f5
commit
99370863e2
@ -706,7 +706,7 @@ static int read_tree_trivial(struct object_id *common, struct object_id *head,
|
||||
|
||||
static void write_tree_trivial(struct object_id *oid)
|
||||
{
|
||||
if (write_cache_as_tree(oid, 0, NULL))
|
||||
if (write_index_as_tree(oid, &the_index, get_index_file(), 0, NULL))
|
||||
die(_("git write-tree failed to write a tree"));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user