Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Thu, 24 Jan 2019 08:29:12 +0000
(15:29 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 24 Jan 2019 19:55:06 +0000
(11:55 -0800)
By default, index compat macros are off from now on, because they
could hide the_index dependency.
Only those in builtin can use it.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
55 files changed:
attr.c
patch
|
blob
|
history
builtin/add.c
patch
|
blob
|
history
builtin/am.c
patch
|
blob
|
history
builtin/blame.c
patch
|
blob
|
history
builtin/cat-file.c
patch
|
blob
|
history
builtin/check-attr.c
patch
|
blob
|
history
builtin/check-ignore.c
patch
|
blob
|
history
builtin/checkout-index.c
patch
|
blob
|
history
builtin/checkout.c
patch
|
blob
|
history
builtin/clean.c
patch
|
blob
|
history
builtin/clone.c
patch
|
blob
|
history
builtin/commit.c
patch
|
blob
|
history
builtin/describe.c
patch
|
blob
|
history
builtin/diff-files.c
patch
|
blob
|
history
builtin/diff-index.c
patch
|
blob
|
history
builtin/diff-tree.c
patch
|
blob
|
history
builtin/diff.c
patch
|
blob
|
history
builtin/difftool.c
patch
|
blob
|
history
builtin/fsck.c
patch
|
blob
|
history
builtin/grep.c
patch
|
blob
|
history
builtin/hash-object.c
patch
|
blob
|
history
builtin/log.c
patch
|
blob
|
history
builtin/ls-files.c
patch
|
blob
|
history
builtin/merge-index.c
patch
|
blob
|
history
builtin/merge-ours.c
patch
|
blob
|
history
builtin/merge-tree.c
patch
|
blob
|
history
builtin/merge.c
patch
|
blob
|
history
builtin/mv.c
patch
|
blob
|
history
builtin/pack-objects.c
patch
|
blob
|
history
builtin/pull.c
patch
|
blob
|
history
builtin/read-tree.c
patch
|
blob
|
history
builtin/rebase--interactive.c
patch
|
blob
|
history
builtin/rebase.c
patch
|
blob
|
history
builtin/replace.c
patch
|
blob
|
history
builtin/reset.c
patch
|
blob
|
history
builtin/rev-parse.c
patch
|
blob
|
history
builtin/rm.c
patch
|
blob
|
history
builtin/submodule--helper.c
patch
|
blob
|
history
builtin/update-index.c
patch
|
blob
|
history
builtin/write-tree.c
patch
|
blob
|
history
cache-tree.h
patch
|
blob
|
history
cache.h
patch
|
blob
|
history
convert.c
patch
|
blob
|
history
dir.c
patch
|
blob
|
history
git.c
patch
|
blob
|
history
name-hash.c
patch
|
blob
|
history
pathspec.c
patch
|
blob
|
history
read-cache.c
patch
|
blob
|
history
repository.c
patch
|
blob
|
history
submodule.c
patch
|
blob
|
history
t/helper/test-dump-fsmonitor.c
patch
|
blob
|
history
t/helper/test-dump-untracked-cache.c
patch
|
blob
|
history
t/helper/test-tool.h
patch
|
blob
|
history
tree.c
patch
|
blob
|
history
unpack-trees.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
150fe06
)
diff --git
a/attr.c
b/attr.c
index b63fe0fc0e99caa07dc2e6da816e1ac8d5942df6..e4e4574857dd086301279cbac51a4e11fb65f093 100644
(file)
--- a/
attr.c
+++ b/
attr.c
@@
-7,7
+7,6
@@
* an insanely large number of attributes.
*/
* an insanely large number of attributes.
*/
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "exec-cmd.h"
#include "cache.h"
#include "config.h"
#include "exec-cmd.h"
diff --git
a/builtin/add.c
b/builtin/add.c
index f65c1722993b62e93feb85e506dffbc77b7ce921..81df0d34dec18bfded5100075ebffc1a19a3f48e 100644
(file)
--- a/
builtin/add.c
+++ b/
builtin/add.c
@@
-3,6
+3,7
@@
*
* Copyright (C) 2006 Linus Torvalds
*/
*
* Copyright (C) 2006 Linus Torvalds
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
diff --git
a/builtin/am.c
b/builtin/am.c
index a9ffc92eaada7fc6e47a793ab515fd55273650d0..ad913ef20e18b177055a0d10895b267b9128b82f 100644
(file)
--- a/
builtin/am.c
+++ b/
builtin/am.c
@@
-3,6
+3,7
@@
*
* Based on git-am.sh by Junio C Hamano.
*/
*
* Based on git-am.sh by Junio C Hamano.
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
diff --git
a/builtin/blame.c
b/builtin/blame.c
index 6d798f99392e54b4392713846652111d457787bb..0074ed311c8b6c26770f62a668f51abda316ec46 100644
(file)
--- a/
builtin/blame.c
+++ b/
builtin/blame.c
@@
-1007,7
+1007,8
@@
int cmd_blame(int argc, const char **argv, const char *prefix)
long bottom, top;
if (parse_range_arg(range_list.items[range_i].string,
nth_line_cb, &sb, lno, anchor,
long bottom, top;
if (parse_range_arg(range_list.items[range_i].string,
nth_line_cb, &sb, lno, anchor,
- &bottom, &top, sb.path, &the_index))
+ &bottom, &top, sb.path,
+ the_repository->index))
usage(blame_usage);
if ((!lno && (top || bottom)) || lno < bottom)
die(Q_("file %s has only %lu line",
usage(blame_usage);
if ((!lno && (top || bottom)) || lno < bottom)
die(Q_("file %s has only %lu line",
diff --git
a/builtin/cat-file.c
b/builtin/cat-file.c
index 7622c502f0090ddec9c094514eed93b5b1c81e53..a5ca47c697e6ef363a40224916fd451554120fb8 100644
(file)
--- a/
builtin/cat-file.c
+++ b/
builtin/cat-file.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
diff --git
a/builtin/check-attr.c
b/builtin/check-attr.c
index 30a2f84274d32977769f778d5704accb599cf0e7..dd833977864d79a3abde9fc66042d7bda56b8e82 100644
(file)
--- a/
builtin/check-attr.c
+++ b/
builtin/check-attr.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
diff --git
a/builtin/check-ignore.c
b/builtin/check-ignore.c
index ec9a959e08d0e3dfa0d2b08529cacbe8d2e04c6e..599097304b77fa5a3f464b8831e71d6a3f56077a 100644
(file)
--- a/
builtin/check-ignore.c
+++ b/
builtin/check-ignore.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
diff --git
a/builtin/checkout-index.c
b/builtin/checkout-index.c
index eb74774cbc9d6bd6acf1b7fe2f31b8e80e461a12..345591bc4b5c5462e18046face3f8ce956483c9a 100644
(file)
--- a/
builtin/checkout-index.c
+++ b/
builtin/checkout-index.c
@@
-4,6
+4,7
@@
* Copyright (C) 2005 Linus Torvalds
*
*/
* Copyright (C) 2005 Linus Torvalds
*
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/checkout.c
b/builtin/checkout.c
index a95ba2c6dc153610569476bfa545967913f71a8e..0446cac05e72befa69f61ff200fbd17befa7796f 100644
(file)
--- a/
builtin/checkout.c
+++ b/
builtin/checkout.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "checkout.h"
#include "builtin.h"
#include "config.h"
#include "checkout.h"
diff --git
a/builtin/clean.c
b/builtin/clean.c
index bbcdeb2d9e7f275309609a2a21a5dd4baf1cf1bd..aaba4af3c26de2150ad655a0b162fc85a69a466d 100644
(file)
--- a/
builtin/clean.c
+++ b/
builtin/clean.c
@@
-6,6
+6,7
@@
* Based on git-clean.sh by Pavel Roskin
*/
* Based on git-clean.sh by Pavel Roskin
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
diff --git
a/builtin/clone.c
b/builtin/clone.c
index 7c7f98c72c80cfcb12f3d3f61a13f46b19967a8f..ddb3230d2165c7969e8192520cb17be567835354 100644
(file)
--- a/
builtin/clone.c
+++ b/
builtin/clone.c
@@
-8,6
+8,7
@@
* Clone a repository into a different directory that does not yet exist.
*/
* Clone a repository into a different directory that does not yet exist.
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/commit.c
b/builtin/commit.c
index d3f1234bf058d9c4ab4c1ad610cec580cc7f1250..2f4af02a27281ca9b7dc7cd579c53680f9d41b56 100644
(file)
--- a/
builtin/commit.c
+++ b/
builtin/commit.c
@@
-5,6
+5,7
@@
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "lockfile.h"
#include "cache.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/describe.c
b/builtin/describe.c
index bc97e50650a39e03448c1c4e5dd0e8f880b9befc..02ec56417a197b7e252625561fa462a215499a4d 100644
(file)
--- a/
builtin/describe.c
+++ b/
builtin/describe.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "lockfile.h"
#include "cache.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/diff-files.c
b/builtin/diff-files.c
index 48cfcb935d0413fcf3850e0c28ec237b642b38a2..86ae474fbfb410f026d42ce9f36e9805a98cfc82 100644
(file)
--- a/
builtin/diff-files.c
+++ b/
builtin/diff-files.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
#include "cache.h"
#include "config.h"
#include "diff.h"
diff --git
a/builtin/diff-index.c
b/builtin/diff-index.c
index fcccd1f10dc95cd47a994b5139226af438049f87..93ec6424234c65f486dcfca724c77a48e5e91f91 100644
(file)
--- a/
builtin/diff-index.c
+++ b/
builtin/diff-index.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
#include "cache.h"
#include "config.h"
#include "diff.h"
diff --git
a/builtin/diff-tree.c
b/builtin/diff-tree.c
index 42bc1eb41db8287ab9f64445ec2a151f216d8840..a90681bcbafcba04af3b669f0758c78ccecdd11f 100644
(file)
--- a/
builtin/diff-tree.c
+++ b/
builtin/diff-tree.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
#include "cache.h"
#include "config.h"
#include "diff.h"
diff --git
a/builtin/diff.c
b/builtin/diff.c
index ec78920ee24fccd47a20d1b7b93a619695c1be25..74351a5757d399ddf251369a5be67bedbe2dfad7 100644
(file)
--- a/
builtin/diff.c
+++ b/
builtin/diff.c
@@
-3,6
+3,7
@@
*
* Copyright (c) 2006 Junio C Hamano
*/
*
* Copyright (c) 2006 Junio C Hamano
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "lockfile.h"
#include "cache.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/difftool.c
b/builtin/difftool.c
index 544b0e86397cb98ddfdad3cffdd983905ee36029..eeb9e370b9c5b3d11fb9f4774aee7cdf952e3b51 100644
(file)
--- a/
builtin/difftool.c
+++ b/
builtin/difftool.c
@@
-11,6
+11,7
@@
*
* Copyright (C) 2016 Johannes Schindelin
*/
*
* Copyright (C) 2016 Johannes Schindelin
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
diff --git
a/builtin/fsck.c
b/builtin/fsck.c
index bf5ddff43f74e0dba77d05e04bc14c0c59884287..46f6ea9baa909bf5aeec43a08461ad2328d5eb13 100644
(file)
--- a/
builtin/fsck.c
+++ b/
builtin/fsck.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "repository.h"
#include "builtin.h"
#include "cache.h"
#include "repository.h"
diff --git
a/builtin/grep.c
b/builtin/grep.c
index fc7a9a928302f79d26fd4d0f57c32f8efd7b9f6e..39a8e9d4a35a02e3bba8c43f77def39fa8f75bb2 100644
(file)
--- a/
builtin/grep.c
+++ b/
builtin/grep.c
@@
-3,6
+3,7
@@
*
* Copyright (c) 2006 Junio C Hamano
*/
*
* Copyright (c) 2006 Junio C Hamano
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "repository.h"
#include "config.h"
#include "cache.h"
#include "repository.h"
#include "config.h"
diff --git
a/builtin/hash-object.c
b/builtin/hash-object.c
index d6f06ea32f51272efa5ccb3fdd396b5916e98e45..e055c1110310bc3b6ccef4fa83dae84316fcc75f 100644
(file)
--- a/
builtin/hash-object.c
+++ b/
builtin/hash-object.c
@@
-40,7
+40,8
@@
static void hash_fd(int fd, const char *type, const char *path, unsigned flags,
if (fstat(fd, &st) < 0 ||
(literally
? hash_literally(&oid, fd, type, flags)
if (fstat(fd, &st) < 0 ||
(literally
? hash_literally(&oid, fd, type, flags)
- : index_fd(&the_index, &oid, fd, &st, type_from_string(type), path, flags)))
+ : index_fd(the_repository->index, &oid, fd, &st,
+ type_from_string(type), path, flags)))
die((flags & HASH_WRITE_OBJECT)
? "Unable to add %s to database"
: "Unable to hash %s", path);
die((flags & HASH_WRITE_OBJECT)
? "Unable to add %s to database"
: "Unable to hash %s", path);
diff --git
a/builtin/log.c
b/builtin/log.c
index dbfb4e31ad7e031d41ef2b9718336c788a96e806..195ff0b4713fd3b126125a56b30814f12bb8b4c9 100644
(file)
--- a/
builtin/log.c
+++ b/
builtin/log.c
@@
-4,6
+4,7
@@
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "refs.h"
#include "cache.h"
#include "config.h"
#include "refs.h"
diff --git
a/builtin/ls-files.c
b/builtin/ls-files.c
index c70a9c71588a76b2ef04689fc6cd805cee4ae0b8..7cc7ec22c96d30bed42b67279de1413115f47689 100644
(file)
--- a/
builtin/ls-files.c
+++ b/
builtin/ls-files.c
@@
-5,7
+5,6
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "repository.h"
#include "config.h"
#include "cache.h"
#include "repository.h"
#include "config.h"
diff --git
a/builtin/merge-index.c
b/builtin/merge-index.c
index c99443b095bd8abbe02d4ea87a452d916681c53f..38ea6ad6ca25d5a969afdbfc5b3510ba44e49a33 100644
(file)
--- a/
builtin/merge-index.c
+++ b/
builtin/merge-index.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "run-command.h"
#include "builtin.h"
#include "run-command.h"
diff --git
a/builtin/merge-ours.c
b/builtin/merge-ours.c
index 0b07263415785e11c7fc5b1a6da40a25e969b73c..4594507420533262a7b6611386a340cfdb96b25f 100644
(file)
--- a/
builtin/merge-ours.c
+++ b/
builtin/merge-ours.c
@@
-7,6
+7,7
@@
*
* Pretend we resolved the heads, but declare our tree trumps everybody else.
*/
*
* Pretend we resolved the heads, but declare our tree trumps everybody else.
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "git-compat-util.h"
#include "builtin.h"
#include "diff.h"
#include "git-compat-util.h"
#include "builtin.h"
#include "diff.h"
diff --git
a/builtin/merge-tree.c
b/builtin/merge-tree.c
index 70f6fc916765c5a5ca67c2dfe72e0480128182e3..53719e0b9d3f9eb683b0809488ea354391639a58 100644
(file)
--- a/
builtin/merge-tree.c
+++ b/
builtin/merge-tree.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
@@
-76,7
+77,8
@@
static void *result(struct merge_list *entry, unsigned long *size)
their = NULL;
if (entry)
their = entry->blob;
their = NULL;
if (entry)
their = entry->blob;
- return merge_blobs(&the_index, path, base, our, their, size);
+ return merge_blobs(the_repository->index, path,
+ base, our, their, size);
}
static void *origin(struct merge_list *entry, unsigned long *size)
}
static void *origin(struct merge_list *entry, unsigned long *size)
diff --git
a/builtin/merge.c
b/builtin/merge.c
index bc1aecfe70cfd97d3589d6a0280ca3c68bc31f1c..e47d77baeebe888cfb67f8e03804ffc3ee3715c0 100644
(file)
--- a/
builtin/merge.c
+++ b/
builtin/merge.c
@@
-6,6
+6,7
@@
* Based on git-merge.sh by Junio C Hamano.
*/
* Based on git-merge.sh by Junio C Hamano.
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "parse-options.h"
#include "cache.h"
#include "config.h"
#include "parse-options.h"
diff --git
a/builtin/mv.c
b/builtin/mv.c
index 80bb967a63f154eb44ebc1a6dd7f833d01dce83e..be15ba7044e0eeeee216a9e6c4615214cd7cdc1e 100644
(file)
--- a/
builtin/mv.c
+++ b/
builtin/mv.c
@@
-3,6
+3,7
@@
*
* Copyright (C) 2006 Johannes Schindelin
*/
*
* Copyright (C) 2006 Johannes Schindelin
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "pathspec.h"
#include "builtin.h"
#include "config.h"
#include "pathspec.h"
diff --git
a/builtin/pack-objects.c
b/builtin/pack-objects.c
index 24bba8147fc96ec2b124aa659c981af08e7a688d..d9d3b90b23935eb6bc2bdefa52f43b917cb7d152 100644
(file)
--- a/
builtin/pack-objects.c
+++ b/
builtin/pack-objects.c
@@
-970,7
+970,7
@@
static int no_try_delta(const char *path)
if (!check)
check = attr_check_initl("delta", NULL);
if (!check)
check = attr_check_initl("delta", NULL);
- git_check_attr(
&the_
index, path, check);
+ git_check_attr(
the_repository->
index, path, check);
if (ATTR_FALSE(check->items[0].value))
return 1;
return 0;
if (ATTR_FALSE(check->items[0].value))
return 1;
return 0;
diff --git
a/builtin/pull.c
b/builtin/pull.c
index 74808b94554a78e720128a721f21dc0d20dd839e..701d1473dc59e018247f337d37f00fe04f83cb98 100644
(file)
--- a/
builtin/pull.c
+++ b/
builtin/pull.c
@@
-5,6
+5,7
@@
*
* Fetch one or more remote refs and merge it/them into the current HEAD.
*/
*
* Fetch one or more remote refs and merge it/them into the current HEAD.
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
diff --git
a/builtin/read-tree.c
b/builtin/read-tree.c
index ac255ad2c243192a9afd3b4578a2a501eb250aff..9083dcfa28a38f7f804c1fdcaa56fb4260b4e6f0 100644
(file)
--- a/
builtin/read-tree.c
+++ b/
builtin/read-tree.c
@@
-4,6
+4,7
@@
* Copyright (C) Linus Torvalds, 2005
*/
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "lockfile.h"
#include "cache.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/rebase--interactive.c
b/builtin/rebase--interactive.c
index dd2a55ab1d956ef0937cfdb0e4e3fb026ac2ff81..6895322d613afcf3cebb0ded610c45ab343ef688 100644
(file)
--- a/
builtin/rebase--interactive.c
+++ b/
builtin/rebase--interactive.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
diff --git
a/builtin/rebase.c
b/builtin/rebase.c
index 7124e66d00e817fd74d1e5876454aea7e0f34a4e..b66783727628c3867683236e5afeef247c5054f4 100644
(file)
--- a/
builtin/rebase.c
+++ b/
builtin/rebase.c
@@
-4,6
+4,7
@@
* Copyright (c) 2018 Pratik Karki
*/
* Copyright (c) 2018 Pratik Karki
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "run-command.h"
#include "exec-cmd.h"
#include "builtin.h"
#include "run-command.h"
#include "exec-cmd.h"
diff --git
a/builtin/replace.c
b/builtin/replace.c
index affcdfb4169899c2affee51593f0453d5d9b9add..5b80b7f21141d6f85d8444d669dffe289f3a60f5 100644
(file)
--- a/
builtin/replace.c
+++ b/
builtin/replace.c
@@
-295,7
+295,7
@@
static int import_object(struct object_id *oid, enum object_type type,
close(fd);
return -1;
}
close(fd);
return -1;
}
- if (index_fd(
&the_
index, oid, fd, &st, type, NULL, flags) < 0)
+ if (index_fd(
the_repository->
index, oid, fd, &st, type, NULL, flags) < 0)
return error(_("unable to write object to database"));
/* index_fd close()s fd for us */
}
return error(_("unable to write object to database"));
/* index_fd close()s fd for us */
}
diff --git
a/builtin/reset.c
b/builtin/reset.c
index 59898c972eee5e8065c2a68b7c937cc3af11f513..4d18a461fab631dd752adec3b95197a3a2657a62 100644
(file)
--- a/
builtin/reset.c
+++ b/
builtin/reset.c
@@
-7,6
+7,7
@@
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/rev-parse.c
b/builtin/rev-parse.c
index 910a71ed8b7997a4d1317f9a2bf048bc2617040a..f8bbe6d47ec397f55bec62d6a71bc6db8f08b54b 100644
(file)
--- a/
builtin/rev-parse.c
+++ b/
builtin/rev-parse.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "commit.h"
#include "cache.h"
#include "config.h"
#include "commit.h"
diff --git
a/builtin/rm.c
b/builtin/rm.c
index 17086d3d97c536522720c589ea8f35d366536ea8..db85b339823cc0aa5ab5d03220335d4e4240d656 100644
(file)
--- a/
builtin/rm.c
+++ b/
builtin/rm.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds 2006
*/
*
* Copyright (C) Linus Torvalds 2006
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
#include "builtin.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/submodule--helper.c
b/builtin/submodule--helper.c
index b45514be317eafb765a8943241b5d880f65e3117..9c832fc606d636f141ec806cf0281489ea199885 100644
(file)
--- a/
builtin/submodule--helper.c
+++ b/
builtin/submodule--helper.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "repository.h"
#include "cache.h"
#include "builtin.h"
#include "repository.h"
#include "cache.h"
diff --git
a/builtin/update-index.c
b/builtin/update-index.c
index e19da77edcaa024cc2bffc6fa8818c2b1cf0d4b6..02ace602b9ae23d6ab74abac016948410b30fcde 100644
(file)
--- a/
builtin/update-index.c
+++ b/
builtin/update-index.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "lockfile.h"
#include "cache.h"
#include "config.h"
#include "lockfile.h"
diff --git
a/builtin/write-tree.c
b/builtin/write-tree.c
index cdcbf8264e8c6e9b56977b99ad28160754d8fb7c..3d46d22ee5261d2cf1233913b7b544e812c26122 100644
(file)
--- a/
builtin/write-tree.c
+++ b/
builtin/write-tree.c
@@
-3,6
+3,7
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "builtin.h"
#include "cache.h"
#include "config.h"
#include "builtin.h"
#include "cache.h"
#include "config.h"
diff --git
a/cache-tree.h
b/cache-tree.h
index 326209198b60fa8a6fdbd171c46132b8a5062e04..757bbc48bca155fe539d07a268087b96ae7aa7f6 100644
(file)
--- a/
cache-tree.h
+++ b/
cache-tree.h
@@
-51,7
+51,7
@@
void prime_cache_tree(struct repository *, struct index_state *, struct tree *);
int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
-#if
ndef NO
_THE_INDEX_COMPATIBILITY_MACROS
+#if
def USE
_THE_INDEX_COMPATIBILITY_MACROS
static inline int write_cache_as_tree(struct object_id *oid, int flags, const char *prefix)
{
return write_index_as_tree(oid, &the_index, get_index_file(), flags, prefix);
static inline int write_cache_as_tree(struct object_id *oid, int flags, const char *prefix)
{
return write_index_as_tree(oid, &the_index, get_index_file(), flags, prefix);
diff --git
a/cache.h
b/cache.h
index 326e73f391abec77a3f0fb2bacca40abafebc6bc..962eb127d3a9e51e3a4cb3911a856320af26f2a4 100644
(file)
--- a/
cache.h
+++ b/
cache.h
@@
-338,8
+338,6
@@
struct index_state {
struct mem_pool *ce_mem_pool;
};
struct mem_pool *ce_mem_pool;
};
-extern struct index_state the_index;
-
/* Name hashing */
extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
/* Name hashing */
extern int test_lazy_init_name_hash(struct index_state *istate, int try_threaded);
extern void add_name_hash(struct index_state *istate, struct cache_entry *ce);
@@
-401,7
+399,9
@@
struct cache_entry *dup_cache_entry(const struct cache_entry *ce, struct index_s
*/
void validate_cache_entries(const struct index_state *istate);
*/
void validate_cache_entries(const struct index_state *istate);
-#ifndef NO_THE_INDEX_COMPATIBILITY_MACROS
+#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
+extern struct index_state the_index;
+
#define active_cache (the_index.cache)
#define active_nr (the_index.cache_nr)
#define active_alloc (the_index.cache_alloc)
#define active_cache (the_index.cache)
#define active_nr (the_index.cache_nr)
#define active_alloc (the_index.cache_alloc)
diff --git
a/convert.c
b/convert.c
index e0848226d21bbbeb26d9ac6217fe1e61ccc71fca..df8c6a0bf86097ca0d9864b4ec5233fb0b1c5939 100644
(file)
--- a/
convert.c
+++ b/
convert.c
@@
-1,4
+1,3
@@
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "object-store.h"
#include "cache.h"
#include "config.h"
#include "object-store.h"
diff --git
a/dir.c
b/dir.c
index ab6477d777e96cb9789f1c6b3220af349731a701..80e07441f7eb893b898e5481427fb6f100402fc4 100644
(file)
--- a/
dir.c
+++ b/
dir.c
@@
-7,7
+7,6
@@
* Copyright (C) Linus Torvalds, 2005-2006
* Junio Hamano, 2005-2006
*/
* Copyright (C) Linus Torvalds, 2005-2006
* Junio Hamano, 2005-2006
*/
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "dir.h"
#include "cache.h"
#include "config.h"
#include "dir.h"
diff --git
a/git.c
b/git.c
index 4d53a3d50da0c699ca83babdf12122532c3eafe9..0c2b26979743946f26b607d90884287aea68836b 100644
(file)
--- a/
git.c
+++ b/
git.c
@@
-417,9
+417,9
@@
static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
trace_argv_printf(argv, "trace: built-in: git");
trace_argv_printf(argv, "trace: built-in: git");
- validate_cache_entries(
&the_
index);
+ validate_cache_entries(
the_repository->
index);
status = p->fn(argc, argv, prefix);
status = p->fn(argc, argv, prefix);
- validate_cache_entries(
&the_
index);
+ validate_cache_entries(
the_repository->
index);
if (status)
return status;
if (status)
return status;
diff --git
a/name-hash.c
b/name-hash.c
index 623ca6923a9ec78b9bb7d7cc899af72057d101d3..b4861bc7b02a93bd5f3659098764f535bb1f51c1 100644
(file)
--- a/
name-hash.c
+++ b/
name-hash.c
@@
-5,7
+5,6
@@
*
* Copyright (C) 2008 Linus Torvalds
*/
*
* Copyright (C) 2008 Linus Torvalds
*/
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "thread-utils.h"
#include "cache.h"
#include "thread-utils.h"
diff --git
a/pathspec.c
b/pathspec.c
index 6f005996fdc8f3e412b0faafc12e65aed359be3b..f1505cfd0af0eb5969d1623cec1bf197be95fb27 100644
(file)
--- a/
pathspec.c
+++ b/
pathspec.c
@@
-1,4
+1,3
@@
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "dir.h"
#include "cache.h"
#include "config.h"
#include "dir.h"
diff --git
a/read-cache.c
b/read-cache.c
index 2549477ed27a7f56b6ee27e44d2345e42a5a8738..b3865d688493b5cc2522a33bd4c3d0975226fb1a 100644
(file)
--- a/
read-cache.c
+++ b/
read-cache.c
@@
-3,7
+3,6
@@
*
* Copyright (C) Linus Torvalds, 2005
*/
*
* Copyright (C) Linus Torvalds, 2005
*/
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "config.h"
#include "diff.h"
#include "cache.h"
#include "config.h"
#include "diff.h"
@@
-95,7
+94,6
@@
static struct mem_pool *find_mem_pool(struct index_state *istate)
return *pool_ptr;
}
return *pool_ptr;
}
-struct index_state the_index;
static const char *alternate_index_output;
static void set_index_entry(struct index_state *istate, int nr, struct cache_entry *ce)
static const char *alternate_index_output;
static void set_index_entry(struct index_state *istate, int nr, struct cache_entry *ce)
diff --git
a/repository.c
b/repository.c
index 9411c4baee2f49e7ce561bc3e142e4bffd521733..36a3b52d709a4516a7987c2c64288dc523adf415 100644
(file)
--- a/
repository.c
+++ b/
repository.c
@@
-1,3
+1,8
@@
+/*
+ * not really _using_ the compat macros, just make sure the_index
+ * declaration matches the definition in this file.
+ */
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "repository.h"
#include "object-store.h"
#include "cache.h"
#include "repository.h"
#include "object-store.h"
@@
-9,6
+14,7
@@
/* The main repository */
static struct repository the_repo;
struct repository *the_repository;
/* The main repository */
static struct repository the_repo;
struct repository *the_repository;
+struct index_state the_index;
void initialize_the_repository(void)
{
void initialize_the_repository(void)
{
diff --git
a/submodule.c
b/submodule.c
index 6415cc55807c7ed9ee4cbcaa57f41a5804b6e854..4208a502603ff8f763dd959610500eb718a76383 100644
(file)
--- a/
submodule.c
+++ b/
submodule.c
@@
-1,4
+1,3
@@
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "repository.h"
#include "cache.h"
#include "repository.h"
diff --git
a/t/helper/test-dump-fsmonitor.c
b/t/helper/test-dump-fsmonitor.c
index 08e3684aff223670fb0786d80426d18bb8800a44..2786f47088e975608c839f193527e1e70e84cee9 100644
(file)
--- a/
t/helper/test-dump-fsmonitor.c
+++ b/
t/helper/test-dump-fsmonitor.c
@@
-3,11
+3,11
@@
int cmd__dump_fsmonitor(int ac, const char **av)
{
int cmd__dump_fsmonitor(int ac, const char **av)
{
- struct index_state *istate =
&the_
index;
+ struct index_state *istate =
the_repository->
index;
int i;
setup_git_directory();
int i;
setup_git_directory();
- if (do_read_index(istate,
get_index_file()
, 0) < 0)
+ if (do_read_index(istate,
the_repository->index_file
, 0) < 0)
die("unable to read index file");
if (!istate->fsmonitor_last_update) {
printf("no fsmonitor\n");
die("unable to read index file");
if (!istate->fsmonitor_last_update) {
printf("no fsmonitor\n");
diff --git
a/t/helper/test-dump-untracked-cache.c
b/t/helper/test-dump-untracked-cache.c
index 52870ebbb3ea7b2d69aecb1bb429dbbaf6388b51..cf0f2c7228e8293c5982168f21b004bc7daa2ff0 100644
(file)
--- a/
t/helper/test-dump-untracked-cache.c
+++ b/
t/helper/test-dump-untracked-cache.c
@@
-1,3
+1,4
@@
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "test-tool.h"
#include "cache.h"
#include "dir.h"
#include "test-tool.h"
#include "cache.h"
#include "dir.h"
diff --git
a/t/helper/test-tool.h
b/t/helper/test-tool.h
index 042f12464b2a17afeb37e01d90bf49ba33ce879a..f4fb3b986156f5b786120fd4eaea2c0c9093f381 100644
(file)
--- a/
t/helper/test-tool.h
+++ b/
t/helper/test-tool.h
@@
-1,6
+1,7
@@
#ifndef TEST_TOOL_H
#define TEST_TOOL_H
#ifndef TEST_TOOL_H
#define TEST_TOOL_H
+#define USE_THE_INDEX_COMPATIBILITY_MACROS
#include "git-compat-util.h"
int cmd__chmtime(int argc, const char **argv);
#include "git-compat-util.h"
int cmd__chmtime(int argc, const char **argv);
diff --git
a/tree.c
b/tree.c
index 215d3fdc7c4af2ef2faca1cf5d5d0b5de52b84a8..181a3778f37d2bbbc6d69a37d93936988ae67cc2 100644
(file)
--- a/
tree.c
+++ b/
tree.c
@@
-1,4
+1,3
@@
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "cache-tree.h"
#include "tree.h"
#include "cache.h"
#include "cache-tree.h"
#include "tree.h"
diff --git
a/unpack-trees.c
b/unpack-trees.c
index 6d53cbfc865096ea41028c0601aa12d6eeb8a145..40f554814d30c8f2cbd91f1d34c618a3d567ac17 100644
(file)
--- a/
unpack-trees.c
+++ b/
unpack-trees.c
@@
-1,4
+1,3
@@
-#define NO_THE_INDEX_COMPATIBILITY_MACROS
#include "cache.h"
#include "argv-array.h"
#include "repository.h"
#include "cache.h"
#include "argv-array.h"
#include "repository.h"