interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / helper / test-match-trees.c

33 lines · 900 bytes Raw Blame History
1#define USE_THE_REPOSITORY_VARIABLE
2
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"
10
11int cmd__match_trees(int ac UNUSED, const char **av)
12{
13 struct object_id hash1, hash2, shifted;
14 struct tree *one, *two;
15
16 setup_git_directory(the_repository);
17
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 = repo_parse_tree_indirect(the_repository, &hash1);
23 if (!one)
24 die("not a tree-ish %s", av[1]);
25 two = repo_parse_tree_indirect(the_repository, &hash2);
26 if (!two)
27 die("not a tree-ish %s", av[2]);
28
29 shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
30 printf("shifted: %s\n", oid_to_hex(&shifted));
31
32 return 0;
33}