janitor: use NULL and not 0 for pointers.
[tgit.git] / test-match-trees.c
bloba3c4688778d9db28c83c9149c9cff1609b69b93f
1 #include "cache.h"
2 #include "tree.h"
4 int main(int ac, char **av)
6 unsigned char hash1[20], hash2[20], shifted[20];
7 struct tree *one, *two;
9 if (get_sha1(av[1], hash1))
10 die("cannot parse %s as an object name", av[1]);
11 if (get_sha1(av[2], hash2))
12 die("cannot parse %s as an object name", av[2]);
13 one = parse_tree_indirect(hash1);
14 if (!one)
15 die("not a treeish %s", av[1]);
16 two = parse_tree_indirect(hash2);
17 if (!two)
18 die("not a treeish %s", av[2]);
20 shift_tree(one->object.sha1, two->object.sha1, shifted, -1);
21 printf("shifted: %s\n", sha1_to_hex(shifted));
23 exit(0);