+#define USE_THE_REPOSITORY_VARIABLE
+
#include "git-compat-util.h"
#include "hex.h"
#include "repository.h"
int pos = commit_graft_pos(the_repository, oid);
if (pos < 0)
return -1;
- if (pos + 1 < the_repository->parsed_objects->grafts_nr)
+ if (pos + 1 < the_repository->parsed_objects->grafts_nr) {
+ free(the_repository->parsed_objects->grafts[pos]);
MOVE_ARRAY(the_repository->parsed_objects->grafts + pos,
the_repository->parsed_objects->grafts + pos + 1,
the_repository->parsed_objects->grafts_nr - pos - 1);
+ }
the_repository->parsed_objects->grafts_nr--;
return 0;
}
{
r->parsed_objects->is_shallow = -1;
stat_validity_clear(r->parsed_objects->shallow_stat);
- reset_commit_grafts(r);
+ parsed_object_pool_reset_commit_grafts(r->parsed_objects);
}
int commit_shallow_file(struct repository *r, struct shallow_lock *lk)
void clear_shallow_info(struct shallow_info *info)
{
+ if (info->used_shallow) {
+ for (size_t i = 0; i < info->shallow->nr; i++)
+ free(info->used_shallow[i]);
+ free(info->used_shallow);
+ }
+
+ free(info->need_reachability_test);
+ free(info->reachable);
+ free(info->shallow_ref);
free(info->ours);
free(info->theirs);
}
}
static int mark_uninteresting(const char *refname UNUSED,
+ const char *referent UNUSED,
const struct object_id *oid,
int flags UNUSED,
void *cb_data UNUSED)
* connect to old refs. If not (e.g. force ref updates) it'll
* have to go down to the current shallow commits.
*/
- head_ref(mark_uninteresting, NULL);
- for_each_ref(mark_uninteresting, NULL);
+ refs_head_ref(get_main_ref_store(the_repository), mark_uninteresting,
+ NULL);
+ refs_for_each_ref(get_main_ref_store(the_repository),
+ mark_uninteresting, NULL);
/* Mark potential bottoms so we won't go out of bound */
for (i = 0; i < nr_shallow; i++) {
};
static int add_ref(const char *refname UNUSED,
+ const char *referent UNUSED,
const struct object_id *oid,
int flags UNUSED,
void *cb_data)
info->nr_theirs = dst;
memset(&ca, 0, sizeof(ca));
- head_ref(add_ref, &ca);
- for_each_ref(add_ref, &ca);
+ refs_head_ref(get_main_ref_store(the_repository), add_ref, &ca);
+ refs_for_each_ref(get_main_ref_store(the_repository), add_ref, &ca);
/* Remove unreachable shallow commits from "ours" */
for (i = dst = 0; i < info->nr_ours; i++) {
struct commit_array ca;
memset(&ca, 0, sizeof(ca));
- head_ref(add_ref, &ca);
- for_each_ref(add_ref, &ca);
+ refs_head_ref(get_main_ref_store(the_repository),
+ add_ref, &ca);
+ refs_for_each_ref(get_main_ref_store(the_repository),
+ add_ref, &ca);
si->commits = ca.commits;
si->nr_commits = ca.nr;
}