git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Williams <bmwill@google.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 15/15] cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch
Date: Mon, 18 Jun 2018 11:53:56 -0700	[thread overview]
Message-ID: <20180618185356.GD73085@google.com> (raw)
In-Reply-To: <20180616054157.32433-16-pclouds@gmail.com>

On 06/16, Nguyễn Thái Ngọc Duy wrote:
> From now on, by default index compat macros are off because they could
> hide the_index dependency. Only those in builtin can use it (and even
> so should be avoided if possible).

This is awesome! Now there aren't any compat macros left in the lib code
and the next set of patches has a good base to work from the eliminate
the_index (which I assume based on other mails from you will become part
of the new USE_THE_INDEX_COMPATIBILITY_MACROS macro once its eliminated
from the lib code).

> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  attr.c                               | 1 -
>  builtin/add.c                        | 1 +
>  builtin/am.c                         | 1 +
>  builtin/check-attr.c                 | 1 +
>  builtin/check-ignore.c               | 1 +
>  builtin/checkout-index.c             | 1 +
>  builtin/checkout.c                   | 1 +
>  builtin/clean.c                      | 1 +
>  builtin/commit.c                     | 1 +
>  builtin/describe.c                   | 1 +
>  builtin/diff-files.c                 | 1 +
>  builtin/diff-index.c                 | 1 +
>  builtin/diff-tree.c                  | 1 +
>  builtin/diff.c                       | 1 +
>  builtin/fsck.c                       | 1 +
>  builtin/ls-files.c                   | 1 -
>  builtin/merge-index.c                | 1 +
>  builtin/merge-ours.c                 | 1 +
>  builtin/merge.c                      | 1 +
>  builtin/mv.c                         | 1 +
>  builtin/pull.c                       | 1 +
>  builtin/read-tree.c                  | 1 +
>  builtin/reset.c                      | 1 +
>  builtin/rev-parse.c                  | 1 +
>  builtin/rm.c                         | 1 +
>  builtin/submodule--helper.c          | 1 +
>  builtin/update-index.c               | 1 +
>  cache.h                              | 2 +-
>  convert.c                            | 1 -
>  dir.c                                | 1 -
>  name-hash.c                          | 1 -
>  pathspec.c                           | 1 -
>  read-cache.c                         | 1 -
>  submodule.c                          | 1 -
>  t/helper/test-dump-untracked-cache.c | 1 +
>  t/helper/test-tool.h                 | 2 ++
>  tree.c                               | 1 -
>  unpack-trees.c                       | 1 -
>  38 files changed, 29 insertions(+), 11 deletions(-)
> 
> diff --git a/attr.c b/attr.c
> index 067fb9e0c0..d16625661d 100644
> --- a/attr.c
> +++ b/attr.c
> @@ -7,7 +7,6 @@
>   * an insanely large number of attributes.
>   */
>  
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "exec-cmd.h"
> diff --git a/builtin/add.c b/builtin/add.c
> index 8a155dd41e..b93193c3fe 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) 2006 Linus Torvalds
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "builtin.h"
> diff --git a/builtin/am.c b/builtin/am.c
> index 2fc2d1e82c..28af59d183 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -3,6 +3,7 @@
>   *
>   * Based on git-am.sh by Junio C Hamano.
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "builtin.h"
> diff --git a/builtin/check-attr.c b/builtin/check-attr.c
> index 91444dc044..d9cebd5382 100644
> --- 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"
> diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
> index ec9a959e08..599097304b 100644
> --- 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"
> diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c
> index a730f6a1aa..e38ad42dbf 100644
> --- a/builtin/checkout-index.c
> +++ b/builtin/checkout-index.c
> @@ -4,6 +4,7 @@
>   * Copyright (C) 2005 Linus Torvalds
>   *
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "builtin.h"
>  #include "config.h"
>  #include "lockfile.h"
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 2e1d2376d2..2250611407 100644
> --- 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"
> diff --git a/builtin/clean.c b/builtin/clean.c
> index fad533a0a7..2258379ecc 100644
> --- a/builtin/clean.c
> +++ b/builtin/clean.c
> @@ -6,6 +6,7 @@
>   * Based on git-clean.sh by Pavel Roskin
>   */
>  
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "builtin.h"
>  #include "cache.h"
>  #include "config.h"
> diff --git a/builtin/commit.c b/builtin/commit.c
> index a842fea666..98a5b4a8c8 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -5,6 +5,7 @@
>   * 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"
> diff --git a/builtin/describe.c b/builtin/describe.c
> index cf1ae77d7c..4ca234972e 100644
> --- 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"
> diff --git a/builtin/diff-files.c b/builtin/diff-files.c
> index e88493ffe5..af706b4fce 100644
> --- a/builtin/diff-files.c
> +++ b/builtin/diff-files.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) Linus Torvalds, 2005
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "diff.h"
> diff --git a/builtin/diff-index.c b/builtin/diff-index.c
> index 522f4fdffd..c026ffb95e 100644
> --- 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"
> diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
> index 473615117e..bd2264ed5c 100644
> --- 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"
> diff --git a/builtin/diff.c b/builtin/diff.c
> index bfefff3a84..17d7d5c9f5 100644
> --- a/builtin/diff.c
> +++ b/builtin/diff.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (c) 2006 Junio C Hamano
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "lockfile.h"
> diff --git a/builtin/fsck.c b/builtin/fsck.c
> index 3ad4f160f9..33cb71d269 100644
> --- 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"
> diff --git a/builtin/ls-files.c b/builtin/ls-files.c
> index 88bb2019ad..dbf5d13d91 100644
> --- a/builtin/ls-files.c
> +++ b/builtin/ls-files.c
> @@ -5,7 +5,6 @@
>   *
>   * Copyright (C) Linus Torvalds, 2005
>   */
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "repository.h"
>  #include "config.h"
> diff --git a/builtin/merge-index.c b/builtin/merge-index.c
> index c99443b095..38ea6ad6ca 100644
> --- 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"
>  
> diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c
> index c84c6e05e9..7c4a80ed3b 100644
> --- 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.
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "git-compat-util.h"
>  #include "builtin.h"
>  #include "diff.h"
> diff --git a/builtin/merge.c b/builtin/merge.c
> index b00d6f4821..1b540e2194 100644
> --- a/builtin/merge.c
> +++ b/builtin/merge.c
> @@ -6,6 +6,7 @@
>   * 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"
> diff --git a/builtin/mv.c b/builtin/mv.c
> index 80bb967a63..be15ba7044 100644
> --- a/builtin/mv.c
> +++ b/builtin/mv.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) 2006 Johannes Schindelin
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "builtin.h"
>  #include "config.h"
>  #include "pathspec.h"
> diff --git a/builtin/pull.c b/builtin/pull.c
> index 1f2ecf3a88..1c3657dee2 100644
> --- 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.
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "builtin.h"
> diff --git a/builtin/read-tree.c b/builtin/read-tree.c
> index ebc43eb805..ae6ca3a8c5 100644
> --- a/builtin/read-tree.c
> +++ b/builtin/read-tree.c
> @@ -4,6 +4,7 @@
>   * Copyright (C) Linus Torvalds, 2005
>   */
>  
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "lockfile.h"
> diff --git a/builtin/reset.c b/builtin/reset.c
> index a862c70fab..dd60eec9d6 100644
> --- a/builtin/reset.c
> +++ b/builtin/reset.c
> @@ -7,6 +7,7 @@
>   *
>   * 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"
> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
> index 4f49e96bfd..b5f8d6a83d 100644
> --- a/builtin/rev-parse.c
> +++ b/builtin/rev-parse.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) Linus Torvalds, 2005
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "commit.h"
> diff --git a/builtin/rm.c b/builtin/rm.c
> index 65b448ef8e..e5b77e429d 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) Linus Torvalds 2006
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "builtin.h"
>  #include "config.h"
>  #include "lockfile.h"
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index bd250ca216..8abe15144b 100644
> --- 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"
> diff --git a/builtin/update-index.c b/builtin/update-index.c
> index a8709a26ec..36e837248f 100644
> --- a/builtin/update-index.c
> +++ b/builtin/update-index.c
> @@ -3,6 +3,7 @@
>   *
>   * Copyright (C) Linus Torvalds, 2005
>   */
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "lockfile.h"
> diff --git a/cache.h b/cache.h
> index 89a107a7f7..b3a6d14a36 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -339,7 +339,7 @@ extern void remove_name_hash(struct index_state *istate, struct cache_entry *ce)
>  extern void free_name_hash(struct index_state *istate);
>  
>  
> -#ifndef NO_THE_INDEX_COMPATIBILITY_MACROS
> +#ifdef USE_THE_INDEX_COMPATIBILITY_MACROS
>  #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 64d0d30e08..0895dc5994 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -1,4 +1,3 @@
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "attr.h"
> diff --git a/dir.c b/dir.c
> index ccf8b4975e..473c47eb2f 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -7,7 +7,6 @@
>   * 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"
> diff --git a/name-hash.c b/name-hash.c
> index 163849831c..12eaa62980 100644
> --- a/name-hash.c
> +++ b/name-hash.c
> @@ -5,7 +5,6 @@
>   *
>   * Copyright (C) 2008 Linus Torvalds
>   */
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  
>  struct dir_entry {
> diff --git a/pathspec.c b/pathspec.c
> index 27cd606786..6997707477 100644
> --- 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"
> diff --git a/read-cache.c b/read-cache.c
> index 372588260e..2a84ad0797 100644
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -3,7 +3,6 @@
>   *
>   * Copyright (C) Linus Torvalds, 2005
>   */
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  #include "cache.h"
>  #include "config.h"
>  #include "tempfile.h"
> diff --git a/submodule.c b/submodule.c
> index 939d6870ec..c6ae29379d 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -1,4 +1,3 @@
> -#define NO_THE_INDEX_COMPATIBILITY_MACROS
>  
>  #include "cache.h"
>  #include "repository.h"
> diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
> index bd92fb305a..56a5ce8abb 100644
> --- 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 "cache.h"
>  #include "dir.h"
>  
> diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
> index 7116ddfb94..a7ff69e9f3 100644
> --- a/t/helper/test-tool.h
> +++ b/t/helper/test-tool.h
> @@ -1,6 +1,8 @@
>  #ifndef __TEST_TOOL_H__
>  #define __TEST_TOOL_H__
>  
> +#define USE_THE_INDEX_COMPATIBILITY_MACROS
> +
>  int cmd__chmtime(int argc, const char **argv);
>  int cmd__config(int argc, const char **argv);
>  int cmd__ctype(int argc, const char **argv);
> diff --git a/tree.c b/tree.c
> index 244eb5e665..b5ed7bc22b 100644
> --- 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"
> diff --git a/unpack-trees.c b/unpack-trees.c
> index 3a85a02a77..fd09e812a2 100644
> --- 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"
> -- 
> 2.18.0.rc0.333.g22e6ee6cdf
> 

-- 
Brandon Williams

  reply	other threads:[~2018-06-18 18:54 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-16  5:41 [PATCH 00/15] Kill the_index part 1, expose it Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 01/15] contrib: add cocci script to replace index compat macros Nguyễn Thái Ngọc Duy
2018-06-19 11:35   ` Derrick Stolee
2018-06-19 11:41     ` Derrick Stolee
2018-06-19 14:51       ` Duy Nguyen
2018-06-19 15:21         ` Derrick Stolee
2018-07-23 12:56           ` SZEDER Gábor
2018-06-16  5:41 ` [PATCH 02/15] apply.c: stop using " Nguyễn Thái Ngọc Duy
2018-06-25 17:27   ` Junio C Hamano
2018-06-30  8:38     ` Duy Nguyen
2018-07-03 18:30       ` Junio C Hamano
2018-07-09 14:35         ` Duy Nguyen
2018-06-16  5:41 ` [PATCH 03/15] blame.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 04/15] check-racy.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 05/15] diff-lib.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 06/15] diff.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 07/15] entry.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 08/15] merge-recursive.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 09/15] merge.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 10/15] rerere.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 11/15] revision.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 12/15] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 13/15] sha1-name.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 14/15] wt-status.c: " Nguyễn Thái Ngọc Duy
2018-06-16  5:41 ` [PATCH 15/15] cache.h: flip NO_THE_INDEX_COMPATIBILITY_MACROS switch Nguyễn Thái Ngọc Duy
2018-06-18 18:53   ` Brandon Williams [this message]
2018-06-17  7:02 ` [PATCH 00/15] Kill the_index part 1, expose it Elijah Newren
2018-06-17  8:49   ` Duy Nguyen
2018-06-18 18:41     ` Brandon Williams
2018-06-19 19:00       ` Ben Peart
2018-06-19 11:48 ` Derrick Stolee
2018-06-19 14:48   ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180618185356.GD73085@google.com \
    --to=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).