MCPcopy Create free account
hub / github.com/git/git / check_notes_merge_worktree

Function check_notes_merge_worktree

notes-merge.c:276–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276static void check_notes_merge_worktree(struct notes_merge_options *o)
277{
278 struct strbuf buf = STRBUF_INIT;
279
280 if (!o->has_worktree) {
281 /*
282 * Must establish NOTES_MERGE_WORKTREE.
283 * Abort if NOTES_MERGE_WORKTREE already exists
284 */
285 if (file_exists(repo_git_path_replace(the_repository, &buf, NOTES_MERGE_WORKTREE)) &&
286 !is_empty_dir(repo_git_path_replace(the_repository, &buf, NOTES_MERGE_WORKTREE))) {
287 if (advice_enabled(ADVICE_RESOLVE_CONFLICT))
288 die(_("You have not concluded your previous "
289 "notes merge (%s exists).\nPlease, use "
290 "'git notes merge --commit' or 'git notes "
291 "merge --abort' to commit/abort the "
292 "previous merge before you start a new "
293 "notes merge."), repo_git_path_replace(the_repository, &buf, "NOTES_MERGE_*"));
294 else
295 die(_("You have not concluded your notes merge "
296 "(%s exists)."), repo_git_path_replace(the_repository, &buf, "NOTES_MERGE_*"));
297 }
298
299 if (safe_create_leading_directories_const(the_repository, repo_git_path_replace(the_repository, &buf,
300 NOTES_MERGE_WORKTREE "/.test")))
301 die_errno("unable to create directory %s",
302 repo_git_path_replace(the_repository, &buf, NOTES_MERGE_WORKTREE));
303 o->has_worktree = 1;
304 } else if (!file_exists(repo_git_path_replace(the_repository, &buf, NOTES_MERGE_WORKTREE)))
305 /* NOTES_MERGE_WORKTREE should already be established */
306 die("missing '%s'. This should not happen",
307 repo_git_path_replace(the_repository, &buf, NOTES_MERGE_WORKTREE));
308
309 strbuf_release(&buf);
310}
311
312static void write_buf_to_worktree(const struct object_id *obj,
313 const char *buf, unsigned long size)

Callers 1

merge_one_change_manualFunction · 0.85

Calls 8

file_existsFunction · 0.85
repo_git_path_replaceFunction · 0.85
is_empty_dirFunction · 0.85
advice_enabledFunction · 0.85
die_errnoFunction · 0.85
strbuf_releaseFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected