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