path: drop git_path() in favor of repo_git_path()
Remove `git_path()` in favor of the `repo_git_path()` family of functions, which makes the implicit dependency on `the_repository` go away. Note that `git_path()` returned a string allocated via `get_pathname()`, which uses a rotating set of statically allocated buffers. Consequently, callers didn't have to free the returned string. The same isn't true for `repo_common_path()`, so we also have to add logic to free the returned strings. This refactoring also allows us to remove `repo_common_pathv()` as well as `get_pathname()` from the public interface. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
8ee018d863
commit
88dd321cfe
@@ -979,6 +979,8 @@ static int merge(int argc, const char **argv, const char *prefix,
|
||||
else { /* Merge has unresolved conflicts */
|
||||
struct worktree **worktrees;
|
||||
const struct worktree *wt;
|
||||
char *path;
|
||||
|
||||
/* Update .git/NOTES_MERGE_PARTIAL with partial merge result */
|
||||
refs_update_ref(get_main_ref_store(the_repository), msg.buf,
|
||||
"NOTES_MERGE_PARTIAL", &result_oid, NULL,
|
||||
@@ -994,10 +996,13 @@ static int merge(int argc, const char **argv, const char *prefix,
|
||||
if (refs_update_symref(get_main_ref_store(the_repository), "NOTES_MERGE_REF", notes_ref, NULL))
|
||||
die(_("failed to store link to current notes ref (%s)"),
|
||||
notes_ref);
|
||||
|
||||
path = repo_git_path(the_repository, NOTES_MERGE_WORKTREE);
|
||||
fprintf(stderr, _("Automatic notes merge failed. Fix conflicts in %s "
|
||||
"and commit the result with 'git notes merge --commit', "
|
||||
"or abort the merge with 'git notes merge --abort'.\n"),
|
||||
git_path(NOTES_MERGE_WORKTREE));
|
||||
path);
|
||||
free(path);
|
||||
}
|
||||
|
||||
free_notes(t);
|
||||
|
||||
Reference in New Issue
Block a user