]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-match-trees.c
object-name.h: move declarations for object-name.c functions from cache.h
[thirdparty/git.git] / t / helper / test-match-trees.c
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "hex.h"
4 #include "object-name.h"
5 #include "setup.h"
6 #include "tree.h"
7
8 int cmd__match_trees(int ac, const char **av)
9 {
10 struct object_id hash1, hash2, shifted;
11 struct tree *one, *two;
12
13 setup_git_directory();
14
15 if (repo_get_oid(the_repository, av[1], &hash1))
16 die("cannot parse %s as an object name", av[1]);
17 if (repo_get_oid(the_repository, av[2], &hash2))
18 die("cannot parse %s as an object name", av[2]);
19 one = parse_tree_indirect(&hash1);
20 if (!one)
21 die("not a tree-ish %s", av[1]);
22 two = parse_tree_indirect(&hash2);
23 if (!two)
24 die("not a tree-ish %s", av[2]);
25
26 shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
27 printf("shifted: %s\n", oid_to_hex(&shifted));
28
29 return 0;
30 }