[PATCH] Fix git-diff-files for symlinks.
[git/repo.git] / write-blob.c
blob8bfd57615a4ceb695ab49fd6f1726d6d462a0f25
1 /*
2 * GIT - The information manager from hell
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include "cache.h"
8 int main(int argc, char **argv)
10 int i;
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));
24 return 0;