Commit graph

16 commits

Author SHA1 Message Date
Linus Torvalds 08ca0b04ba Make the revision tracking track the object types too.
This allows fsck to verify not just that an object exists, but
also that it has the type it was expected to have.
2005-04-17 16:19:32 -07:00
Linus Torvalds 01796b0e91 Make "revision.h" slightly better to use.
- mark_reachable() can be more generic, marking the reachable revisions
   with an arbitrary mask.
 - date parsing will parse to a date of 0 rather than ULONG_MAX for the
   bad old case, sorting the dates correctly.
2005-04-17 12:07:00 -07:00
Linus Torvalds 458754a9fe Use common "revision.h" header for both fsck and rev-tree.
It's really a very generic thing: the notion of one sha1 revision
referring to another one. "fsck" uses it for all nodes, and "rev-tree"
only tracks commit-node relationships, but the code was already
the same - now we just make that explicit by moving it to a common
header file.
2005-04-13 21:37:59 -07:00
Linus Torvalds bcee6fd8e7 Make 'fsck' able to take an arbitrary number of parents on the
command line.

"arbitrary" is a bit wrong, since it is limited by the argument
size limit (128kB or so), but let's see if anybody ever cares.
Arguably you should prune your tree before you have a few thousand
dangling heads in your archive.

We can fix it by passing in a file listing if we ever care.
2005-04-13 16:42:09 -07:00
Linus Torvalds 2845dbe4a4 Make fsck reachability avoid doing unnecessary work for
parents that we reach multiple ways.

This doesn't matter right now. It _will_ matter once we have
complex revision graphs.
2005-04-13 12:35:08 -07:00
Linus Torvalds d9839e0305 Make "fsck-cache" use the same revision tracking structure as "rev-tree".
This makes things a lot more efficient, and makes it trivial to do things
like reachability analysis.

Add command line flags to tell what the head is, and whether to warn
about unreachable objects.
2005-04-13 09:57:30 -07:00
Petr Baudis 2de381f919 [PATCH] Consolidate the error handling
Now there is error() for "library" errors and die() for fatal "application"
errors. usage() is now used strictly only for usage errors.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
2005-04-13 02:28:48 -07:00
Linus Torvalds 91af81a98e Oops. Fix bad initialization of the "seen" array, causing us to not
properly clear the reference count at init time. It happened to work
for me by pure luck.

Until it broke, and my unreferenced commit suddenly looked referenced
again. Fixed.
2005-04-10 23:33:52 -07:00
Linus Torvalds f1257f3a33 Oops, the actual 'printf' for missing objects was missing.
Which made fsck very quiet about objects it hadn't found. So add
it. 

We'll need to make things like these optional, because it's
perfectly ok to have partial history if you don't want it,
and don't want to go backwards. But for development, it's best
to always complain about missing sha1 object files that are
referenced from somewhere else.
2005-04-10 23:22:59 -07:00
Linus Torvalds 8ba0bbb237 Add connectivity tracking to fsck.
This shows that I've lost track of one commit already. Most likely
because I forgot to update the .dircache/HEAD file when doing a
commit, so that the next commit referenced not the top-of-tree, but
the one older commit.

Having dangling commits is fine (in fact, you should always have
at least _one_ dangling commit in the top-of-tree). But it's
good to know about them.
2005-04-10 23:13:09 -07:00
Linus Torvalds 4e6616ab77 Make fsck-cache warn about old-style tree objects that have full
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.
2005-04-09 15:47:03 -07:00
Linus Torvalds f768846e34 Teach "fsck" and "read-tree" about recursive tree-nodes.
This is totally untested, since we can't actually _write_ things that
way yet, but I'll get to that next, I hope. That should fix the
huge wasted space for kernel-sized tree objects.
2005-04-09 15:36:41 -07:00
Linus Torvalds 16d4d1ba6c Make "fsck-cache" print out all the root commits it finds.
Once I do the reference tracking, I'll also make it print out all the
HEAD commits it finds, which is even more interesting.
2005-04-09 13:02:30 -07:00
Linus Torvalds 59c1e24980 Fix missing return values and some error tests for empty index files
Patches from Dave Jones and Ingo Molnar, but since I don't have any
infrastructure in place to use the old patch applicator scripts I
am trying to build up, I ended up fixing the thing by hand instead.

Credit where credit is due, though. Nice to see that people are
taking a look at the project even in this early stage.
2005-04-09 00:25:22 -07:00
Linus Torvalds 1ea34e365b Make fsck-cache start parsing the object types, and checking their
internal format.

This doesn't yet check the reachability information, but we're getting
there.. Slowly.
2005-04-08 17:11:14 -07:00
Linus Torvalds 20222118ae Add first cut at "fsck-cache" that validates the SHA1 object store.
It doesn't complain about mine. But it also doesn't yet check for
inter-object reachability etc.
2005-04-08 15:02:42 -07:00