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 1/1] freshen_file(): use NULL `times' for implicit current-time
Date: Tue, 14 Apr 2020 16:27:26 +0200 [thread overview]
Message-ID: <5e95d37d.1c69fb81.2b4ec.ce9f@mx.google.com> (raw)
Update freshen_file() to use a NULL `times', semantically equivalent to
the currently setup, with an explicit `actime' and `modtime' set to the
"current time", but with the advantage that it works with other files
not owned by the current user.
Fixes an issue on shared repos with a split index, where eventually a
user's operation creates a shared index, and another user will later do
an operation that will try to update its freshness, but will instead
raise a warning:
$ git status
warning: could not freshen shared index '.git/sharedindex.bd736fa10e0519593fefdb2aec253534470865b2'
Signed-off-by: Luciano Miguel Ferreira Rocha <luciano.rocha@booking•com>
---
sha1-file.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sha1-file.c b/sha1-file.c
index 6926851724..ccd34dd9e8 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -881,9 +881,7 @@ void prepare_alt_odb(struct repository *r)
/* Returns 1 if we have successfully freshened the file, 0 otherwise. */
static int freshen_file(const char *fn)
{
- struct utimbuf t;
- t.actime = t.modtime = time(NULL);
- return !utime(fn, &t);
+ return !utime(fn, NULL);
}
/*
--
2.26.0
next reply other threads:[~2020-04-14 15:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 14:27 luciano.rocha [this message]
2020-04-14 19:55 ` [PATCH 1/1] freshen_file(): use NULL `times' for implicit current-time Jeff King
2020-04-15 9:09 ` [External] " luciano.rocha
2020-04-15 16:05 ` Jeff King
2020-04-15 17:30 ` Junio C Hamano
2020-04-15 21:36 ` Junio C Hamano
2020-04-15 23:48 ` brian m. carlson
2020-04-16 1:02 ` Junio C Hamano
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=5e95d37d.1c69fb81.2b4ec.ce9f@mx.google.com \
--to=luciano.rocha@booking$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
--cc=peff@peff$(echo .)net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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