From: Junio C Hamano <hidden> Date: 2016-06-15 22:50:57
Michael J Gruber [off-list ref] writes:
quoted
Tests please?
Heck, we don't have any to begin with, and this is marked RFC. Given our
usual reluctance to change even undocumented behavior I'm not going to
bother with tests for an RFC.
Quite the contrary, a well written test is a concise and readable way to
illustrate what behaviour the proposed change is making, and helps judging
if it is going in a good direction. So if it is an RFC, a test would help
very much, especially if there isn't any in the area currently.
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
Junio C Hamano venit, vidit, dixit 31.03.2011 21:23:
Michael J Gruber [off-list ref] writes:
quoted
quoted
Tests please?
Heck, we don't have any to begin with, and this is marked RFC. Given our
usual reluctance to change even undocumented behavior I'm not going to
bother with tests for an RFC.
Quite the contrary, a well written test is a concise and readable way to
illustrate what behaviour the proposed change is making, and helps judging
if it is going in a good direction. So if it is an RFC, a test would help
very much, especially if there isn't any in the area currently.
While that may be true in some cases (e.g., providing sample output) I
don't think the commit message to 3/3 leaves anything open that a test
could clarify.
Michael
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
While thinking about how to redo 3/3 (show: do not prune by pathspec) I
noticed a somehow related reflog problem, which overrides some command line
options.
So, here is some refactoring, a test exposing the reflog problem, and a fix for
reflog (the new 1/4 through 3/4). Those 3 should be general good cleanup.
It turned out that the refactoring does not help with the show problem, but I
changed the old 3/3 so that we change the pruning by commits only when the user
has not requested to walk with show (the new 4/4). No time for new test now, sorry.
The old 1/3 and 2/3 ("Did you mean...") are not impacted (and not resent). They
make for independent good UI cleanup also (and were related thematically only,
not technically).
Michael J Gruber (4):
builtin/log.c: separate default and setup of cmd_log_init()
t/t1411: test reflog with formats
reflog: fix overriding of command line options
builtin/show: do not prune by pathspec
builtin/log.c | 32 +++++++++++++++++++-------------
t/t1411-reflog-show.sh | 18 ++++++++++++++++++
2 files changed, 37 insertions(+), 13 deletions(-)
--
1.7.4.2.668.gba03a4
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
cmd_log_init() sets up some default rev options and then calls
setup_revisions(), so that a caller cannot set up own defaults: Either
they get overriden by cmd_log_init() (if set before) or they override
the command line (if set after). We even complain about this in a
comment to cmd_log_reflog().
Therefore, separate the two steps so that one can still call
cmd_log_init() or, alternatively, cmd_log_init_defaults() followed by
cmd_log_init_finish() (and set defaults in between).
No functional change so far.
Signed-off-by: Michael J Gruber <redacted>
---
builtin/log.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
By design, "git show commit -- path" is not "git show commit:path", and
there is no reason to change that. But "git show commit -- path" simply
returns nothing at all "most of the time" because it prunes by pathspec
even though it does not walk commits. This is pretty useless.
So, turn off commit pruning (but keep diff limiting of course) so that
"git show commit -- path" shows the commit message and the diff that the
commit introduces to path (filtered by path); only the diff will be
empty "most of the time".
As an intended side effect, users mistaking "git show commit -- path"
for "git show commit:path" are automatically reminded that they asked
git to show a commit, not a blob.
In case the user has specified "--do-walk", assume they want the old
behaviour (prune by default).
Signed-off-by: Michael J Gruber <redacted>
---
builtin/log.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
"git reflog --format=short" does not work because "reflog" overrides the
format option. This is documented in code. Document this by a test
(known failure) also.
Signed-off-by: Michael J Gruber <redacted>
---
t/t1411-reflog-show.sh | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
From: Michael J Gruber <hidden> Date: 2016-06-15 22:50:57
Currently, "git reflog" overrides some command line options such as
"--format".
Fix this by using the new 2-phase version of cmd_log_init().
Signed-off-by: Michael J Gruber <redacted>
---
builtin/log.c | 9 ++-------
t/t1411-reflog-show.sh | 2 +-
2 files changed, 3 insertions(+), 8 deletions(-)