diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-10 11:28:37 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-10 11:37:49 -0800 |
commit | 99370863e20131627f0ea0481b7006d0d2125c93 (patch) | |
tree | f23fc4b11942f8e17eb8115cd552ceab75185aac /builtin/write-tree.c | |
parent | babed893f52a44771dd9d85329ee3bd64438adfb (diff) | |
download | git-99370863e20131627f0ea0481b7006d0d2125c93.tar.gz |
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 0e6550a2c63 (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>
Diffstat (limited to 'builtin/write-tree.c')
-rw-r--r-- | builtin/write-tree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 45d61707e7..078010315f 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -3,7 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ -#define USE_THE_INDEX_COMPATIBILITY_MACROS +#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "cache.h" #include "config.h" @@ -38,7 +38,8 @@ int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix) argc = parse_options(argc, argv, cmd_prefix, write_tree_options, write_tree_usage, 0); - ret = write_cache_as_tree(&oid, flags, tree_prefix); + ret = write_index_as_tree(&oid, &the_index, get_index_file(), flags, + tree_prefix); switch (ret) { case 0: printf("%s\n", oid_to_hex(&oid)); |