# HG changeset patch
# User Kyle Lippincott <spectral@google.com>
# Date 2022-05-12 00:56:10
# Node ID dc342071297f63e4d6710d992e68a265edd3f08a
# Parent  77b5a190571cfbfc4d05997ab833281433008370

amend: add test showing poor behavior when copies are involved

Differential Revision: https://phab.mercurial-scm.org/D12624

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -609,3 +609,20 @@ Modifying a file while the editor is ope
   >   hg status
   > fi
   OK.
+
+Amending a commit that has copies but not specifying those copies shouldn't
+cause them to be lost
+
+  $ cd $TESTTMP
+  $ hg init dont-lose-copies; cd dont-lose-copies
+  $ echo r0 > r0; hg commit -qAm "r0"
+  $ hg cp r0 r0_copied; hg commit -qm "copy r0"
+  $ echo hi > new_file_amend_me
+  $ hg status --change . --copies
+  A r0_copied
+    r0
+  $ hg amend -qA new_file_amend_me
+  $ hg status --change . --copies
+  A new_file_amend_me
+  A r0_copied
+    r0 (missing-correct-output !)