match-trees: convert shift_tree() and shift_tree_by() to use object_id
[git] / test-match-trees.c
1 #include "cache.h"
2 #include "tree.h"
3
4 int main(int ac, char **av)
5 {
6         struct object_id hash1, hash2, shifted;
7         struct tree *one, *two;
8
9         if (get_oid(av[1], &hash1))
10                 die("cannot parse %s as an object name", av[1]);
11         if (get_oid(av[2], &hash2))
12                 die("cannot parse %s as an object name", av[2]);
13         one = parse_tree_indirect(hash1.hash);
14         if (!one)
15                 die("not a tree-ish %s", av[1]);
16         two = parse_tree_indirect(hash2.hash);
17         if (!two)
18                 die("not a tree-ish %s", av[2]);
19
20         shift_tree(&one->object.oid, &two->object.oid, &shifted, -1);
21         printf("shifted: %s\n", oid_to_hex(&shifted));
22
23         exit(0);
24 }