From: "Nipunn Koorapati via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Nipunn Koorapati <nipunn1313@gmail.com>,
Nipunn Koorapati <nipunn@dropbox.com>
Subject: [PATCH 1/3] fsmonitor: skip lstat deletion check during git diff-index
Date: Sun, 14 Mar 2021 22:17:35 +0000 [thread overview]
Message-ID: <75a3c46c405549d1f5127097729c556a7e297587.1615760258.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.903.git.1615760258.gitgitgadget@gmail.com>
From: Nipunn Koorapati <nipunn@dropbox.com>
Teach git to honor fsmonitor rather than issuing an lstat
when checking for dirty local deletes. Eliminates O(files)
lstats during `git diff HEAD`
Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
---
diff-lib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/diff-lib.c b/diff-lib.c
index b73cc1859a49..3fb538ad18e9 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -30,7 +30,7 @@
*/
static int check_removed(const struct cache_entry *ce, struct stat *st)
{
- if (lstat(ce->name, st) < 0) {
+ if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) {
if (!is_missing_file_error(errno))
return -1;
return 1;
@@ -574,6 +574,7 @@ int run_diff_index(struct rev_info *revs, unsigned int option)
struct object_id oid;
const char *name;
char merge_base_hex[GIT_MAX_HEXSZ + 1];
+ struct index_state *istate = revs->diffopt.repo->index;
if (revs->pending.nr != 1)
BUG("run_diff_index must be passed exactly one tree");
@@ -581,6 +582,8 @@ int run_diff_index(struct rev_info *revs, unsigned int option)
trace_performance_enter();
ent = revs->pending.objects;
+ refresh_fsmonitor(istate);
+
if (merge_base) {
diff_get_merge_base(revs, &oid);
name = oid_to_hex_r(merge_base_hex, &oid);
--
gitgitgadget
next prev parent reply other threads:[~2021-03-14 22:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-14 22:17 [PATCH 0/3] teach git to respect fsmonitor in diff-index Nipunn Koorapati via GitGitGadget
2021-03-14 22:17 ` Nipunn Koorapati via GitGitGadget [this message]
2021-03-14 22:17 ` [PATCH 2/3] fsmonitor: add assertion that fsmonitor is valid to check_removed Nipunn Koorapati via GitGitGadget
2021-03-14 22:35 ` Eric Sunshine
2021-03-15 22:01 ` Nipunn Koorapati
2021-03-15 22:51 ` Eric Sunshine
2021-03-14 22:17 ` [PATCH 3/3] fsmonitor: add perf test for git diff HEAD Nipunn Koorapati via GitGitGadget
2021-03-17 21:22 ` [PATCH v2 0/3] teach git to respect fsmonitor in diff-index Nipunn Koorapati via GitGitGadget
2021-03-17 21:22 ` [PATCH v2 1/3] fsmonitor: skip lstat deletion check during git diff-index Nipunn Koorapati via GitGitGadget
2021-03-18 20:44 ` Junio C Hamano
2021-03-18 21:36 ` Nipunn Koorapati
2021-03-17 21:22 ` [PATCH v2 2/3] fsmonitor: add assertion that fsmonitor is valid to check_removed Nipunn Koorapati via GitGitGadget
2021-03-18 20:47 ` Junio C Hamano
2021-03-18 22:57 ` Nipunn Koorapati
2021-03-17 21:22 ` [PATCH v2 3/3] fsmonitor: add perf test for git diff HEAD Nipunn Koorapati via GitGitGadget
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=75a3c46c405549d1f5127097729c556a7e297587.1615760258.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=nipunn1313@gmail.com \
--cc=nipunn@dropbox.com \
/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).