diff options
author | Bryan Larsen <bryan.larsen@gmail.com> | 2005-07-08 23:51:55 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-09 00:07:37 (GMT) |
commit | 7672db20c2060f20b01788e4a4289ebc5f818605 (patch) | |
tree | 0b5c5ed90d81628aa03df60ee5116d707f4a0803 /write-blob.c | |
parent | 7558ef89edce07555c6436cfcb98c31388dd99b0 (diff) | |
download | git-7672db20c2060f20b01788e4a4289ebc5f818605.zip git-7672db20c2060f20b01788e4a4289ebc5f818605.tar.gz git-7672db20c2060f20b01788e4a4289ebc5f818605.tar.bz2 |
[PATCH] Expose object ID computation functions.
This patch makes the first half of write_sha1_file() and
index_fd() externally visible, to allow callers to compute the
object ID without actually storing it in the object database.
[JC demangled the whitespaces himself because he liked the patch
so much, and reworked the interface to index_fd() slightly,
taking suggestion from Linus and of his own.]
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'write-blob.c')
-rw-r--r-- | write-blob.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/write-blob.c b/write-blob.c deleted file mode 100644 index 8bfd576..0000000 --- a/write-blob.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * GIT - The information manager from hell - * - * Copyright (C) Linus Torvalds, 2005 - */ -#include "cache.h" - -int main(int argc, char **argv) -{ - int i; - - for (i = 1 ; i < argc; i++) { - char *path = argv[i]; - int fd; - struct stat st; - unsigned char sha1[20]; - fd = open(path, O_RDONLY); - if (fd < 0 || - fstat(fd, &st) < 0 || - index_fd(sha1, fd, &st) < 0) - die("Unable to add blob %s to database", path); - printf("%s\n", sha1_to_hex(sha1)); - } - return 0; -} |