git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH 01/15] contrib: add cocci script to replace index compat macros
Date: Tue, 19 Jun 2018 07:35:07 -0400	[thread overview]
Message-ID: <a7e0bcd5-5bef-097e-f032-d152d51515aa@gmail.com> (raw)
In-Reply-To: <20180616054157.32433-2-pclouds@gmail.com>

On 6/16/2018 1:41 AM, Nguyễn Thái Ngọc Duy wrote:
> Index compat macros are going to be removed to expose the_index and
> then reorganized to use the right index instead of simply the_index
> because sometimes we want to use a different index.
>
> This cocci script can help with the first step. It can be used later
> on on even builtin/ when we start to reorganize code in there, but for
> now this is the script that performs all the conversion outside
> builtin/

I pulled your code and ran `make coccicheck` and got quite a large patch 
as a result.

Perhaps reorder the commits in your large patch with this one at the 
end? It's helpful to see what your mechanical changes are going to be, 
but let's save it for when `make coccicheck` is stable.

>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>   contrib/coccinelle/index-compat.cocci | 184 ++++++++++++++++++++++++++
>   1 file changed, 184 insertions(+)
>   create mode 100644 contrib/coccinelle/index-compat.cocci
>
> diff --git a/contrib/coccinelle/index-compat.cocci b/contrib/coccinelle/index-compat.cocci
> new file mode 100644
> index 0000000000..ca46711eb6
> --- /dev/null
> +++ b/contrib/coccinelle/index-compat.cocci
> @@ -0,0 +1,184 @@
> +@@
> +@@
> +-active_cache
> ++the_index.cache
> +
> +@@
> +@@
> +-active_nr
> ++the_index.cache_nr
> +
> +@@
> +@@
> +-active_alloc
> ++the_index.cache_alloc
> +
> +@@
> +@@
> +-active_cache_changed
> ++the_index.cache_changed
> +
> +@@
> +@@
> +-active_cache_tree
> ++the_index.cache_tree
> +
> +@@
> +@@
> +- read_cache()
> ++ read_index(&the_index)
> +
> +@@
> +expression path;
> +@@
> +- read_cache_from(path)
> ++ read_index_from(&the_index, path, get_git_dir())
> +
> +@@
> +expression pathspec;
> +@@
> +- read_cache_preload(pathspec)
> ++ read_index_preload(&the_index, pathspec)
> +
> +@@
> +@@
> +- is_cache_unborn()
> ++ is_index_unborn(&the_index)
> +
> +@@
> +@@
> +- read_cache_unmerged()
> ++ read_index_unmerged(&the_index)
> +
> +@@
> +@@
> +- discard_cache()
> ++ discard_index(&the_index)
> +
> +@@
> +@@
> +- unmerged_cache()
> ++ unmerged_index(&the_index)
> +
> +@@
> +expression name;
> +expression namelen;
> +@@
> +- cache_name_pos(name, namelen)
> ++ index_name_pos(&the_index, name, namelen)
> +
> +@@
> +expression ce;
> +expression option;
> +@@
> +- add_cache_entry(ce, option)
> ++ add_index_entry(&the_index, ce, option)
> +
> +@@
> +expression pos;
> +expression new_name;
> +@@
> +- rename_cache_entry_at(pos, new_name)
> ++ rename_index_entry_at(&the_index, pos, new_name)
> +
> +@@
> +expression pos;
> +@@
> +- remove_cache_entry_at(pos)
> ++ remove_index_entry_at(&the_index, pos)
> +
> +@@
> +expression path;
> +@@
> +- remove_file_from_cache(path)
> ++ remove_file_from_index(&the_index, path)
> +
> +@@
> +expression path;
> +expression st;
> +expression flags;
> +@@
> +- add_to_cache(path, st, flags)
> ++ add_to_index(&the_index, path, st, flags)
> +
> +@@
> +expression path;
> +expression flags;
> +@@
> +- add_file_to_cache(path, flags)
> ++ add_file_to_index(&the_index, path, flags)
> +
> +@@
> +expression ce;
> +expression flip;
> +@@
> +-chmod_cache_entry(ce, flip)
> ++chmod_index_entry(&the_index, ce, flip)
> +
> +@@
> +expression flags;
> +@@
> +-refresh_cache(flags)
> ++refresh_index(&the_index, flags, NULL, NULL, NULL)
> +
> +@@
> +expression ce;
> +expression st;
> +expression options;
> +@@
> +-ce_match_stat(ce, st, options)
> ++ie_match_stat(&the_index, ce, st, options)
> +
> +@@
> +expression ce;
> +expression st;
> +expression options;
> +@@
> +-ce_modified(ce, st, options)
> ++ie_modified(&the_index, ce, st, options)
> +
> +@@
> +expression name;
> +expression namelen;
> +@@
> +-cache_dir_exists(name, namelen)
> ++index_dir_exists(&the_index, name, namelen)
> +
> +@@
> +expression name;
> +expression namelen;
> +expression igncase;
> +@@
> +-cache_file_exists(name, namelen, igncase)
> ++index_file_exists(&the_index, name, namelen, igncase)
> +
> +@@
> +expression name;
> +expression namelen;
> +@@
> +-cache_name_is_other(name, namelen)
> ++index_name_is_other(&the_index, name, namelen)
> +
> +@@
> +@@
> +-resolve_undo_clear()
> ++resolve_undo_clear_index(&the_index)
> +
> +@@
> +expression at;
> +@@
> +-unmerge_cache_entry_at(at)
> ++unmerge_index_entry_at(&the_index, at)
> +
> +@@
> +expression pathspec;
> +@@
> +-unmerge_cache(pathspec)
> ++unmerge_index(&the_index, pathspec)
> +
> +@@
> +expression path;
> +expression sz;
> +@@
> +-read_blob_data_from_cache(path, sz)
> ++read_blob_data_from_index(&the_index, path, sz)


  reply	other threads:[~2018-06-19 11:35 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 [this message]
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
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=a7e0bcd5-5bef-097e-f032-d152d51515aa@gmail.com \
    --to=stolee@gmail.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).