From: Junio C Hamano <gitster@pobox.com>
To: Phil Hord <hordp@cisco.com>
Cc: git@vger.kernel.org, phil.hord@gmail.com,
"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [PATCH] mergetool: clean up temp files when aborted
Date: Thu, 24 Jan 2013 11:54:43 -0800 [thread overview]
Message-ID: <7vbocebblo.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1359051829-21331-1-git-send-email-hordp@cisco.com> (Phil Hord's message of "Thu, 24 Jan 2013 13:23:49 -0500")
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.
>
> Remove the temporary files by calling the cleanup_temp_files when the
> user chooses to abort the mergetool operation.
>
> It looks like 'cleanup_temp_files' without the --save-backups option is
> the correct thing to do, and this is how this commit is implemented. But
> some other paths do use --save-backups resulting in a foo.c.orig file
> being left behind. That seems to be a different bug, though.
>
> Signed-off-by: Phil Hord <hordp@cisco.com>
> ---
> git-mergetool.sh | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index c50e18a..bb93b70 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -90,6 +90,7 @@ resolve_symlink_merge () {
> return 0
> ;;
> [aA]*)
> + cleanup_temp_files
> return 1
> ;;
> esac
> @@ -118,6 +119,7 @@ resolve_deleted_merge () {
> return 0
> ;;
> [aA]*)
> + cleanup_temp_files
> return 1
> ;;
> esac
next prev parent reply other threads:[~2013-01-24 19:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 18:23 [PATCH] mergetool: clean up temp files when aborted Phil Hord
2013-01-24 19:54 ` Junio C Hamano [this message]
2013-01-24 21:16 ` Phil Hord
2013-01-24 21:41 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vbocebblo.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=hordp@cisco.com \
--cc=phil.hord@gmail.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).