2018-03-24 07:44:45 +00:00
|
|
|
#include "test-tool.h"
|
2007-02-16 00:32:45 +00:00
|
|
|
#include "cache.h"
|
|
|
|
#include "tree.h"
|
|
|
|
|
2018-03-24 07:44:45 +00:00
|
|
|
int cmd__match_trees(int ac, const char **av)
|
2007-02-16 00:32:45 +00:00
|
|
|
{
|
2016-04-17 23:10:37 +00:00
|
|
|
struct object_id hash1, hash2, shifted;
|
2007-02-16 00:32:45 +00:00
|
|
|
struct tree *one, *two;
|
|
|
|
|
2016-03-05 22:16:50 +00:00
|
|
|
setup_git_directory();
|
|
|
|
|
2016-04-17 23:10:37 +00:00
|
|
|
if (get_oid(av[1], &hash1))
|
2007-02-16 00:32:45 +00:00
|
|
|
die("cannot parse %s as an object name", av[1]);
|
2016-04-17 23:10:37 +00:00
|
|
|
if (get_oid(av[2], &hash2))
|
2007-02-16 00:32:45 +00:00
|
|
|
die("cannot parse %s as an object name", av[2]);
|
2017-05-06 22:10:37 +00:00
|
|
|
one = parse_tree_indirect(&hash1);
|
2007-02-16 00:32:45 +00:00
|
|
|
if (!one)
|
2013-09-04 19:04:30 +00:00
|
|
|
die("not a tree-ish %s", av[1]);
|
2017-05-06 22:10:37 +00:00
|
|
|
two = parse_tree_indirect(&hash2);
|
2007-02-16 00:32:45 +00:00
|
|
|
if (!two)
|
2013-09-04 19:04:30 +00:00
|
|
|
die("not a tree-ish %s", av[2]);
|
2007-02-16 00:32:45 +00:00
|
|
|
|
2019-06-27 09:28:51 +00:00
|
|
|
shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
|
2016-04-17 23:10:37 +00:00
|
|
|
printf("shifted: %s\n", oid_to_hex(&shifted));
|
2007-02-16 00:32:45 +00:00
|
|
|
|
2021-06-08 10:48:03 +00:00
|
|
|
return 0;
|
2007-02-16 00:32:45 +00:00
|
|
|
}
|