summaryrefslogtreecommitdiff
path: root/sha1_file.c
Commit message (Collapse)AuthorAgeFilesLines
* [PATCH] Rename and extend read_tree_with_tree_or_commit_sha1Junio C Hamano2005-04-281-32/+37
| | | | | | | | | | | | | | | This patch renames read_tree_with_tree_or_commit_sha1() to read_object_with_reference() and extends it to automatically dereference not just "commit" objects but "tag" objects. With this patch, you can say e.g.: ls-tree $tag read-tree -m $(merge-base $tag $HEAD) $tag $HEAD diff-cache $tag diff-tree $tag $HEAD Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* [PATCH] introduce xmalloc and xreallocChristopher Li2005-04-261-5/+3
| | | | | | | | Introduce xmalloc and xrealloc to die gracefully with a descriptive message when out of memory, rather than taking a SIGSEGV. Signed-off-by: Christopher Li<chrislgit@chrisli.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
* Fix up the types in write_sha1_fileLinus Torvalds2005-04-251-2/+2
| | | | Use "unsigned long" for the size, like we do everywhere else.
* Simplify "write_sha1_file()" interfacesLinus Torvalds2005-04-251-7/+20
| | | | | The write function now adds the header to the file by itself, so there is no reason to duplicate it among all the users any more.
* [PATCH] fix segfault in fsck-cacheAndreas Gal2005-04-241-0/+2
| | | | | | | | | | | | | | | 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>
* [PATCH] Additional functions for the objects databaseDaniel Barkalow2005-04-231-0/+72
| | | | | | | | | 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>
* Use O_NOATIME when opening the sha1 files.Linus Torvalds2005-04-231-3/+26
| | | | | | | | | | 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.
* Fix up some problems from the commit->tree helper patchLinus Torvalds2005-04-201-2/+2
|
* [PATCH] Accept commit in some places when tree is needed.Junio C Hamano2005-04-201-0/+40
| | | | | | | | | | | | | | | 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>
* Make "write_sha1_file()" exit early if the file already exists.Linus Torvalds2005-04-201-4/+22
| | | | Avoid the compression.
* Do SHA1 hash _before_ compression.conversionLinus Torvalds2005-04-201-6/+8
| | | | | And add a "convert-cache" program to convert from old-style to new-style.
* Split up read-cache.c into more logical clumps.Linus Torvalds2005-04-181-0/+247
Do the usage and error reporting in "usage.c", and the sha1 file accesses in "sha1_file.c". Small, nice, easily separated parts. Good.