2007-02-16 01:32:45 +01:00
|
|
|
#include "cache.h"
|
|
|
|
#include "tree.h"
|
|
|
|
|
|
|
|
int main(int ac, char **av)
|
|
|
|
{
|
2016-04-18 01:10:37 +02:00
|
|
|
struct object_id hash1, hash2, shifted;
|
2007-02-16 01:32:45 +01:00
|
|
|
struct tree *one, *two;
|
|
|
|
|
2016-03-05 23:16:50 +01:00
|
|
|
setup_git_directory();
|
|
|
|
|
2016-04-18 01:10:37 +02:00
|
|
|
if (get_oid(av[1], &hash1))
|
2007-02-16 01:32:45 +01:00
|
|
|
die("cannot parse %s as an object name", av[1]);
|
2016-04-18 01:10:37 +02:00
|
|
|
if (get_oid(av[2], &hash2))
|
2007-02-16 01:32:45 +01:00
|
|
|
die("cannot parse %s as an object name", av[2]);
|
2016-04-18 01:10:37 +02:00
|
|
|
one = parse_tree_indirect(hash1.hash);
|
2007-02-16 01:32:45 +01:00
|
|
|
if (!one)
|
2013-09-04 21:04:30 +02:00
|
|
|
die("not a tree-ish %s", av[1]);
|
2016-04-18 01:10:37 +02:00
|
|
|
two = parse_tree_indirect(hash2.hash);
|
2007-02-16 01:32:45 +01:00
|
|
|
if (!two)
|
2013-09-04 21:04:30 +02:00
|
|
|
die("not a tree-ish %s", av[2]);
|
2007-02-16 01:32:45 +01:00
|
|
|
|
2016-04-18 01:10:38 +02:00
|
|
|
shift_tree(&one->object.oid, &two->object.oid, &shifted, -1);
|
2016-04-18 01:10:37 +02:00
|
|
|
printf("shifted: %s\n", oid_to_hex(&shifted));
|
2007-02-16 01:32:45 +01:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|