git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] mergetool: clean up temp files when aborted

From
Phil Hord <phil.hord@gmail.com>
Date
Jan 24, 2013, 21:16 UTC
Message-ID
<CABURp0qxj0HVHbYOR1Enfx_A1-ALPDGhLriGp=gab-LBigwt8g@mail.gmail.com>
In-Reply-To
<7vbocebblo.fsf@alter.siamese.dyndns.org>
On Thu, Jan 24, 2013 at 2:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 39 quoted lines
> Phil Hord <hordp@cisco.com> writes:
>
>> When handling a symlink conflict or a deleted-file conflict, mergetool
>> stops to ask the user what to do. If the user chooses any option besides
>> "(a)bort", then the temporary files which mergetool created in
>> preparation for handling the conflict are removed.  But these temporary
>> files are not removed when the user chooses to abort the operation.
>>
>>     $ git cherry-pick other/branch
>>     error: could not apply 4e43581... Fix foo.c
>>
>>     $ git status --short
>>     DU foo.c
>>
>>     $ git mergetool
>>     Merging:
>>     foo.c
>>
>>     Deleted merge conflict for 'foo.c':
>>       {local}: deleted
>>       {remote}: modified file
>>     Use (m)odified or (d)eleted file, or (a)bort? a
>>     Continue merging other unresolved paths (y/n) ? n
>>
>>     $ git status --short
>>     DU foo.c
>>     ?? foo.c.BACKUP.16929.c
>>     ?? foo.c.BASE.16929.c
>>     ?? foo.c.LOCAL.16929.c
>>     ?? foo.c.REMOTE.16929.c
>>
>> These temporary files should not remain after the mergetool operation is
>> completed.
>
> Aren't there cases where people "abort" so that they can have a
> chance inspect them outside mergetool program?  If there are no such
> cases, then I would agree with your claim "should not remain", but
> the proposed log message does not explay why it is sure that there
> are no such use cases.

You may be right about other people's workflows which I forgot to consider. I have noticed a lot of inconsistency in this tool wrt to mergetool.keepBackup and mergetool.keepTemporaries. Perhaps this change should hinge on the latter.

Would you agree with this rephrased statement (accompanied by matching logic)?
    When mergetool.keepTemporaries is false or not set, these temporary files
    should not remain when the mergetool operation is aborted.
Here is the wording from git help config:
      mergetool.keepBackup
           After performing a merge, the original file with conflict
markers can be saved as a file with a .orig extension. If this
variable is set to false then this file
           is not preserved. Defaults to true (i.e. keep the backup files).
       mergetool.keepTemporaries
           When invoking a custom merge tool, git uses a set of
temporary files to pass to the tool. If the tool returns an error and
this variable is set to true, then
           these temporary files will be preserved, otherwise they
will be removed after the tool has exited. Defaults to false.

I have another commit in the works to clean up consistency around the keepBackup. I'll re-roll this one at the same time.

Phil
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 4 in “mergetool: clean up temp files when aborted”
  1. mergetool: clean up temp files when abortedPhil Hord, Jan 24, 2013
  2. Junio C HamanoJan 24, 2013
  3. Phil HordJan 24, 2013
  4. Junio C HamanoJan 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.