Re: [PATCH] builtin-commit: fix partial-commit support
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 18, 2007, 18:44 UTC
- Message-ID
- <7vve7zv1fd.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <7vr6inx1m8.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> diff --git a/builtin-commit.c b/builtin-commit.c > index 3e7d281..e487bc0 100644 > --- a/builtin-commit.c > +++ b/builtin-commit.c
There was another...
Show 25 quoted lines
> +static int list_paths(struct path_list *list, const char *with_tree,
> + const char *prefix, const char **pattern)
> +{
> + struct dir_struct dir;
> + int i;
> + char *m;
> +
> + for (i = 0; pattern[i]; i++)
> + ;
> + m = xcalloc(1, i);
> +
> + memset(&dir, 0, sizeof(dir));
> + if (with_tree)
> + overlay_tree_on_cache(with_tree, prefix);
> +
> + for (i = 0; i < active_nr; i++) {
> + struct cache_entry *ce = active_cache[i];
> + if (ce->ce_flags & htons(CE_UPDATE))
> + continue;
> + if (!pathspec_match(pattern, m, ce->name, 0))
> + continue;
> + if (excluded(&dir, ce->name))
> + continue;
> + path_list_insert(ce->name, list);
> + }This "excluded", and the whole "struct dir" business is unneeded, as we are walking on the index and finding the set of paths the user cares about.