| * GIT - The information manager from hell |
| * Copyright (C) Linus Torvalds, 2005 |
| * Copyright (C) Junio C Hamano, 2005 |
| static void hash_object(const char *path, const char *type, int write_object) |
| fd = open(path, O_RDONLY); |
| index_fd(sha1, fd, &st, write_object, type)) |
| ? "Unable to add %s to database" |
| : "Unable to hash %s", path); |
| printf("%s\n", sha1_to_hex(sha1)); |
| static const char hash_object_usage[] = |
| "git-hash-object [-t <type>] [-w] <file>..."; |
| int main(int argc, char **argv) |
| const char *type = "blob"; |
| for (i = 1 ; i < argc; i++) { |
| if (!strcmp(argv[i], "-t")) { |
| else if (!strcmp(argv[i], "-w")) |
| hash_object(argv[i], type, write_object); |