2018-03-24 07:44:40 +00:00
|
|
|
#include "test-tool.h"
|
2023-02-24 00:09:27 +00:00
|
|
|
#include "hex.h"
|
2023-05-16 06:33:56 +00:00
|
|
|
#include "read-cache-ll.h"
|
2023-05-16 06:33:55 +00:00
|
|
|
#include "repository.h"
|
2023-03-21 06:26:05 +00:00
|
|
|
#include "setup.h"
|
2014-06-13 12:19:51 +00:00
|
|
|
#include "split-index.h"
|
|
|
|
#include "ewah/ewok.h"
|
|
|
|
|
2023-07-03 06:44:36 +00:00
|
|
|
static void show_bit(size_t pos, void *data UNUSED)
|
2014-06-13 12:19:51 +00:00
|
|
|
{
|
|
|
|
printf(" %d", (int)pos);
|
|
|
|
}
|
|
|
|
|
2023-03-28 20:57:25 +00:00
|
|
|
int cmd__dump_split_index(int ac UNUSED, const char **av)
|
2014-06-13 12:19:51 +00:00
|
|
|
{
|
|
|
|
struct split_index *si;
|
|
|
|
int i;
|
|
|
|
|
2020-02-22 20:17:34 +00:00
|
|
|
setup_git_directory();
|
|
|
|
|
2024-04-18 12:14:09 +00:00
|
|
|
do_read_index(the_repository->index, av[1], 1);
|
|
|
|
printf("own %s\n", oid_to_hex(&the_repository->index->oid));
|
|
|
|
si = the_repository->index->split_index;
|
2014-06-13 12:19:51 +00:00
|
|
|
if (!si) {
|
|
|
|
printf("not a split index\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2018-05-02 00:25:43 +00:00
|
|
|
printf("base %s\n", oid_to_hex(&si->base_oid));
|
2024-04-18 12:14:09 +00:00
|
|
|
for (i = 0; i < the_repository->index->cache_nr; i++) {
|
|
|
|
struct cache_entry *ce = the_repository->index->cache[i];
|
2014-06-13 12:19:51 +00:00
|
|
|
printf("%06o %s %d\t%s\n", ce->ce_mode,
|
2016-09-05 20:07:52 +00:00
|
|
|
oid_to_hex(&ce->oid), ce_stage(ce), ce->name);
|
2014-06-13 12:19:51 +00:00
|
|
|
}
|
|
|
|
printf("replacements:");
|
2015-08-27 17:07:54 +00:00
|
|
|
if (si->replace_bitmap)
|
|
|
|
ewah_each_bit(si->replace_bitmap, show_bit, NULL);
|
2014-06-13 12:19:51 +00:00
|
|
|
printf("\ndeletions:");
|
2015-08-27 17:07:54 +00:00
|
|
|
if (si->delete_bitmap)
|
|
|
|
ewah_each_bit(si->delete_bitmap, show_bit, NULL);
|
2014-06-13 12:19:51 +00:00
|
|
|
printf("\n");
|
|
|
|
return 0;
|
|
|
|
}
|