All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Miklos Vajna <vmiklos@vmiklos.hu>
Cc: git@vger.kernel.org
Subject: Re: git log --since to not stop after first old commit?
Date: Fri, 01 Apr 2022 10:51:34 -0700	[thread overview]
Message-ID: <xmqq1qygy9nd.fsf@gitster.g> (raw)
In-Reply-To: <Yka2GSGs3EIXm6Xt@vmiklos.hu> (Miklos Vajna's message of "Fri, 1 Apr 2022 10:21:45 +0200")

Miklos Vajna <vmiklos@vmiklos.hu> writes:

> I wanted to look at commits of a contributor from the last year, and
> noticed that I only see commits from this year, not last year when I use:
>
>         git log --author="that person" --since="1 year ago"
>
> Digging around in the history, one other contributor pushed a mistake on
> 1st Jan, where the author date was supposed to be 2022-01-01, but
> happened to be 2021-01-01. Knowing that, it makes sense that 'git log'
> stopped at that commit by default.
>
> I wonder though, is there any option to "force" git log to walk all
> reachable commits from HEAD, but just show the ones which match the
> --since criteria?
>
> Or is this need so special that the best is to parse the output of 'git
> rev-list' and do my own filtering for author and date?

Currently yes.  I am not sure if it is (or is not) worth changing,
though.

Many "git log" options make commits hidden from the output by
filtering each commit we find but keep digging the history further,
but some options make commits hidden by stopping the traversal.
"--until" is the former (there is no way to implement it as the
latter) but "--since" is the latter.

If we can implement more of these "commit hiding operations" as
traversal stoppers, it allows "log" to avoid doing unnecessary work,
and in a history without skewed timestamps, "--since" is a prime
candidate to take advantage of the fact that parent must be older
than any of its children (hence we can safely stop traversal once we
see an old enough commit) to be implemented as a "traversal stopper".
But in the presense of skewed timestamps, those commits behind one
commit with an incorrectly old timestamp will end up being hidden.

We could add a --since-as-filter= option or something, but then the
user needs to be careful when to stop (and digging down to the root
of the history, i.e. "never stop", may be an acceptable answer to
some projects).  We may be able to, when commit-graph (v2) with
adjusted timestamp data exist, stop before going down to the root,
but we would still need to add it as a different option because the
existing behaviour of "--since", to immediately stop upon seeing a
commit with a timestamp that is older than the given time, is so
well established and it would irritate users of existing scripts if
it changes all of a sudden.



  parent reply	other threads:[~2022-04-01 17:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01  8:21 git log --since to not stop after first old commit? Miklos Vajna
2022-04-01  9:57 ` Ævar Arnfjörð Bjarmason
2022-04-01 10:14   ` Miklos Vajna
2022-04-01 13:51     ` Ævar Arnfjörð Bjarmason
2022-04-01 17:51 ` Junio C Hamano [this message]
2022-04-01 21:36   ` [PATCH] git-log: add a --since-as-filter option Miklos Vajna
2022-04-02 10:09     ` [PATCH v2] " Miklos Vajna
2022-04-07 15:43   ` git log --since to not stop after first old commit? Miklos Vajna
2022-04-08  2:30     ` Junio C Hamano
2022-04-08 18:19       ` Junio C Hamano
     [not found]         ` <CANgJU+Wr+tKNPfeh4dst-E_LSnoYYmN1easqmkFUA9spp-rpKQ@mail.gmail.com>
2022-04-11  6:37           ` Miklos Vajna
2022-04-11  9:18             ` demerphq
2022-04-11 16:58           ` Junio C Hamano
2022-04-22 18:48             ` Junio C Hamano
2022-04-22 20:01               ` [PATCH v6] log: "--since-as-filter" option is a non-terminating "--since" variant Miklos Vajna
2022-04-22 22:11                 ` Junio C Hamano
2022-04-22 23:43                 ` Junio C Hamano
2022-04-23 12:59                   ` [PATCH v7] " Miklos Vajna
2022-04-08 21:01       ` [PATCH v3] git-log: add a --since=... --as-filter option Miklos Vajna
2022-04-12  8:47         ` Ævar Arnfjörð Bjarmason
2022-04-15 20:39           ` [PATCH v4] " Miklos Vajna
2022-04-15 23:13             ` Junio C Hamano
2022-04-16 14:23               ` [PATCH v5] log: "--as-filter" option adjusts how "--since" cut-off works Miklos Vajna
2022-04-22  6:50                 ` Miklos Vajna

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=xmqq1qygy9nd.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=vmiklos@vmiklos.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.