The sixteenth batch
[git.git] / t / helper / test-match-trees.c
blobd0db5ff26f0772373b5ccba7ad0aa89df01548ff
1 #include "test-tool.h"
2 #include "hex.h"
3 #include "match-trees.h"
4 #include "object-name.h"
5 #include "repository.h"
6 #include "setup.h"
7 #include "tree.h"
9 int cmd__match_trees(int ac UNUSED, const char **av)
11 struct object_id hash1, hash2, shifted;
12 struct tree *one, *two;
14 setup_git_directory();
16 if (repo_get_oid(the_repository, av[1], &hash1))
17 die("cannot parse %s as an object name", av[1]);
18 if (repo_get_oid(the_repository, av[2], &hash2))
19 die("cannot parse %s as an object name", av[2]);
20 one = parse_tree_indirect(&hash1);
21 if (!one)
22 die("not a tree-ish %s", av[1]);
23 two = parse_tree_indirect(&hash2);
24 if (!two)
25 die("not a tree-ish %s", av[2]);
27 shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
28 printf("shifted: %s\n", oid_to_hex(&shifted));
30 return 0;