just safe again

This commit is contained in:
Gerhard Hoffmann 2024-04-03 16:40:46 +02:00
parent 4ab36ec64f
commit 84c422ee38

View File

@ -340,8 +340,58 @@ on_error:
// //
// git merge // git merge
// //
struct merge_options { const char **heads;
size_t heads_count;
git_annotated_commit **annotated;
size_t annotated_count;
unsigned int no_commit : 1;
};
static void merge_options_init(struct merge_options *opts) {
memset(opts, 0, sizeof(*opts));
opts->heads = NULL;
opts->heads_count = 0;
opts->annotated = NULL;
opts->annotated_count = 0;
}
static void parse_options(const char **repo_path, struct merge_options *opts) {
#if 0
struct args_info args = ARGS_INFO_INIT;
for (args.pos = 1; args.pos < argc; ++args.pos) {
const char *curr = argv[args.pos];
if (curr[0] != '-') {
opts_add_refish(opts, curr);
} else if (!strcmp(curr, "--no-commit")) {
opts->no_commit = 1;
} else if (match_str_arg(repo_path, &args, "--git-dir")) {
continue;
}
}
#endif
}
static int merge(git_repository *repo) { static int merge(git_repository *repo) {
struct merge_options opts;
git_index *index;
git_repository_state_t state;
git_merge_analysis_t analysis;
git_merge_preference_t preference;
const char *path = ".";
int err = 0;
merge_options_init(&opts);
parse_options(&path, &opts);
cleanup:
free((char **)opts.heads);
free(opts.annotated);
return 0; return 0;
} }