* Possible tiny bug in reset's error message
@ 2017-03-13 14:55 Martin Kletzander
0 siblings, 0 replies; only message in thread
From: Martin Kletzander @ 2017-03-13 14:55 UTC (permalink / raw)
To: git
Hi,
when I was trying to learn some details about various types of resets, I
found out that the default reset type is --mixed, but not specifying it
is not the same as specifying it. That's mostly because there are some
checks for reset_type before setting it to default value. Since one of
the checks seem deliberate, I'm rather asking here before sending wrong
patch.
The "bug" I am talking about is:
$ g reset -p --mixed
fatal: --patch is incompatible with --{hard,mixed,soft}
$ g reset -p
No changes.
Despite the fact that `git help reset` says:
If <mode> is omitted, defaults to "--mixed".
The reason why I'm rather asking is the part of the code that handles
the warning message for:
$ git reset --mixed -- path
warning: --mixed with paths is deprecated; use 'git reset -- <paths>'
instead.
Specifically:
/* git reset tree [--] paths... can be used to
* load chosen paths from the tree into the index without
* affecting the working tree nor HEAD. */
if (pathspec.nr) {
if (reset_type == MIXED)
warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));
else if (reset_type != NONE)
die(_("Cannot do %s reset with paths."),
_(reset_type_names[reset_type]));
}
See how NONE and MIXED are both purposefully checked?
So my question is, should reset_type be set to MIXED if it was not
specified on the command-line before all these checks? If not, what's
the reason for that?
Have a nice day,
Martin
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-13 14:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-13 14:55 Possible tiny bug in reset's error message Martin Kletzander
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).