blob: 8bfd57615a4ceb695ab49fd6f1726d6d462a0f25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/*
* 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;
}
|