Re: [PATCH 01/15] contrib: add cocci script to replace index compat macros
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jun 19, 2018, 14:51 UTC
- Message-ID
- <CACsJy8AkUyU+yECMSoNUm=SSNn+zXN5QbWEvYjkcngp0PzJ9PA@mail.gmail.com>
- In-Reply-To
- <20180619114143.206568-1-dstolee@microsoft.com>
On Tue, Jun 19, 2018 at 1:41 PM Derrick Stolee <stolee@gmail.com> wrote:
Show 11 quoted lines
> > Duy, > > Here is the patch that was generated by `make coccicheck`. > > Thanks, > -Stolee > > -->8-- > > --- builtin/add.c
Ah right. This is on purpose. I think I mentioned in the commit message that builtin/ is not touched. Do we run 'make coccicheck' automatically somewhere? If true, I need to move this script elsewhere because it's meant to run manually. You run it when you intend to do more manual fixups afterwards. For builtin/, I think I'll wait until 'struct repository *' conversion is complete then maybe fix them one by one.
Show 18 quoted lines
> +++ /tmp/cocci-output-206193-4c91ec-add.c
> @@ -38,13 +38,13 @@ static void chmod_pathspec(struct pathsp
> {
> int i;
>
> - for (i = 0; i < active_nr; i++) {
> - struct cache_entry *ce = active_cache[i];
> + for (i = 0; i < the_index.cache_nr; i++) {
> + struct cache_entry *ce = the_index.cache[i];
>
> if (pathspec && !ce_path_match(&the_index, ce, pathspec, NULL))
> continue;
>
> - if (chmod_cache_entry(ce, flip) < 0)
> + if (chmod_index_entry(&the_index, ce, flip) < 0)
> fprintf(stderr, "cannot chmod %cx '%s'\n", flip, ce->name);
> }
> }-- Duy