Junio C Hamano <gitster@xxxxxxxxx> writes: >> -static const char *merge_worktree(unsigned char *sha1) >> +static const char *update_worktree(unsigned char *sha1) >> { >> const char *update_refresh[] = { >> "update-index", "--ignore-submodules", "--refresh", NULL >> }; >> + const char *diff_index[] = { >> + "diff-index", "--quiet", "--cached", "--ignore-submodules", >> + "HEAD", "--", NULL >> + }; >> const char *read_tree[] = { >> "read-tree", "-u", "-m", sha1_to_hex(sha1), NULL >> }; > > OK. > > "update-index --refresh && diff-files && diff-index --cached" is how > we traditionally ensure the working tree is absolutely clean (see > require_clean_work_tree in git-sh-setup.sh), but I do not think of a > reason why diff-files step is not redundant. As a totally separate > topic outside this series, we may want to visit that shell function. Ahh, scratch that. Over there we use 'update-index -q --refresh', so the difference between the index and the working tree is not noticed and we do need diff-files. Here, the code runs update-index without -q, so we do catch such a difference without diff-files. Sorry for the noise ;-) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html