Patchwork D6463: commit: add test showing that commit --amend --no-edit still shows editor

login
register
mail settings
Submitter phabricator
Date May 30, 2019, 10:52 p.m.
Message ID <24da731e854c6344dc7424097f17475f@localhost.localdomain>
Download mbox | patch
Permalink /patch/40283/
State Not Applicable
Headers show

Comments

phabricator - May 30, 2019, 10:52 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG060ff3396589: commit: add test showing that commit --amend --no-edit still shows editor (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6463?vs=15305&id=15307

REVISION DETAIL
  https://phab.mercurial-scm.org/D6463

AFFECTED FILES
  tests/test-commit-amend.t

CHANGE DETAILS




To: spectral, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -930,6 +930,37 @@ 
   $ hg parents --template "{desc}\n"
   editor should be invoked
 
+Test that amend with --no-edit avoids the editor
+------------------------------------------------
+
+  $ hg commit --amend -m "before anything happens"
+  $ hg parents --template "{desc}\n"
+  before anything happens
+  $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed"
+  $ hg parents --template "{desc}\n"
+  editor should be suppressed
+
+(We need a file change here since we won't have a message change)
+  $ cp foo foo.orig
+  $ echo hi >> foo
+FIXME: This shouldn't start the editor.
+  $ HGEDITOR=cat hg commit --amend --no-edit
+  editor should be suppressed
+  
+  
+  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+  HG: Leave message empty to abort commit.
+  HG: --
+  HG: user: test
+  HG: branch 'silliness'
+  HG: added foo
+  $ hg parents --template "{desc}\n"
+  editor should be suppressed
+  $ hg status -mar
+(Let's undo adding that "hi" so later tests don't need to be adjusted)
+  $ mv foo.orig foo
+  $ hg commit --amend --no-edit
+
 Test that "diff()" in committemplate works correctly for amending
 -----------------------------------------------------------------