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

[PATCH 0/1] freshen_file(): use NULL `times' for implicit current-time

From
luciano.rocha@booking.com <luciano.rocha@booking.com>
Date
Apr 14, 2020, 14:53 UTC
Message-ID
<5e95d36e.1c69fb81.8d920.c2ba@mx.google.com>
Hi all,
Currently freshen_file() consists of:
  struct utimbuf t;
  t.actime = t.modtime = time(NULL);
  return !utime(fn, &t);

That, however, is permitted only on files that the user owns (for normal users).

So on a shared repo with split-index enabled, we end up with the
warning:
  $ git status
  warning: could not freshen shared index '.git/sharedindex.bd736fa10e0519593fefdb2aec253534470865b2'

The following gives the same end result (updated atime and mtime), and is also allowed for any file the user has permissions to write to:

  return !utime(fn, NULL);
So the following patch changes it to that.

I'm unaware of any system where those two are not equivalent except for the permisison check.

Luciano Rocha (1):
  freshen_file(): use NULL `times' for implicit current-time
 sha1-file.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Regards, Luciano Rocha

-- 
2.26.0
Message 1 of 1 in “freshen_file(): use NULL `times' for implicit current-time”
  1. 0/1 freshen_file(): use NULL `times' for implicit current-timeluciano.rocha@booking.com, Apr 14, 2020

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.