git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git enhancement request - checkout (clone) set modified dates to commit date

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Apr 22, 2018, 18:09 UTC
Message-ID
<20180422180912.GK14631@genre.crustytoothpaste.net>
In-Reply-To
<585A3A2E-7DA6-4718-BF85-2D17AAAF3EF5@schemaczar.com>
On Sun, Apr 22, 2018 at 01:18:10PM -0400, Andrew Wolfe wrote:
> I would like to propose that the checkout process set the create and modification times of a file to the timestamp at which a file was committed.

The reason Git doesn't do this is pretty simple: make and various other tools do rebuilds depending on timestamps.

If I create a branch off master and make some commits, then switch back to master, I will want the changed files to have their timestamps updated to be newer so that a make on master will rebuild dependencies based on those files. If I set the files to the commit timestamp, those files would be set to the timestamp of master, which is older than my new branch, and make wouldn't work properly.

There are some cases where people want the behavior you requested, such as for reproducible builds, and in such cases, you can use a post-checkout hook to set timestamps with touch.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Andrew WolfeNext: Andrew Wolfe
Message 2 of 6 in “Git enhancement request - checkout (clone) set modified dates to commit date”
  1. Andrew WolfeApr 22, 2018
  2. brian m. carlsonApr 22, 2018
  3. Andrew WolfeApr 22, 2018
  4. Kevin DaudtApr 22, 2018
  5. Andrew WolfeApr 23, 2018
  6. Jacob KellerApr 23, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.