Commit graph

508 commits

Author SHA1 Message Date
Andreas Gal da6abf5d9c [PATCH] fix segfault in fsck-cache
Here is how to trigger it:

   echo blob 100 > .git/objects/00/ae4e8d3208e09f2cf7a38202a126f728cadb49

Then run fsck-cache. It will try to unpack after the header to calculate 
the hash, inflate returns total_out == 0 and memcpy() dies.

The patch below seems to work with ZLIB 1.1 and 1.2.

Signed-off-by: Andreas Gal <gal@uci.edu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-24 14:04:13 -07:00
Daniel Barkalow 8237b1854c [PATCH] Additional functions for the objects database
This adds two functions: one to check if an object is present in the local
database, and one to add an object to the local database by reading it
from a file descriptor and checking its hash.

Signed-Off-By: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-23 18:47:23 -07:00
Linus Torvalds 144bde78e9 Use O_NOATIME when opening the sha1 files.
We really don't care about atime, and it sucks to dirty the
inode cache just for it.

This is more than a one-liner only because we need to be able to
clear the O_NOATIME flag in case some of the objects are owned
by others (in which case open will return EPERM), and because not
everybody has the O_NOATIME flag.
2005-04-23 11:09:32 -07:00
Linus Torvalds 860edf7a71 Fix up some problems from the commit->tree helper patch 2005-04-20 18:49:41 -07:00
Junio C Hamano f4913f91a9 [PATCH] Accept commit in some places when tree is needed.
This patch implements read_tree_with_tree_or_commit_sha1(),
which can be used when you are interested in reading an unpacked
raw tree data but you do not know nor care if the SHA1 you
obtained your user is a tree ID or a commit ID.  Before this
function's introduction, you would have called read_sha1_file(),
examined its type, parsed it to call read_sha1_file() again if
it is a commit, and verified that the resulting object is a
tree.  Instead, this function does that for you.  It returns
NULL if the given SHA1 is not either a tree or a commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-20 18:06:49 -07:00
Linus Torvalds 706bc531a1 Make "write_sha1_file()" exit early if the file already exists.
Avoid the compression.
2005-04-20 09:28:05 -07:00
Linus Torvalds d98b46f8d9 Do SHA1 hash _before_ compression.
And add a "convert-cache" program to convert from old-style
to new-style.
2005-04-20 01:10:46 -07:00
Linus Torvalds 0fcfd160b0 Split up read-cache.c into more logical clumps.
Do the usage and error reporting in "usage.c", and the sha1 file
accesses in "sha1_file.c".

Small, nice, easily separated parts. Good.
2005-04-18 13:04:43 -07:00