All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.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 15:51:38 +0200	[thread overview]
Message-ID: <220401.86czi0oqfl.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YkbQnnB8GSzuAROh@vmiklos.hu>


On Fri, Apr 01 2022, Miklos Vajna wrote:

> Hi Ævar,
>
> On Fri, Apr 01, 2022 at 11:57:33AM +0200, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
>> So (just making sure I understand this) in this case the --since option
>> is behaving as expected in the sense that the information in the commit
>> itself matches what it's finding, but what you'd really like for it to
>> consider some "adjusted" commit date?
>> 
>> I.e. to be smart enough to spot that it should include a commit from
>> 2021 if all the preceding commits are from 2022, or some other similar
>> heuristic?
>
> No heuristics. Just a way to not stop at the first commit that doesn't
> match the --since criteria. Here is an example:
>
> Given:
>
> rm -rf .git file
> git init
> echo a > file
> git add file
> git commit -m init
> echo a >> file
> git add file
> GIT_COMMITTER_DATE="2021-01-01 0:00" git commit -m second
> echo a >> file
> git add file
> git commit -m third
>
> When I do:
>
> git log --pretty=oneline --since="2022-01-01"
>
> Then current I get:
>
> 91a24b6ccba6b1d26c3bd5bcea7ff86e6997b599 (HEAD -> master) third
>
> And I would like to have an opt-in way to instead get:
>
> 91a24b6ccba6b1d26c3bd5bcea7ff86e6997b599 (HEAD -> master) third
> e259a40784d3d70f3878105adac380c8e8a8ae52 init
>
> Arguing that both "init" and "third" was committed this year.

Indeed.

> The question is if there is a way to do this already (perhaps I missed
> something in the docs or didn't notice it while I briefly researched the
> commit walk code), or in case I want to do this, then would it make
> sense to have this feature in git or this is more a "run git rev-list
> and do your own filtering" case?

I think it might make sense to have it as feature, but hopefully we
could piggy-back on the date adjustment that the commit-graph needs to
do already, I'm not sure if we save that information anywhere though...

The assumption with --since was that this sort of timestamp drift
wouldn't be this bad, so mostly it works out. It could be made to work
like --grep, but then it needs to walk the whole history if no other
limit is provided.

So it'll be very slow if you just want --since=2.weeks.ago, but
accurate.

I think an alternate solution to this in the meantime is to use "git
replace" as a band-aid, I haven't tried, but you should be able to
replace the relevant commit with one that has adjusted dates.

  reply	other threads:[~2022-04-01 13:59 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 [this message]
2022-04-01 17:51 ` Junio C Hamano
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=220401.86czi0oqfl.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.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.