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