hash-ll.h: split out of hash.h to remove dependency on repository.h
[alt-git.git] / t / helper / test-match-trees.c
blob3c62e33ccdf5ea1eaab744879d99f75f925e63a5
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "hex.h"
4 #include "match-trees.h"
5 #include "object-name.h"
6 #include "repository.h"
7 #include "setup.h"
8 #include "tree.h"
10 int cmd__match_trees(int ac, const char **av)
12 struct object_id hash1, hash2, shifted;
13 struct tree *one, *two;
15 setup_git_directory();
17 if (repo_get_oid(the_repository, av[1], &hash1))
18 die("cannot parse %s as an object name", av[1]);
19 if (repo_get_oid(the_repository, av[2], &hash2))
20 die("cannot parse %s as an object name", av[2]);
21 one = parse_tree_indirect(&hash1);
22 if (!one)
23 die("not a tree-ish %s", av[1]);
24 two = parse_tree_indirect(&hash2);
25 if (!two)
26 die("not a tree-ish %s", av[2]);
28 shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
29 printf("shifted: %s\n", oid_to_hex(&shifted));
31 return 0;