diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-02-23 01:55:44 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-23 01:55:44 +0300 |
commit | 24fb150dcd6b18b6d14ed14a02c6a17c33f0d443 (patch) | |
tree | ce6f4b23b7d5344b77ad34528256f00e9ede5855 /builtin/stash.c | |
parent | 5fc6d00b65c0a946cccef3e3ed056830c8ea23fd (diff) | |
parent | dfd0a89374c6eba332dfa3f5670a29eaf96efa3b (diff) |
Merge branch 'ab/the-index-compatibility'
Remove more remaining uses of macros that relies on the_index
singleton instance without explicitly spelling it out.
* ab/the-index-compatibility:
cocci & cache.h: remove "USE_THE_INDEX_COMPATIBILITY_MACROS"
cache-tree API: remove redundant update_main_cache_tree()
cocci & cache-tree.h: migrate "write_cache_as_tree" to "*_index_*"
cocci & cache.h: apply pending "index_cache_pos" rule
cocci & cache.h: fully apply "active_nr" part of index-compatibility
builtin/rm.c: use narrower "USE_THE_INDEX_VARIABLE"
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 9fcd2e5d99..f93d04f11e 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1,4 +1,4 @@ -#define USE_THE_INDEX_COMPATIBILITY_MACROS +#define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "config.h" #include "parse-options.h" @@ -529,7 +529,8 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, NULL, NULL, NULL)) return -1; - if (write_cache_as_tree(&c_tree, 0, NULL)) + if (write_index_as_tree(&c_tree, &the_index, get_index_file(), 0, + NULL)) return error(_("cannot apply a stash in the middle of a merge")); if (index) { @@ -553,7 +554,8 @@ static int do_apply_stash(const char *prefix, struct stash_info *info, discard_index(&the_index); repo_read_index(the_repository); - if (write_cache_as_tree(&index_tree, 0, NULL)) + if (write_index_as_tree(&index_tree, &the_index, + get_index_file(), 0, NULL)) return error(_("could not save index tree")); reset_head(); @@ -1378,7 +1380,8 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b strbuf_addf(&commit_tree_label, "index on %s\n", msg.buf); commit_list_insert(head_commit, &parents); - if (write_cache_as_tree(&info->i_tree, 0, NULL) || + if (write_index_as_tree(&info->i_tree, &the_index, get_index_file(), 0, + NULL) || commit_tree(commit_tree_label.buf, commit_tree_label.len, &info->i_tree, parents, &info->i_commit, NULL, NULL)) { if (!quiet) |