Phillip Wood noticed that "git stash push" and "git stash create" check for unstaged or uncommitted changes at startup and again when creating the stash. He says do_stash_push() calls repo_read_index_preload(), do_create_stash() calls it again, and repo_refresh_and_write_index() preloads a third time, when once is enough. The series makes the callers of do_create_stash() responsible for reading the index.
With untracked files, the duplicate check_changes() calls visit every file twice, since the staged and unstaged checks stop at the first change but the untracked check does not. Wood removes the call from do_push_stash() and uses the return value of do_create_stash() to detect that there was nothing to stash.
Other patches in the thread drop unused parameters from a function with a single caller and remove a redundant index refresh in create_index_from_tree(), which Wood says saves three lstat() calls per changed path. One replaces reset_tree() with create_index_from_tree() for the temporary index used to stash working tree changes, matching what "stash push -p" does and saving one lstat() per changed path.
Junio C Hamano called the original double preload-and-refresh embarrassingly wasteful. He asked that the log message for the reset_tree() replacement state the observation, the problem and the solution in that order, and he suggested Wood may have meant do_push_stash() in one place. He also said create_stash(), the other caller of do_create_stash(), does not need the preload version either.