Johan Herland [off-list ref] writes:
On Wed, Mar 14, 2012 at 12:59, Johannes Sixt [off-list ref] wrote:
...
quoted
I doubt that the use-case that is tested here makes sense.
As David wrote, the use case is likely to pop up among regular users.
We can't simply ignore it.
quoted
Or .git/NOTES_MERGE_WORKTREE should not be removed. Would it be an option
to clear it out only when it is needed, right before it is filled again?
Maybe, but then we wouldn't be able to warn or abort in the case where
there is a previous unfinished notes merge, and the user tries to
start a new notes merge. Instead, we'd silently overwrite the previous
unfinished notes merge...
We cannot simply ignore it.
You _could_ do is perhaps to do something like:
- when you notice that you need to ask the user to hand-merge a temporary
file (i.e. when 'notes merge' is run), check if .git/N_M_W/done exists.
- If you see that marker file, remove it everything in the
directory, deposit the temporary file you want the user to edit,
and expect the user to later tell you that he is done by "notes
merge --commit";
- If you don't, the user didn't give you "notes merge --commit"
during the earlier run. Tell him to first abandon the previous
round with "notes merge --abandon" or something.
- "notes merge --commit" will just mark .git/N_M_W/ with "done".
- "notes merge --abandon" will remove .git/N_M_W/.
but it only supports the simplest "Run 'notes merge', cd to .git/N_M_W,
edit all, run 'notes merge --commit'" workflow. If the user decides to
abandon instead of commit, he will be inside the problematic directory, so
trying to be more elaborate like the above does not really solve anything
fundamental. The user has to come out of that temporary directory
eventually anyway.
So I think the following is not just an improvement over the current code,
but probably an acceptable solution, given its simplicity.
Maybe it's better to simply detect if cwd is inside
.git/NOTES_MERGE_WORKTREE, and then abort, telling the user to chdir
out before trying again?