diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py index 37c57a7cf16083458017de54f6d75a1af336e901_bWVyY3VyaWFsL2NtZHV0aWwucHk=..10697f29af2b0c0907d383d432cd4e8a7b82d8b1_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644 --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1982,5 +1982,5 @@ abort, warn = scmutil.checkportabilityalert(ui) if abort or warn: cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate) - for f in repo.walk(match): + for f in wctx.walk(match): exact = match.exact(f) @@ -1986,5 +1986,5 @@ exact = match.exact(f) - if exact or not explicitonly and f not in repo.dirstate: + if exact or not explicitonly and f not in wctx: if cca: cca(f) names.append(f) diff --git a/tests/test-add.t b/tests/test-add.t index 37c57a7cf16083458017de54f6d75a1af336e901_dGVzdHMvdGVzdC1hZGQudA==..10697f29af2b0c0907d383d432cd4e8a7b82d8b1_dGVzdHMvdGVzdC1hZGQudA== 100644 --- a/tests/test-add.t +++ b/tests/test-add.t @@ -126,6 +126,19 @@ M a ? a.orig +Forgotten file can be added back (as either clean or modified) + + $ hg forget b + $ hg add b + $ hg st -A b + C b + $ hg forget b + $ echo modified > b + $ hg add b + $ hg st -A b + M b + $ hg revert -qC b + $ hg add c && echo "unexpected addition of missing file" c: * (glob) [1]