Git fork

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

+11 -6
+6 -6
diff-lib.c
··· 36 * exists for ce that is a submodule -- it is a submodule that is not 37 * checked out). Return negative for an error. 38 */ 39 - static int check_removed(const struct index_state *istate, const struct cache_entry *ce, struct stat *st) 40 { 41 - assert(is_fsmonitor_refreshed(istate)); 42 - if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) { 43 if (!is_missing_file_error(errno)) 44 return -1; 45 return 1; 46 } 47 if (has_symlink_leading_path(ce->name, ce_namelen(ce))) 48 return 1; 49 if (S_ISDIR(st->st_mode)) { ··· 149 memset(&(dpath->parent[0]), 0, 150 sizeof(struct combine_diff_parent)*5); 151 152 - changed = check_removed(istate, ce, &st); 153 if (!changed) 154 wt_mode = ce_mode_from_stat(ce, st.st_mode); 155 else { ··· 229 } else { 230 struct stat st; 231 232 - changed = check_removed(istate, ce, &st); 233 if (changed) { 234 if (changed < 0) { 235 perror(ce->name); ··· 304 if (!cached && !ce_uptodate(ce)) { 305 int changed; 306 struct stat st; 307 - changed = check_removed(istate, ce, &st); 308 if (changed < 0) 309 return -1; 310 else if (changed) {
··· 36 * exists for ce that is a submodule -- it is a submodule that is not 37 * checked out). Return negative for an error. 38 */ 39 + static int check_removed(const struct cache_entry *ce, struct stat *st) 40 { 41 + if (lstat(ce->name, st) < 0) { 42 if (!is_missing_file_error(errno)) 43 return -1; 44 return 1; 45 } 46 + 47 if (has_symlink_leading_path(ce->name, ce_namelen(ce))) 48 return 1; 49 if (S_ISDIR(st->st_mode)) { ··· 149 memset(&(dpath->parent[0]), 0, 150 sizeof(struct combine_diff_parent)*5); 151 152 + changed = check_removed(ce, &st); 153 if (!changed) 154 wt_mode = ce_mode_from_stat(ce, st.st_mode); 155 else { ··· 229 } else { 230 struct stat st; 231 232 + changed = check_removed(ce, &st); 233 if (changed) { 234 if (changed < 0) { 235 perror(ce->name); ··· 304 if (!cached && !ce_uptodate(ce)) { 305 int changed; 306 struct stat st; 307 + changed = check_removed(ce, &st); 308 if (changed < 0) 309 return -1; 310 else if (changed) {
+5
t/t7527-builtin-fsmonitor.sh
··· 809 status --porcelain=v2 >actual.without && 810 test_cmp actual.with actual.without && 811 812 git -C super/dir_1/dir_2/sub reset --hard && 813 git -C super/dir_1/dir_2/sub clean -d -f 814 }
··· 809 status --porcelain=v2 >actual.without && 810 test_cmp actual.with actual.without && 811 812 + git -C super --no-optional-locks diff-index --name-status HEAD >actual.with && 813 + git -C super --no-optional-locks -c core.fsmonitor=false \ 814 + diff-index --name-status HEAD >actual.without && 815 + test_cmp actual.with actual.without && 816 + 817 git -C super/dir_1/dir_2/sub reset --hard && 818 git -C super/dir_1/dir_2/sub clean -d -f 819 }