Skip to content

Commit

Permalink
Make fsck-cache warn about old-style tree objects that have full
Browse files Browse the repository at this point in the history
pathnames in them. We're migrating away from that.

This will cause tons of warnings for the current "sparse" archive,
but hell, better now than later.
  • Loading branch information
Linus Torvalds committed Apr 9, 2005
1 parent f768846 commit 4e6616a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fsck-cache.c
Original file line number Diff line number Diff line change
@@ -20,13 +20,22 @@ static int mark_sha1_seen(unsigned char *sha1, char *tag)

static int fsck_tree(unsigned char *sha1, void *data, unsigned long size)
{
int warn_old_tree = 1;

while (size) {
int len = 1+strlen(data);
unsigned char *file_sha1 = data + len;
char *path = strchr(data, ' ');
unsigned int mode;
if (size < len + 20 || !path || sscanf(data, "%o", &mode) != 1)
return -1;

/* Warn about trees that don't do the recursive thing.. */
if (warn_old_tree && strchr(path, '/')) {
fprintf(stderr, "warning: fsck-cache: tree %s has full pathnames in it\n", sha1_to_hex(sha1));
warn_old_tree = 0;
}

data += len + 20;
size -= len + 20;
mark_needs_sha1(sha1, S_ISDIR(mode) ? "tree" : "blob", file_sha1);

0 comments on commit 4e6616a

Please sign in to comment.