]> git.ipfire.org Git - thirdparty/git.git/blame - test-match-trees.c
Merge branch 'jc/xstrfmt-null-with-prec-0'
[thirdparty/git.git] / test-match-trees.c
CommitLineData
68faf689
JH
1#include "cache.h"
2#include "tree.h"
3
4int main(int ac, char **av)
5{
6 unsigned char hash1[20], hash2[20], shifted[20];
7 struct tree *one, *two;
8
11e6b3f6
JK
9 setup_git_directory();
10
68faf689
JH
11 if (get_sha1(av[1], hash1))
12 die("cannot parse %s as an object name", av[1]);
13 if (get_sha1(av[2], hash2))
14 die("cannot parse %s as an object name", av[2]);
15 one = parse_tree_indirect(hash1);
16 if (!one)
bb8040f9 17 die("not a tree-ish %s", av[1]);
68faf689
JH
18 two = parse_tree_indirect(hash2);
19 if (!two)
bb8040f9 20 die("not a tree-ish %s", av[2]);
68faf689 21
ed1c9977 22 shift_tree(one->object.oid.hash, two->object.oid.hash, shifted, -1);
68faf689
JH
23 printf("shifted: %s\n", sha1_to_hex(shifted));
24
25 exit(0);
26}