list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Piotr Krukowiecki <>
To: Junio C Hamano <>
Cc: Derrick Stolee <>,
	Git Mailing List <>
Subject: Re: git-log on a file, and merges
Date: Sat, 3 Aug 2019 10:31:28 +0200	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Aug 2, 2019 at 9:32 PM Junio C Hamano <> wrote:
> Piotr Krukowiecki <> writes:
> > At this moment I'm not sure myself if I consider this a bug or not.
> This definitely is not a bug but is a designed and intended
> behaviour.

(generally speaking)
By "bug" I mean wrong behaviour. Designs can be buggy too.

> Think of running "git log" without "--full-history" that is limited
> with a pathspec as a tool to ask Git to show _one_ way (preferrably
> the simplest one) to explain how the current contents in paths that
> match the pathspec came to be.  The "just explain to me one way" is
> not about machine performance but reducing the clutter in the output
> to help human reader(s) reading an otherwise complex history.

From this point of view, the current behavior is good.

Although it's inconsistent. It works only for merges. If I'm on one
branch and change a file and then revert the change, "git log -- file"
will still show the commits. From your explanation, I'd expect those
commits to be skipped, since they are "no-op".

Also, I did read git-log docs before posting here, but still could not
find clear explanation for this behavior. Is it possible to improve

For example:

    [--] <path>…
    Show only commits that are enough to explain how the files that
match the specified paths came to be. See History Simplification below
for details and other simplification modes.

For me, the commits which modify the file are relevant to "how the
file come to be". They show what was tried and that finally the
original solution was choosen as the best. So not showing them is not
"enough to explain".
Also "History Simplification" is not very clear.

So maybe something like this? (just a rfc)

diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt
index b406bc4c48..bfb3d68b8b 100644
--- a/Documentation/git-log.txt
+++ b/Documentation/git-log.txt
@@ -91,9 +91,10 @@ include::line-range-format.txt[]
        section of linkgit:gitrevisions[7].

 [--] <path>...::
        Show only commits that are enough to explain how the files
-       that match the specified paths came to be.  See 'History
+       that match the specified paths came to be. Some commits may be
+       not shown even if they modify the specified paths. See 'History
        Simplification' below for details and other simplification
 Paths may need to be prefixed with `--` to separate them from
diff --git a/Documentation/rev-list-options.txt
index bb1251c036..d2de33b219 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -317,13 +317,15 @@ endif::git-rev-list[]
 History Simplification

 Sometimes you are only interested in parts of the history, for example the
-commits modifying a particular <path>. But there are two parts of
-'History Simplification', one part is selecting the commits and the other
-is how to do it, as there are various strategies to simplify the history.
+commits modifying a particular <path>. This is a two-step process:

-The following options select the commits to be shown:
+* initialial list of commits is selected
+* the list is simplified - some commits may be not shown
+The following options select the initial list of commits:

        Commits modifying the given <paths> are selected.

@@ -337,9 +339,11 @@ The following options affect the way the
simplification is performed:
 Default mode::
        Simplifies the history to the simplest history explaining the
        final state of the tree. Simplest because it prunes some side
        branches if the end result is the same (i.e. merging branches
-       with the same content)
+       with the same content). This may happen for example when there
+       were commits which changed files, but then those changes were
+       reverted. Such commits will not be shown.

        Same as the default mode, but does not prune some history.

Piotr Krukowiecki

      reply	other threads:[~2019-08-03  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-02  9:38 Piotr Krukowiecki
2019-08-02 14:22 ` Derrick Stolee
2019-08-02 19:21   ` Piotr Krukowiecki
2019-08-02 19:32     ` Junio C Hamano
2019-08-03  8:31       ` Piotr Krukowiecki [this message]

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \
    --subject='Re: git-log on a file, and merges' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

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 read-only IMAP folder(s) and NNTP newsgroup(s).