]> git.ipfire.org Git - thirdparty/git.git/blame - write-blob.c
Teach "git clone" about rsync sources
[thirdparty/git.git] / write-blob.c
CommitLineData
74400e71
JH
1/*
2 * GIT - The information manager from hell
3 *
4 * Copyright (C) Linus Torvalds, 2005
5 */
6#include "cache.h"
7
8int 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}