git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] freshen_file(): use NULL `times' for implicit current-time
@ 2020-04-14 14:53 luciano.rocha
  0 siblings, 0 replies; only message in thread
From: luciano.rocha @ 2020-04-14 14:53 UTC (permalink / raw)
  To: git, peff, gitster; +Cc: Luciano Rocha, Jeff King, Junio C Hamano

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-14 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-14 14:53 [PATCH 0/1] freshen_file(): use NULL `times' for implicit current-time luciano.rocha

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 NNTP newsgroup(s).