| * GIT - The information manager from hell |
| * Copyright (C) Linus Torvalds, 2005 |
| int main(int argc, char **argv) |
| if (argc != 3 || get_sha1(argv[2], sha1)) |
| usage("git-cat-file [-t|-s|-e|<type>] <sha1>"); |
| if ( argv[1][0] == '-' ) { |
| if ( !opt || argv[1][2] ) |
| opt = -1; /* Not a single character option */ |
| if (!sha1_object_info(sha1, type, NULL)) { |
| if (!sha1_object_info(sha1, type, &size)) { |
| return !has_sha1_file(sha1); |
| buf = read_object_with_reference(sha1, argv[1], &size, NULL); |
| die("git-cat-file: unknown option: %s\n", argv[1]); |
| die("git-cat-file %s: bad file", argv[2]); |
| long ret = xwrite(1, buf, size); |
| die("git-cat-file: %s", strerror(errno)); |
| die("git-cat-file: disk full?"); |