-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This was useful in diagnosing the corrupt index.aux format problem. But do not bother building or installing it by default. Signed-off-by: Junio C Hamano <junkio@cox.net>
- Loading branch information
Junio C Hamano
committed
Apr 24, 2006
1 parent
a6e5642
commit 1744820
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "cache.h" | ||
#include "tree.h" | ||
#include "cache-tree.h" | ||
|
||
static unsigned char active_cache_sha1[20]; | ||
static struct cache_tree *active_cache_tree; | ||
|
||
static void dump_cache_tree(struct cache_tree *it, const char *pfx) | ||
{ | ||
int i; | ||
if (it->entry_count < 0) | ||
printf("%-40s %s\n", "invalid", pfx); | ||
else | ||
printf("%s %s (%d entries)\n", | ||
sha1_to_hex(it->sha1), | ||
pfx, it->entry_count); | ||
for (i = 0; i < it->subtree_nr; i++) { | ||
char path[PATH_MAX]; | ||
struct cache_tree_sub *down = it->down[i]; | ||
sprintf(path, "%s%.*s/", pfx, down->namelen, down->name); | ||
dump_cache_tree(down->cache_tree, path); | ||
} | ||
} | ||
|
||
int main(int ac, char **av) | ||
{ | ||
if (read_cache_1(active_cache_sha1) < 0) | ||
die("unable to read index file"); | ||
active_cache_tree = read_cache_tree(active_cache_sha1); | ||
dump_cache_tree(active_cache_tree, ""); | ||
return 0; | ||
} |