Re: git log --since to not stop after first old commit?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miklos Vajna <vmiklos@xxxxxxxxxx> 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.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux