summaryrefslogtreecommitdiff
path: root/sha1_file.c
AgeCommit message (Collapse)AuthorFilesLines
2005-05-01Remove the ugly jit-style parent syntax.Libravatar Linus Torvalds1-44/+0
If somebody wants it later, we can re-do it, but for now we consider it an experiment that wasn't worth it. Git will still honor symbolic names, it just won't look up parents for you. Of course, you can always do it by hand if you want to.
2005-05-01Add "look up parent" logic for the simple names.Libravatar Linus Torvalds1-5/+62
It uses the jit syntax, at least for now. 0-xxxx is the first parent of xxxx, while 1-xxxx is the second, and so on. You can use just "-xxxx" for the first parent, but a lot of commands will think that the initial '-' implies a command line flag.
2005-05-01Add "get_sha1()" helper function.Libravatar Linus Torvalds1-0/+29
This allows the programs to use various simplified versions of the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by the .git/HEAD file etc. For example, this commit has been done with git-commit-tree $(git-write-tree) -p HEAD instead of the traditional "$(cat .git/HEAD)" syntax.
2005-04-28[PATCH] Rename and extend read_tree_with_tree_or_commit_sha1Libravatar Junio C Hamano1-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>
2005-04-26[PATCH] introduce xmalloc and xreallocLibravatar Christopher Li1-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>
2005-04-25Fix up the types in write_sha1_fileLibravatar Linus Torvalds1-2/+2
Use "unsigned long" for the size, like we do everywhere else.
2005-04-25Simplify "write_sha1_file()" interfacesLibravatar Linus Torvalds1-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.
2005-04-24[PATCH] fix segfault in fsck-cacheLibravatar Andreas Gal1-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>
2005-04-23[PATCH] Additional functions for the objects databaseLibravatar Daniel Barkalow1-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>
2005-04-23Use O_NOATIME when opening the sha1 files.Libravatar Linus Torvalds1-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.
2005-04-20Fix up some problems from the commit->tree helper patchLibravatar Linus Torvalds1-2/+2
2005-04-20[PATCH] Accept commit in some places when tree is needed.Libravatar Junio C Hamano1-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>
2005-04-20Make "write_sha1_file()" exit early if the file already exists.Libravatar Linus Torvalds1-4/+22
Avoid the compression.
2005-04-20Do SHA1 hash _before_ compression.Libravatar Linus Torvalds1-6/+8
And add a "convert-cache" program to convert from old-style to new-style.
2005-04-18Split up read-cache.c into more logical clumps.Libravatar Linus Torvalds1-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.