diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-09-16 03:08:02 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-09-16 03:08:02 +0300 |
commit | 161c35f93b9a742b5ec5c69eaea4e39db7343d19 (patch) | |
tree | 88383b2b697af20fc9fc8425ede5541ab9fe4a8c /diff-lib.c | |
parent | 43c8a30d150ecede9709c1f2527c8fba92c65f40 (diff) | |
parent | 6a044a20480a8ef56f7ddb8142f660ca01a3391e (diff) |
Merge branch 'js/diff-cached-fsmonitor-fix' into jc/diff-cached-fsmonitor-fix
* js/diff-cached-fsmonitor-fix:
diff-lib: fix check_removed when fsmonitor is on
Diffstat (limited to 'diff-lib.c')
-rw-r--r-- | diff-lib.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/diff-lib.c b/diff-lib.c index 6b0c6a7180..e533b436af 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -36,14 +36,14 @@ * exists for ce that is a submodule -- it is a submodule that is not * checked out). Return negative for an error. */ -static int check_removed(const struct index_state *istate, const struct cache_entry *ce, struct stat *st) +static int check_removed(const struct cache_entry *ce, struct stat *st) { - assert(is_fsmonitor_refreshed(istate)); - if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) { + if (lstat(ce->name, st) < 0) { if (!is_missing_file_error(errno)) return -1; return 1; } + if (has_symlink_leading_path(ce->name, ce_namelen(ce))) return 1; if (S_ISDIR(st->st_mode)) { @@ -149,7 +149,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) memset(&(dpath->parent[0]), 0, sizeof(struct combine_diff_parent)*5); - changed = check_removed(istate, ce, &st); + changed = check_removed(ce, &st); if (!changed) wt_mode = ce_mode_from_stat(ce, st.st_mode); else { @@ -229,7 +229,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) } else { struct stat st; - changed = check_removed(istate, ce, &st); + changed = check_removed(ce, &st); if (changed) { if (changed < 0) { perror(ce->name); @@ -304,7 +304,7 @@ static int get_stat_data(const struct index_state *istate, if (!cached && !ce_uptodate(ce)) { int changed; struct stat st; - changed = check_removed(istate, ce, &st); + changed = check_removed(ce, &st); if (changed < 0) return -1; else if (changed) { |