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
Andrew Wolfe <andrew@schemaczar.com>
Date
Apr 22, 2018, 19:01 UTC
Message-ID
<1FCE6958-FC75-4A9B-88A3-05AE991815E4@schemaczar.com>
In-Reply-To
<20180422180912.GK14631@genre.crustytoothpaste.net>
Hi Brian,
Not completely sure what you're saying.  If the files on master are not changed, the changed files' commit timestamps will be older than the branch commit timestamps.
However, if I check out master after committing to a branch, the modifications will necessarily disappear because they haven't been committed to master.  Instead, under my proposal, each will get the timestamp of its prior commit.
If you're doing a merge, it will entail a commit and, again, the modified files will be newer.
I don't think your use case breaks my proposal.
- Andrew Wolfe
Show 21 quoted lines
> On Apr 22, 2018, at 2:09 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> 
> 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: brian m. carlsonNext: Kevin Daudt
Message 3 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.