emacs-devel
[Top][All Lists]
Advanced

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

Re: More build times


From: Yuri Khan
Subject: Re: More build times
Date: Sat, 25 Jun 2022 21:34:45 +0700

> It's a git artefact.  For instance, this is what "git log" says:
>
> commit 61a312ba0cae10e8e19b7424540751a71d0170b1
> Date:   Fri Jun 17 10:24:05 2022 +0800
>
> commit f419de6eca4ca6a6d03db1eec4b9086a3d1e5b86
> Date:   Thu Jun 16 09:48:05 2022 +0200

> No intervening commits or anything, but checking out f419de6eca and
> 61a312ba0c give you vastly different trees -- presumably because of
> merges and the like (since f419de6eca4 originated in emacs-28).

Yes:

    $ git fetch
    $ git log --oneline --graph --decorate --date-order origin/master
    […]
    * | | cce197c630 Fix instances of not using a usable Motif drag atom
    * | | d1a10a1cf2 Merge from origin/emacs-28
    |\| |
    * | | a8cf6567dd Improve window manager user time reporting mode switching
→   * | | 61a312ba0c Update last event time during DND operations
→   | * | f419de6eca * lisp/textmodes/artist.el: Minor doc fixes.
    * | | e75ce9ca38 * src/fns.c (Fmapconcat): Optimize the case where
separator==""
    * | | cd9b920217 Fix Tramp test
    […]

The two commits are adjacent in date order but live on different
branches, one having been merged into the other a couple commits
later.

> Is there a way to make git cough up the commit on the master branch for
> a specific date?  I.e., "what was the state on the master branch at
> Fri Jun 17 06:30:35 2022 +0200"?

Not really. In Git, commits do not store the information about the
branch they were originally committed to. Branches keep timestamped
reflogs so you can ask them where they used to point at certain
moments of time, but, for remote tracking branches, that depends on
how regularly you update them (do a ‘git fetch’).

For example:

1. You have a clone of a repository as of 2022-05-16. Its
origin/master points at commit A.
2. On 2022-05-17, someone pushes commit B.
3. On 2022-05-18, someone else pushes commit C.
4. On 2022-05-19, you do a ‘git fetch’.

Now your remote tracking branch origin/master points at the commit C,
and the last two records of its reflog are “on 2022-05-19, I moved
from A to C as a result of a ‘git fetch’” and “on 2022-05-16, I moved
from […] to A as a result of […]”.

‘git rev-list -n 1 --before=<date> origin/master’ will give you *some*
commit that is reachable from origin/master and was committed before
the specified date, but it might be from a branch that was merged
later than that date.

What you can do is ‘git rev-list -n 1 --before=<date> --first-parent
origin/master’ and hope people don’t do things like “first merge
master into my feature branch, then fast-forward master to the
resulting merge commit” because this messes up the order of parent
links in the merge.

Compare the above commit graph with the following:

    $ git log --oneline --graph --decorate --date-order --first-parent
origin/master
    […]
    * cce197c630 Fix instances of not using a usable Motif drag atom
    * d1a10a1cf2 Merge from origin/emacs-28
    * a8cf6567dd Improve window manager user time reporting mode switching
→   * 61a312ba0c Update last event time during DND operations
    * e75ce9ca38 * src/fns.c (Fmapconcat): Optimize the case where separator==""
    * cd9b920217 Fix Tramp test
    […]

Note that f419de6eca is nowhere to be seen. It is only reachable from
origin/master over the second parent link in the merge d1a10a1cf2.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]