diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-09-14 02:22:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-01-07 15:00:14 -0800 |
commit | ba655da537a999670c7b21e0446e774a1f9733ea (patch) | |
tree | ccefcf54ec019795f4a6fd0a3372294f2a9041eb /unpack-trees.c | |
parent | 730f72840cc50c523fe4cdd796ea2d2fc4571a28 (diff) | |
download | git-ba655da537a999670c7b21e0446e774a1f9733ea.tar.gz |
read-tree --debug-unpack
A debugging patch.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 74cabc36ff..10e8871a74 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -501,6 +501,38 @@ static struct cache_entry *find_cache_entry(struct traverse_info *info, return NULL; } +static void debug_path(struct traverse_info *info) +{ + if (info->prev) { + debug_path(info->prev); + if (*info->prev->name.path) + putchar('/'); + } + printf("%s", info->name.path); +} + +static void debug_name_entry(int i, struct name_entry *n) +{ + printf("ent#%d %06o %s\n", i, + n->path ? n->mode : 0, + n->path ? n->path : "(missing)"); +} + +static void debug_unpack_callback(int n, + unsigned long mask, + unsigned long dirmask, + struct name_entry *names, + struct traverse_info *info) +{ + int i; + printf("* unpack mask %lu, dirmask %lu, cnt %d ", + mask, dirmask, n); + debug_path(info); + putchar('\n'); + for (i = 0; i < n; i++) + debug_name_entry(i, names + i); +} + static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *names, struct traverse_info *info) { struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, }; @@ -511,6 +543,9 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str while (!p->mode) p++; + if (o->debug_unpack) + debug_unpack_callback(n, mask, dirmask, names, info); + /* Are we supposed to look at the index too? */ if (o->merge) { while (1) { |