From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: pclouds@gmail.com
Cc: bmwill@google.com, git@vger.kernel.org, newren@gmail.com,
ramsay@ramsayjones.plus.com
Subject: [PATCH v4 00/23] Fix incorrect use of the_index
Date: Wed, 6 Jun 2018 18:49:53 +0200 [thread overview]
Message-ID: <20180606165016.3285-1-pclouds@gmail.com> (raw)
In-Reply-To: <20180606073933.14755-1-pclouds@gmail.com>
v4 fixes some commit messages and killed a couple more the_index
references after I tried to merge this with 'pu'
diff --git a/apply.c b/apply.c
index 811ff2ad5e..82f681972f 100644
--- a/apply.c
+++ b/apply.c
@@ -4090,9 +4090,9 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
return error(_("sha1 information is lacking or useless "
"(%s)."), name);
- ce = make_cache_entry(&the_index, patch->old_mode, oid.hash, name, 0, 0);
+ ce = make_index_entry(&result, patch->old_mode, oid.hash, name, 0, 0);
if (!ce)
- return error(_("make_cache_entry failed for path '%s'"),
+ return error(_("make_index_entry failed for path '%s'"),
name);
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD)) {
free(ce);
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 3c8218304e..4dbcab3727 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -230,9 +230,9 @@ static int checkout_merged(int pos, const struct checkout *state)
if (write_object_file(result_buf.ptr, result_buf.size, blob_type, &oid))
die(_("Unable to add merge result for '%s'"), path);
free(result_buf.ptr);
- ce = make_cache_entry(&the_index, mode, oid.hash, path, 2, 0);
+ ce = make_index_entry(state->istate, mode, oid.hash, path, 2, 0);
if (!ce)
- die(_("make_cache_entry failed for path '%s'"), path);
+ die(_("make_index_entry failed for path '%s'"), path);
status = checkout_entry(ce, state, NULL);
free(ce);
return status;
diff --git a/builtin/difftool.c b/builtin/difftool.c
index e34e75a42d..c7d6296762 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -321,7 +321,7 @@ static int checkout_path(unsigned mode, struct object_id *oid,
struct cache_entry *ce;
int ret;
- ce = make_cache_entry(&the_index, mode, oid->hash, path, 0, 0);
+ ce = make_index_entry(state->istate, mode, oid->hash, path, 0, 0);
ret = checkout_entry(ce, state, NULL);
free(ce);
@@ -488,7 +488,7 @@ static int run_dir_diff(const char *extcmd, int symlinks, const char *prefix,
* index.
*/
struct cache_entry *ce2 =
- make_cache_entry(&the_index, rmode, roid.hash,
+ make_index_entry(&wtindex, rmode, roid.hash,
dst_path, 0, 0);
add_index_entry(&wtindex, ce2,
diff --git a/builtin/reset.c b/builtin/reset.c
index 0ea0a19d5e..067f535031 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -134,10 +134,10 @@ static void update_index_from_diff(struct diff_queue_struct *q,
continue;
}
- ce = make_cache_entry(&the_index, one->mode, one->oid.hash, one->path,
+ ce = make_index_entry(&the_index, one->mode, one->oid.hash, one->path,
0, 0);
if (!ce)
- die(_("make_cache_entry failed for path '%s'"),
+ die(_("make_index_entry failed for path '%s'"),
one->path);
if (is_missing) {
ce->ce_flags |= CE_INTENT_TO_ADD;
diff --git a/cache.h b/cache.h
index 242aaa5498..eb8c79b8a1 100644
--- a/cache.h
+++ b/cache.h
@@ -699,7 +699,7 @@ extern int remove_file_from_index(struct index_state *, const char *path);
extern int add_to_index(struct index_state *, const char *path, struct stat *, int flags);
extern int add_file_to_index(struct index_state *, const char *path, int flags);
-extern struct cache_entry *make_cache_entry(struct index_state *istate,unsigned int mode, const unsigned char *sha1, const char *path, int stage, unsigned int refresh_options);
+extern struct cache_entry *make_index_entry(struct index_state *istate, unsigned int mode, const unsigned char *sha1, const char *path, int stage, unsigned int refresh_options);
extern int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
extern int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
extern void set_object_name_for_intent_to_add_entry(struct cache_entry *ce);
diff --git a/merge-recursive.c b/merge-recursive.c
index 9280deb6a1..4f054d6dbb 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -315,7 +315,7 @@ static int add_cacheinfo(struct merge_options *o,
struct cache_entry *ce;
int ret;
- ce = make_cache_entry(&the_index, mode, oid ? oid->hash : null_sha1, path, stage, 0);
+ ce = make_index_entry(&the_index, mode, oid ? oid->hash : null_sha1, path, stage, 0);
if (!ce)
return err(o, _("add_cacheinfo failed for path '%s'; merge aborting."), path);
diff --git a/read-cache.c b/read-cache.c
index c083318aa7..4352aac521 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -745,7 +745,7 @@ int add_file_to_index(struct index_state *istate, const char *path, int flags)
return add_to_index(istate, path, &st, flags);
}
-struct cache_entry *make_cache_entry(struct index_state *istate,
+struct cache_entry *make_index_entry(struct index_state *istate,
unsigned int mode,
const unsigned char *sha1,
const char *path, int stage,
diff --git a/resolve-undo.c b/resolve-undo.c
index a4918546c3..2377995d6d 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -147,7 +147,7 @@ int unmerge_index_entry_at(struct index_state *istate, int pos)
struct cache_entry *nce;
if (!ru->mode[i])
continue;
- nce = make_cache_entry(istate, ru->mode[i], ru->oid[i].hash,
+ nce = make_index_entry(istate, ru->mode[i], ru->oid[i].hash,
name, i + 1, 0);
if (matched)
nce->ce_flags |= CE_MATCHED;
Nguyễn Thái Ngọc Duy (23):
unpack-trees: remove 'extern' on function declaration
unpack-trees: add a note about path invalidation
unpack-trees: don't shadow global var the_index
unpack-tress: convert clear_ce_flags* to avoid the_index
unpack-trees: avoid the_index in verify_absent()
attr.h: drop extern from function declaration
attr: remove an implicit dependency on the_index
convert.h: drop 'extern' from function declaration
convert.c: remove an implicit dependency on the_index
dir.c: remove an implicit dependency on the_index in pathspec code
ls-files: correct index argument to get_convert_attr_ascii()
pathspec.c: use the right index instead of the_index
submodule.c: use the right index instead of the_index
entry.c: use the right index instead of the_index
attr: remove index from git_attr_set_direction()
preload-index.c: use the right index instead of the_index
read-cache.c: remove an implicit dependency on the_index
apply.c: use the right index instead of the_index
difftool: use the right index instead of the_index
checkout: avoid the_index when possible
resolve-undo.c: use the right index instead of the_index
grep: use the right index instead of the_index
cache.h: make the_index part of "compatibility macros"
apply.c | 6 ++--
archive.c | 8 ++---
attr.c | 52 ++++++++++++++++++-------------
attr.h | 31 ++++++++++---------
builtin/add.c | 6 ++--
builtin/cat-file.c | 2 +-
builtin/check-attr.c | 6 ++--
builtin/checkout-index.c | 1 +
builtin/checkout.c | 6 ++--
builtin/clean.c | 2 +-
builtin/commit.c | 2 +-
builtin/difftool.c | 4 +--
builtin/grep.c | 6 ++--
builtin/ls-files.c | 17 ++++++-----
builtin/pack-objects.c | 2 +-
builtin/reset.c | 4 +--
builtin/rm.c | 2 +-
builtin/submodule--helper.c | 2 +-
builtin/update-index.c | 2 +-
cache.h | 9 +++---
convert.c | 41 ++++++++++++++-----------
convert.h | 61 +++++++++++++++++++++----------------
diff-lib.c | 4 +--
diff.c | 2 +-
dir.c | 27 +++++++++-------
dir.h | 16 ++++++----
entry.c | 10 +++---
ll-merge.c | 4 +--
merge-recursive.c | 4 +--
pathspec.c | 2 +-
preload-index.c | 3 +-
read-cache.c | 19 +++++++-----
rerere.c | 2 +-
resolve-undo.c | 5 +--
revision.c | 2 +-
sha1-file.c | 4 +--
submodule.c | 8 ++---
unpack-trees.c | 57 +++++++++++++++++++++-------------
unpack-trees.h | 4 +--
userdiff.c | 2 +-
ws.c | 2 +-
wt-status.c | 6 ++--
42 files changed, 258 insertions(+), 197 deletions(-)
--
2.18.0.rc0.333.g22e6ee6cdf
next prev parent reply other threads:[~2018-06-06 16:50 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 16:11 [PATCH/RFC/BUG] unpack-trees.c: do not use "the_index" Nguyễn Thái Ngọc Duy
2018-06-01 18:34 ` Elijah Newren
2018-06-01 18:51 ` Stefan Beller
2018-06-02 5:01 ` Duy Nguyen
2018-06-02 5:03 ` Duy Nguyen
2018-06-03 4:58 ` Elijah Newren
2018-06-04 17:33 ` Brandon Williams
2018-06-05 15:43 ` [PATCH 0/6] Fix "the_index" usage in unpack-trees.c Nguyễn Thái Ngọc Duy
2018-06-05 15:43 ` [PATCH 1/6] unpack-trees: remove 'extern' on function declaration Nguyễn Thái Ngọc Duy
2018-06-05 15:43 ` [PATCH 2/6] unpack-trees: add a note about path invalidation Nguyễn Thái Ngọc Duy
2018-06-05 15:43 ` [PATCH 3/6] unpack-trees: don't shadow global var the_index Nguyễn Thái Ngọc Duy
2018-06-05 17:11 ` Ramsay Jones
2018-06-05 15:43 ` [PATCH 4/6] unpack-tress: convert clear_ce_flags* to avoid the_index Nguyễn Thái Ngọc Duy
2018-06-05 17:37 ` Ramsay Jones
2018-06-05 15:43 ` [PATCH 5/6] unpack-trees: avoid the_index in verify_absent() Nguyễn Thái Ngọc Duy
2018-06-05 15:43 ` [PATCH 6/6] Forbid "the_index" in dir.c and unpack-trees.c Nguyễn Thái Ngọc Duy
2018-06-05 16:58 ` Brandon Williams
2018-06-06 4:57 ` Duy Nguyen
2018-06-06 5:02 ` [PATCH v2 0/5] Fix "the_index" usage in unpack-trees.c Nguyễn Thái Ngọc Duy
2018-06-06 5:02 ` [PATCH v2 1/5] unpack-trees: remove 'extern' on function declaration Nguyễn Thái Ngọc Duy
2018-06-06 5:02 ` [PATCH v2 2/5] unpack-trees: add a note about path invalidation Nguyễn Thái Ngọc Duy
2018-06-06 5:02 ` [PATCH v2 3/5] unpack-trees: don't shadow global var the_index Nguyễn Thái Ngọc Duy
2018-06-06 5:02 ` [PATCH v2 4/5] unpack-tress: convert clear_ce_flags* to avoid the_index Nguyễn Thái Ngọc Duy
2018-06-06 5:02 ` [PATCH v2 5/5] unpack-trees: avoid the_index in verify_absent() Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 00/20] Fix incorrect use of the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 01/20] unpack-trees: remove 'extern' on function declaration Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 02/20] unpack-trees: add a note about path invalidation Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 03/20] unpack-trees: don't shadow global var the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 04/20] unpack-tress: convert clear_ce_flags* to avoid the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 05/20] unpack-trees: avoid the_index in verify_absent() Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 06/20] attr.h: drop extern from function declaration Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 07/20] attr: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-06 13:35 ` Ramsay Jones
2018-06-06 16:50 ` Brandon Williams
2018-06-06 16:58 ` Duy Nguyen
2018-06-06 17:02 ` Brandon Williams
2018-06-06 7:39 ` [PATCH v3 08/20] convert.h: drop 'extern' from function declaration Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 09/20] convert.c: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 10/20] dir.c: remove an implicit dependency on the_index in pathspec code Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 11/20] ls-files: correct index argument to get_convert_attr_ascii() Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 12/20] pathspec.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 13/20] submodule.c: " Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 14/20] entry.c: " Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 15/20] attr: remove index from git_attr_set_direction() Nguyễn Thái Ngọc Duy
2018-06-06 16:58 ` Brandon Williams
2018-06-06 7:39 ` [PATCH v3 16/20] preload-index.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 17/20] cache.c: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:00 ` Brandon Williams
2018-06-06 7:39 ` [PATCH v3 18/20] resolve-undo.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 19/20] grep: " Nguyễn Thái Ngọc Duy
2018-06-06 7:39 ` [PATCH v3 20/20] cache.h: make the_index part of "compatibility macros" Nguyễn Thái Ngọc Duy
2018-06-06 16:49 ` Nguyễn Thái Ngọc Duy [this message]
2018-06-06 16:49 ` [PATCH v4 01/23] unpack-trees: remove 'extern' on function declaration Nguyễn Thái Ngọc Duy
2018-06-06 16:49 ` [PATCH v4 02/23] unpack-trees: add a note about path invalidation Nguyễn Thái Ngọc Duy
2018-06-06 16:49 ` [PATCH v4 03/23] unpack-trees: don't shadow global var the_index Nguyễn Thái Ngọc Duy
2018-06-06 16:49 ` [PATCH v4 04/23] unpack-tress: convert clear_ce_flags* to avoid the_index Nguyễn Thái Ngọc Duy
2018-06-07 7:41 ` Elijah Newren
2018-06-07 15:11 ` Duy Nguyen
2018-06-08 15:58 ` Duy Nguyen
2018-06-06 16:49 ` [PATCH v4 05/23] unpack-trees: avoid the_index in verify_absent() Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 06/23] attr.h: drop extern from function declaration Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 07/23] attr: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 08/23] convert.h: drop 'extern' from function declaration Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 09/23] convert.c: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 10/23] dir.c: remove an implicit dependency on the_index in pathspec code Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 11/23] ls-files: correct index argument to get_convert_attr_ascii() Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 12/23] pathspec.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 13/23] submodule.c: " Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 14/23] entry.c: " Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 15/23] attr: remove index from git_attr_set_direction() Nguyễn Thái Ngọc Duy
2018-06-09 17:57 ` Elijah Newren
2018-06-06 17:02 ` [PATCH v4 16/23] preload-index.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 17/23] read-cache.c: remove an implicit dependency on the_index Nguyễn Thái Ngọc Duy
2018-06-09 18:10 ` Elijah Newren
2018-06-09 18:45 ` Duy Nguyen
2018-06-09 19:48 ` Elijah Newren
2018-06-06 17:02 ` [PATCH v4 18/23] apply.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 19/23] difftool: " Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 20/23] checkout: avoid the_index when possible Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 21/23] resolve-undo.c: use the right index instead of the_index Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 22/23] grep: " Nguyễn Thái Ngọc Duy
2018-06-06 17:02 ` [PATCH v4 23/23] cache.h: make the_index part of "compatibility macros" Nguyễn Thái Ngọc Duy
2018-06-07 7:44 ` [PATCH v4 00/23] Fix incorrect use of the_index Elijah Newren
2018-06-09 19:58 ` Elijah Newren
2018-06-11 16:05 ` Duy Nguyen
2018-06-11 16:11 ` Elijah Newren
2018-06-11 16:24 ` Duy Nguyen
2018-06-11 16:44 ` Elijah Newren
2018-06-11 16:49 ` Duy Nguyen
2018-06-14 17:18 ` Duy Nguyen
2018-06-14 20:57 ` Elijah Newren
2018-06-11 18:20 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180606165016.3285-1-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=ramsay@ramsayjones.plus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).