From: Junio C Hamano <gitster@pobox•com>
To: Andrew Wong <andrew.kw.w@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge
Date: Mon, 17 Mar 2014 14:54:02 -0700 [thread overview]
Message-ID: <xmqqwqfsbif9.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1394771872-25940-4-git-send-email-andrew.kw.w@gmail.com> (Andrew Wong's message of "Fri, 14 Mar 2014 00:37:52 -0400")
Andrew Wong <andrew.kw.w@gmail•com> writes:
> During a merge, "--mixed" is most likely not what the user wants. Using
> "--mixed" during a merge would leave the merged changes and new files
> mixed in with the local changes. The user would have to manually clean
> up the work tree, which is non-trivial. In future releases, we want to
> make "git reset" error out when used in the middle of a merge. For now,
> we simply print out a warning to the user.
>
> Signed-off-by: Andrew Wong <andrew.kw.w@gmail•com>
> ---
> builtin/reset.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/builtin/reset.c b/builtin/reset.c
> index 4fd1c6c..04e8103 100644
> --- a/builtin/reset.c
> +++ b/builtin/reset.c
> @@ -331,8 +331,29 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
> _(reset_type_names[reset_type]));
> }
> if (reset_type == NONE)
> + {
> reset_type = MIXED; /* by default */
>
> + /* During a merge, "--mixed" is most likely not what the user
Two style niggles here.
> + * wants. Using "--mixed" during a merge would leave the merged
> + * changes and new files mixed in with the local changes. The
> + * user would have to manually clean up the work tree, which is
> + * non-trivial. In future releases, we want to make "git reset"
"we want"? Has any of us decided on that?
> + * error out when used in the middle of a merge. For now, we
> + * simply print out a warning to the user. */
> + if (is_merge())
> + warning(_("You have used 'git reset' in the middle of a merge. 'git reset' defaults to\n"
> + "'git reset --mixed', which means git will not clean up any merged changes and\n"
> + "new files that were created in the work tree. It also becomes impossible for\n"
> + "git to automatically clean up the work tree later, so you would have to clean\n"
> + "up the work tree manually. To avoid this next time, you may want to use 'git\n"
> + "reset --merge', or equivalently 'git merge --abort'.\n"
> + "\n"
> + "In future releases, using 'git reset' in the middle of a merge will result in\n"
> + "an error."
> + ));
> + }
> +
> if (reset_type != SOFT && reset_type != MIXED)
> setup_work_tree();
next prev parent reply other threads:[~2014-03-17 21:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 4:37 [PATCH 0/3] Make git more user-friendly during a merge conflict Andrew Wong
2014-03-14 4:37 ` [PATCH 1/3] wt-status: Make status messages more consistent with others Andrew Wong
2014-03-17 21:51 ` Junio C Hamano
2014-03-14 4:37 ` [PATCH 2/3] merge: Advise user to use "git merge --abort" to abort merges Andrew Wong
2014-03-17 21:58 ` Junio C Hamano
2014-03-14 4:37 ` [PATCH 3/3] reset: Print a warning when user uses "git reset" during a merge Andrew Wong
2014-03-14 14:33 ` Marc Branchaud
2014-03-14 17:04 ` Andrew Wong
2014-03-14 20:55 ` Junio C Hamano
2014-03-14 21:35 ` Andrew Wong
2014-03-15 19:23 ` Marc Branchaud
2014-03-17 21:54 ` Junio C Hamano [this message]
2014-03-17 23:04 ` [PATCH 0/3] Make git more user-friendly during a merge conflict Junio C Hamano
2014-03-17 23:25 ` Andrew Wong
2014-03-19 22:30 ` 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=xmqqwqfsbif9.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=andrew.kw.w@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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