From owner-freebsd-git@freebsd.org Wed May 29 14:41:27 2019 Return-Path: Delivered-To: freebsd-git@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 002E015C4CA2 for ; Wed, 29 May 2019 14:41:26 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it1-f180.google.com (mail-it1-f180.google.com [209.85.166.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 131A36F719; Wed, 29 May 2019 14:41:25 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it1-f180.google.com with SMTP id m3so4263879itl.1; Wed, 29 May 2019 07:41:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3T4hz4NWggxvpSY7dvDhVYYRMrOI9eZmSsbO+5lL1fE=; b=JVJGC6oI9aX4vTNC5aznTAyThWIP8ZE/b4aNBG9duklrAoMrCKnmrVVDeXRyRELyXT u71ZY0QUwC6XFB7E9kBdqCPapMIymp/Ya7O0aMaYmwpkTuvp1yJdoD5GnYfjwSS1yXZt GPKj1S1qnmUl2Y7dJvx9YP/iMvZ/rjMyOQXqQtI6/eLKxrI5DHtuTfE2UW8B0d6+LiqA blhDkmACTArnQ0LPQ9zgZZ86eogbtz7jg63h/AqCbpMvruFZyVi+lEj3XknELfzvFdlf EBk8GTQx4Wyk8N7u51Hr4O7pNucLqNG0AE4h5zt/Hbe9U5frwSfqm2bxwnjmzaR9Kk+0 gerA== X-Gm-Message-State: APjAAAVeOvuVtK/izPPo6icdAaz6Msb4R6Cp6skQrcjzOTIt4ySBhXUH GsBB416CtOksxYlabD4Ewb5AMJTEt7IpRtevzjiuZQ== X-Google-Smtp-Source: APXvYqy9gWe+Nz2UE4u5Le+UzgS5rH+BxqFMdrUOUQ48+Hz4RSElClnRPzz7wWRxsFzIC/WF8acshaft1zWYoetbJfE= X-Received: by 2002:a24:ac52:: with SMTP id m18mr6990538iti.146.1559140883418; Wed, 29 May 2019 07:41:23 -0700 (PDT) MIME-Version: 1.0 References: <8697933A-B813-4088-90B7-A84589C3CD33@freebsd.org> In-Reply-To: <8697933A-B813-4088-90B7-A84589C3CD33@freebsd.org> From: Ed Maste Date: Wed, 29 May 2019 10:41:07 -0400 Message-ID: Subject: Re: Git handling of commit times To: Devin Teske Cc: freebsd-git@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 131A36F719 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.180 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-5.48 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.53)[ip: (-6.94), ipnet: 209.85.128.0/17(-3.38), asn: 15169(-2.29), country: US(-0.06)]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[180.166.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.94)[-0.936,0]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[180.166.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-git@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion of git use in the FreeBSD project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2019 14:41:27 -0000 On Tue, 28 May 2019 at 23:20, Devin Teske wrote: > > > > > Did anyone ever find an elegant solution to preventing the following edge-case? > > > > 1. Committer uses a VM but keeps it paused most of the time > > > > 2. Committer unpauses VM and makes a commit without first running ntpdate to correct the clock of the paused VM > > > > 3. Committer pushes commit with a timestamp that predates the timestamp for the previous commit on the file in-question > > > > In this case, GitHub renders the commits our of order. If memory serves, "git log" will show them in the proper order, but github web interface shows them in wrong order. It seems to me there are two separate issues here - committing with an incorrect system time, and GitHub's rendering. We should try to avoid the first case (e.g., by hooking into VM infrastructure to have the date set correctly after resume) where we can. I haven't actually checked GitHub's ordering. Git tracks the author and commit timestamps separately. They're often the same (e.g. if I commit a change and push it to a repository) but don't have to be - for example, if I cherry-pick change from someone the author time will be when they originally wrote it, while the commit time will be the time of my cherry-pick. There are other cases where the author time of a pair of changes will be out of order with respect to the commit ordering of those changes -- I may have a change to a file in my tree that I haven't pushed anywhere yet. If you then make a change to that file and I rebase, my change will come after in the commit graph but will have an earlier author time. > > I think there was some talk of a hook to prevent timestamps moving backward with respect to each object being touched in a pushed commit -- is this even possible to prevent? I believe a hook that prevents commit times from going backwards or being ahead of the server time would serve this purpose, but I haven't investigated in any detail. I'm also not sure off hand how GitHub, git, and other tools use author vs commit dates. This is something else that will need more investigation.