[PATCH v2 5/9] git rm: collect file modes
- From
Peter Collingbourne <peter@pcc.me.uk>
- Date
- Apr 10, 2010, 18:23 UTC
- Message-ID
- <1270923830-11830-6-git-send-email-peter@pcc.me.uk>
- In-Reply-To
- <1270923830-11830-1-git-send-email-peter@pcc.me.uk>
This patch causes git rm to collect file modes alongside file names in its list data structure.
Signed-off-by: Peter Collingbourne <peter@pcc.me.uk> --- builtin/rm.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/builtin/rm.c b/builtin/rm.c index 05a5158..61ec2cf 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -18,15 +18,18 @@ static const char * const builtin_rm_usage[] = { static struct { int nr, alloc; const char **name; + unsigned int *mode; } list; -static void add_list(const char *name) +static void add_list(const char *name, unsigned int mode) { if (list.nr >= list.alloc) { list.alloc = alloc_nr(list.alloc); list.name = xrealloc(list.name, list.alloc * sizeof(const char *)); + list.mode = xrealloc(list.mode, list.alloc * sizeof(unsigned int)); } - list.name[list.nr++] = name; + list.name[list.nr] = name; + list.mode[list.nr++] = mode; } static int check_local_mod(unsigned char *head, int index_only) @@ -182,7 +185,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix) struct cache_entry *ce = active_cache[i]; if (!match_pathspec(pathspec, ce->name, ce_namelen(ce), 0, seen)) continue; - add_list(ce->name); + add_list(ce->name, ce->ce_mode); } if (pathspec) {
-- 1.6.5