unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Emacs developers <Emacs-devel@gnu.org>
Subject: Re: More build times
Date: Sat, 25 Jun 2022 21:34:45 +0700	[thread overview]
Message-ID: <CAP_d_8VrmXEZc6smyLEAA07P=K5jJS==JbqOxgd7fUFYw9t82w@mail.gmail.com> (raw)
In-Reply-To: <87pmiwj1st.fsf@gnus.org>

> 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.



  parent reply	other threads:[~2022-06-25 14:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25 12:17 More build times Lars Ingebrigtsen
2022-06-25 13:44 ` Lars Ingebrigtsen
2022-06-25 13:51   ` Tor Kringeland
2022-06-25 14:41     ` Lars Ingebrigtsen
2022-06-25 15:15       ` Andreas Schwab
2022-06-25 14:16   ` Eli Zaretskii
2022-06-25 14:44     ` Lars Ingebrigtsen
2022-06-25 15:16       ` Eli Zaretskii
2022-06-25 15:30         ` Lars Ingebrigtsen
2022-06-29 16:22           ` Gregory Heytings
2022-06-30  8:12             ` Lars Ingebrigtsen
2022-06-30  8:30               ` Gregory Heytings
2022-06-30  8:47                 ` Stephen Berman
2022-06-30  8:49                 ` Lars Ingebrigtsen
2022-06-30  8:42               ` Andreas Schwab
2022-06-30  8:55                 ` Stephen Berman
2022-06-30 16:07               ` Juri Linkov
2022-06-30 16:31                 ` Andreas Schwab
2022-06-30 17:10                   ` Juri Linkov
2022-06-30 13:27             ` Mattias Engdegård
2022-06-30 17:50               ` Gregory Heytings
2022-06-30 17:53                 ` Gregory Heytings
2022-06-25 14:34   ` Yuri Khan [this message]
2022-06-25 14:49     ` Lars Ingebrigtsen
2022-06-26  8:30       ` Stefan Monnier
2022-06-26 15:38         ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAP_d_8VrmXEZc6smyLEAA07P=K5jJS==JbqOxgd7fUFYw9t82w@mail.gmail.com' \
    --to=yuri.v.khan@gmail.com \
    --cc=Emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).