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 onmaint
						commit
						161c35f93b
					
				
							
								
								
									
										12
									
								
								diff-lib.c
								
								
								
								
							
							
						
						
									
										12
									
								
								diff-lib.c
								
								
								
								
							|  | @ -36,14 +36,14 @@ | ||||||
|  * exists for ce that is a submodule -- it is a submodule that is not |  * exists for ce that is a submodule -- it is a submodule that is not | ||||||
|  * checked out).  Return negative for an error. |  * 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 (lstat(ce->name, st) < 0) { | ||||||
| 	if (!(ce->ce_flags & CE_FSMONITOR_VALID) && lstat(ce->name, st) < 0) { |  | ||||||
| 		if (!is_missing_file_error(errno)) | 		if (!is_missing_file_error(errno)) | ||||||
| 			return -1; | 			return -1; | ||||||
| 		return 1; | 		return 1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (has_symlink_leading_path(ce->name, ce_namelen(ce))) | 	if (has_symlink_leading_path(ce->name, ce_namelen(ce))) | ||||||
| 		return 1; | 		return 1; | ||||||
| 	if (S_ISDIR(st->st_mode)) { | 	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, | 			memset(&(dpath->parent[0]), 0, | ||||||
| 			       sizeof(struct combine_diff_parent)*5); | 			       sizeof(struct combine_diff_parent)*5); | ||||||
|  |  | ||||||
| 			changed = check_removed(istate, ce, &st); | 			changed = check_removed(ce, &st); | ||||||
| 			if (!changed) | 			if (!changed) | ||||||
| 				wt_mode = ce_mode_from_stat(ce, st.st_mode); | 				wt_mode = ce_mode_from_stat(ce, st.st_mode); | ||||||
| 			else { | 			else { | ||||||
|  | @ -229,7 +229,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) | ||||||
| 		} else { | 		} else { | ||||||
| 			struct stat st; | 			struct stat st; | ||||||
|  |  | ||||||
| 			changed = check_removed(istate, ce, &st); | 			changed = check_removed(ce, &st); | ||||||
| 			if (changed) { | 			if (changed) { | ||||||
| 				if (changed < 0) { | 				if (changed < 0) { | ||||||
| 					perror(ce->name); | 					perror(ce->name); | ||||||
|  | @ -304,7 +304,7 @@ static int get_stat_data(const struct index_state *istate, | ||||||
| 	if (!cached && !ce_uptodate(ce)) { | 	if (!cached && !ce_uptodate(ce)) { | ||||||
| 		int changed; | 		int changed; | ||||||
| 		struct stat st; | 		struct stat st; | ||||||
| 		changed = check_removed(istate, ce, &st); | 		changed = check_removed(ce, &st); | ||||||
| 		if (changed < 0) | 		if (changed < 0) | ||||||
| 			return -1; | 			return -1; | ||||||
| 		else if (changed) { | 		else if (changed) { | ||||||
|  |  | ||||||
|  | @ -809,6 +809,11 @@ my_match_and_clean () { | ||||||
| 		status --porcelain=v2 >actual.without && | 		status --porcelain=v2 >actual.without && | ||||||
| 	test_cmp actual.with actual.without && | 	test_cmp actual.with actual.without && | ||||||
|  |  | ||||||
|  | 	git -C super --no-optional-locks diff-index --name-status HEAD >actual.with && | ||||||
|  | 	git -C super --no-optional-locks -c core.fsmonitor=false \ | ||||||
|  | 		diff-index --name-status HEAD >actual.without && | ||||||
|  | 	test_cmp actual.with actual.without && | ||||||
|  |  | ||||||
| 	git -C super/dir_1/dir_2/sub reset --hard && | 	git -C super/dir_1/dir_2/sub reset --hard && | ||||||
| 	git -C super/dir_1/dir_2/sub clean -d -f | 	git -C super/dir_1/dir_2/sub clean -d -f | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano