[PATCH v2 5/9] git rm: collect file modes
From: Peter Collingbourne <hidden>
Date: 2016-06-15 22:48:35
Subsystem:
the rest · Maintainer:
Linus Torvalds
This patch causes git rm to collect file modes alongside file names in its list data structure. Signed-off-by: Peter Collingbourne <redacted> --- 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