git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: luciano.rocha@booking.com
To: git@vger.kernel.org, peff@peff.net, gitster@pobox.com
Cc: Luciano Rocha <luciano.rocha@booking.com>,
	Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 0/1] freshen_file(): use NULL `times' for implicit current-time
Date: Tue, 14 Apr 2020 16:53:52 +0200	[thread overview]
Message-ID: <5e95d36e.1c69fb81.8d920.c2ba@mx.google.com> (raw)

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


                 reply	other threads:[~2020-04-14 15:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e95d36e.1c69fb81.8d920.c2ba@mx.google.com \
    --to=luciano.rocha@booking.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).