| 274 | } |
| 275 | |
| 276 | static 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 | |
| 312 | static void write_buf_to_worktree(const struct object_id *obj, |
| 313 | const char *buf, unsigned long size) |
no test coverage detected