Mercurial > hg-stable
diff mercurial/cmdutil.py @ 43817:5558e3437872
amend: check for file modifications when updating dirstate (issue6233)
Previously, we called dirstate.normal(f), which would put information into the
dirstate claiming that the file on disk is what it "should be" for the current
checkout, and it would have the size and timestamp of the most recent
modification to the file (which is not necessarily the one we just committed).
If the file was modified while the commit message editor was open, we would put
incorrect information into the dirstate.
Differential Revision: https://phab.mercurial-scm.org/D7521
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Tue, 26 Nov 2019 16:10:21 -0800 |
parents | 7b14d649af1b |
children | 072b745936f1 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Dec 05 09:39:49 2019 -0800 +++ b/mercurial/cmdutil.py Tue Nov 26 16:10:21 2019 -0800 @@ -3054,11 +3054,13 @@ # selectively update the dirstate only for the amended files. dirstate = repo.dirstate - # Update the state of the files which were added and - # and modified in the amend to "normal" in the dirstate. + # Update the state of the files which were added and modified in the + # amend to "normal" in the dirstate. We need to use "normallookup" since + # the files may have changed since the command started; using "normal" + # would mark them as clean but with uncommitted contents. normalfiles = set(wctx.modified() + wctx.added()) & filestoamend for f in normalfiles: - dirstate.normal(f) + dirstate.normallookup(f) # Update the state of files which were removed in the amend # to "removed" in the dirstate.