0807e57807
Header clean-up. * en/header-split-cache-h: (24 commits) protocol.h: move definition of DEFAULT_GIT_PORT from cache.h mailmap, quote: move declarations of global vars to correct unit treewide: reduce includes of cache.h in other headers treewide: remove double forward declaration of read_in_full cache.h: remove unnecessary includes treewide: remove cache.h inclusion due to pager.h changes pager.h: move declarations for pager.c functions from cache.h treewide: remove cache.h inclusion due to editor.h changes editor: move editor-related functions and declarations into common file treewide: remove cache.h inclusion due to object.h changes object.h: move some inline functions and defines from cache.h treewide: remove cache.h inclusion due to object-file.h changes object-file.h: move declarations for object-file.c functions from cache.h treewide: remove cache.h inclusion due to git-zlib changes git-zlib: move declarations for git-zlib functions from cache.h treewide: remove cache.h inclusion due to object-name.h changes object-name.h: move declarations for object-name.c functions from cache.h treewide: remove unnecessary cache.h inclusion treewide: be explicit about dependence on mem-pool.h treewide: be explicit about dependence on oid-array.h ...
31 lines
777 B
C
31 lines
777 B
C
#include "test-tool.h"
|
|
#include "cache.h"
|
|
#include "hex.h"
|
|
#include "object-name.h"
|
|
#include "setup.h"
|
|
#include "tree.h"
|
|
|
|
int cmd__match_trees(int ac UNUSED, const char **av)
|
|
{
|
|
struct object_id hash1, hash2, shifted;
|
|
struct tree *one, *two;
|
|
|
|
setup_git_directory();
|
|
|
|
if (repo_get_oid(the_repository, av[1], &hash1))
|
|
die("cannot parse %s as an object name", av[1]);
|
|
if (repo_get_oid(the_repository, av[2], &hash2))
|
|
die("cannot parse %s as an object name", av[2]);
|
|
one = parse_tree_indirect(&hash1);
|
|
if (!one)
|
|
die("not a tree-ish %s", av[1]);
|
|
two = parse_tree_indirect(&hash2);
|
|
if (!two)
|
|
die("not a tree-ish %s", av[2]);
|
|
|
|
shift_tree(the_repository, &one->object.oid, &two->object.oid, &shifted, -1);
|
|
printf("shifted: %s\n", oid_to_hex(&shifted));
|
|
|
|
return 0;
|
|
}
|