]> git.ipfire.org Git - thirdparty/git.git/blob - write-blob.c
Teach "git clone" about rsync sources
[thirdparty/git.git] / write-blob.c
1 /*
2 * GIT - The information manager from hell
3 *
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include "cache.h"
7
8 int main(int argc, char **argv)
9 {
10 int i;
11
12 for (i = 1 ; i < argc; i++) {
13 char *path = argv[i];
14 int fd;
15 struct stat st;
16 unsigned char sha1[20];
17 fd = open(path, O_RDONLY);
18 if (fd < 0 ||
19 fstat(fd, &st) < 0 ||
20 index_fd(sha1, fd, &st) < 0)
21 die("Unable to add blob %s to database", path);
22 printf("%s\n", sha1_to_hex(sha1));
23 }
24 return 0;
25 }