Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-04-29 04:29:23 +0400
committerJunio C Hamano <junkio@cox.net>2007-04-29 05:06:00 +0400
commitcb2cada6da9d71604fd09efbff47cddbea453e1e (patch)
treea8801dad29e38ee20ee6d477d64e27321bc24c0a /builtin-fsck.c
parent26e60160a074747fbe8866ddac4e0c7660c17ff6 (diff)
Catch empty pathnames in trees during fsck
Released versions of fast-import have been able to create a tree that contains files or subtrees that contain no name. Unfortunately these trees aren't valid, but people may have actually tried to create them due to bugs in import-tars.perl or their own fast-import frontend. We now look for this unusual condition and warn the user if at least one of their tree objects contains the problem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-fsck.c')
-rw-r--r--builtin-fsck.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-fsck.c b/builtin-fsck.c
index 7c3b0a535f..75e10e25ec 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -218,6 +218,7 @@ static int fsck_tree(struct tree *item)
{
int retval;
int has_full_path = 0;
+ int has_empty_name = 0;
int has_zero_pad = 0;
int has_bad_modes = 0;
int has_dup_entries = 0;
@@ -241,6 +242,8 @@ static int fsck_tree(struct tree *item)
if (strchr(name, '/'))
has_full_path = 1;
+ if (!*name)
+ has_empty_name = 1;
has_zero_pad |= *(char *)desc.buffer == '0';
update_tree_entry(&desc);
@@ -289,6 +292,9 @@ static int fsck_tree(struct tree *item)
if (has_full_path) {
objwarning(&item->object, "contains full pathnames");
}
+ if (has_empty_name) {
+ objwarning(&item->object, "contains empty pathname");
+ }
if (has_zero_pad) {
objwarning(&item->object, "contains zero-padded file modes");
}