* git log omits deleting merges
@ 2014-02-20 7:35 Ephrim Khong
2014-03-20 19:54 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Ephrim Khong @ 2014-02-20 7:35 UTC (permalink / raw)
To: git
Hi, git log seems to omit merge commits that delete a file if --follow
or --diff-filter=D is given. Below is a testcase. I'm not sure if it is
desired behaviour for --diff-filter=D, but it's probably not correct
that --follow _removes_ the merge commit from the log output.
Thanks - Eph
--
git init
touch some_file
git add some_file
git commit -m "initial"
git branch other_branch
echo foo > some_file
git commit -a -m "commit in master"
git checkout other_branch
echo bar > some_file
git commit -a -m "commit in other_branch"
git merge master --no-commit
rm some_file
git rm some_file
git commit -m "merge"
echo "log 1 - no output"
# note that --diff-filter=A and M work as expected
# the merge does not show up for --diff-filter=ACDMRTUXB either
git log --pretty=oneline --diff-filter=D -- some_file
echo "log 2 - merge is missing"
git log --pretty=oneline --follow --all -- some_file
echo "log 3 - complete"
git log --pretty=oneline --all -- some_file
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log omits deleting merges
2014-02-20 7:35 git log omits deleting merges Ephrim Khong
@ 2014-03-20 19:54 ` Jeff King
2014-03-20 22:56 ` Philip Oakley
2014-03-24 10:25 ` Ephrim Khong
0 siblings, 2 replies; 6+ messages in thread
From: Jeff King @ 2014-03-20 19:54 UTC (permalink / raw)
To: Ephrim Khong; +Cc: git
On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:
> Hi, git log seems to omit merge commits that delete a file if --follow or
> --diff-filter=D is given. Below is a testcase. I'm not sure if it is desired
> behaviour for --diff-filter=D, but it's probably not correct that --follow
> _removes_ the merge commit from the log output.
This is by design. Git-log does not calculate or show merge diffs unless
"-c" or "--cc" is specified, and thus no diff-filter can match.
> echo "log 1 - no output"
> # note that --diff-filter=A and M work as expected
> # the merge does not show up for --diff-filter=ACDMRTUXB either
> git log --pretty=oneline --diff-filter=D -- some_file
Try:
git log -c --diff-filter=D -- some_file
which does show it.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log omits deleting merges
2014-03-20 19:54 ` Jeff King
@ 2014-03-20 22:56 ` Philip Oakley
2014-03-21 5:23 ` Jeff King
2014-03-24 10:25 ` Ephrim Khong
1 sibling, 1 reply; 6+ messages in thread
From: Philip Oakley @ 2014-03-20 22:56 UTC (permalink / raw)
To: Jeff King, Ephrim Khong; +Cc: Git List
From: "Jeff King" <peff@peff.net>
> On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:
>
>> Hi, git log seems to omit merge commits that delete a file
>> if --follow or
>> --diff-filter=D is given. Below is a testcase. I'm not sure if it is
>> desired
>> behaviour for --diff-filter=D, but it's probably not correct
>> that --follow
>> _removes_ the merge commit from the log output.
>
> This is by design. Git-log does not calculate or show merge diffs
> unless
> "-c" or "--cc" is specified, and thus no diff-filter can match.
This is hard to discern from the log(1) man page as this conflates
commit inclusion (limiting?) with the diff formatting.
The -c and -cc options are listed in the diff formatting section, but
that's well down the man page. Even then, the note for the options
doesn't say that it will cause the log output to now include the merge
commits.
Perhaps the -c and -cc options should also be noted in the options or
the commit limiting section, but exactly where is probably contentious
(maybe under the --merges).
(or I may have misunderstood)
>
>> echo "log 1 - no output"
>> # note that --diff-filter=A and M work as expected
>> # the merge does not show up for --diff-filter=ACDMRTUXB either
>> git log --pretty=oneline --diff-filter=D -- some_file
>
> Try:
>
> git log -c --diff-filter=D -- some_file
>
> which does show it.
>
> -Peff
> --
Philip
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log omits deleting merges
2014-03-20 22:56 ` Philip Oakley
@ 2014-03-21 5:23 ` Jeff King
0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2014-03-21 5:23 UTC (permalink / raw)
To: Philip Oakley; +Cc: Ephrim Khong, Git List
On Thu, Mar 20, 2014 at 10:56:58PM -0000, Philip Oakley wrote:
> >This is by design. Git-log does not calculate or show merge diffs
> >unless
> >"-c" or "--cc" is specified, and thus no diff-filter can match.
>
> This is hard to discern from the log(1) man page as this conflates
> commit inclusion (limiting?) with the diff formatting.
>
> The -c and -cc options are listed in the diff formatting section, but
> that's well down the man page. Even then, the note for the options doesn't
> say that it will cause the log output to now include the merge commits.
Merge commits are always considered. But we don't show merge _diffs_
without "-c" or "--cc". And they cannot match a diff-filter if we don't
calculate the diffs.
That being said, I can certainly imagine there is room for improvement
in the documentation. The --diff-filter option is in the "diff options"
section, but perhaps the top of that section might want to make special
mention of "-c" and "--cc"?
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log omits deleting merges
2014-03-20 19:54 ` Jeff King
2014-03-20 22:56 ` Philip Oakley
@ 2014-03-24 10:25 ` Ephrim Khong
2014-03-24 14:19 ` Jeff King
1 sibling, 1 reply; 6+ messages in thread
From: Ephrim Khong @ 2014-03-24 10:25 UTC (permalink / raw)
To: git
Am 20.03.14 20:54, schrieb Jeff King:
> On Thu, Feb 20, 2014 at 08:35:33AM +0100, Ephrim Khong wrote:
>
>> Hi, git log seems to omit merge commits that delete a file if --follow or
>> --diff-filter=D is given. Below is a testcase. I'm not sure if it is desired
>> behaviour for --diff-filter=D, but it's probably not correct that --follow
>> _removes_ the merge commit from the log output.
>
> This is by design. Git-log does not calculate or show merge diffs unless
> "-c" or "--cc" is specified, and thus no diff-filter can match.
Thank you for the explanation, I now understand why this is happening
from a technical point of view. From a usability perspective, it is a
bit confusing that a flag that should intuitively increase the number of
shown commits (--follow) removes a commit from the output. Though this
is just a minor annoyance, so no strong opinion here.
- Eph
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: git log omits deleting merges
2014-03-24 10:25 ` Ephrim Khong
@ 2014-03-24 14:19 ` Jeff King
0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2014-03-24 14:19 UTC (permalink / raw)
To: Ephrim Khong; +Cc: git
On Mon, Mar 24, 2014 at 11:25:32AM +0100, Ephrim Khong wrote:
> Thank you for the explanation, I now understand why this is happening from a
> technical point of view. From a usability perspective, it is a bit confusing
> that a flag that should intuitively increase the number of shown commits
> (--follow) removes a commit from the output. Though this is just a minor
> annoyance, so no strong opinion here.
Sorry, I focused on the --diff-filter aspect of your question. As for
--follow, I think that is less "by design" and more "what happens to
occur, because --follow is a bit of a hack".
So there may be a bug, or room for improvement in the code there, though
if the solution involves turning on diffs for all merges, that may be
prohibitively expensive.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-03-24 14:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 7:35 git log omits deleting merges Ephrim Khong
2014-03-20 19:54 ` Jeff King
2014-03-20 22:56 ` Philip Oakley
2014-03-21 5:23 ` Jeff King
2014-03-24 10:25 ` Ephrim Khong
2014-03-24 14:19 ` Jeff King
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).