Switching from svn to git, a user noticed that they could no longer :q!
in vim when editing the diff message to terminate the workflow as they were used to doing in svn. The expectation was that this would result in Usage Exception: Template not edited
, but instead it just moved forward with submitting the diff. Maybe this is intentional because the template was edited by arc, but the user hadn’t edited anything, so from their perspective it was considered to be a bug.
I believe this is because using arc in a git repo populates $fields
, leaving $template_is_default
false and preventing the check for $template == $new_template
later. I fixed it with this diff:
--- src/workflow/ArcanistDiffWorkflow.php.orig 2020-05-14 16:16:36 UTC
+++ src/workflow/ArcanistDiffWorkflow.php
@@ -1679,6 +1679,10 @@ EOTEXT
if ($first && $this->getArgument('verbatim') && !$template_is_default) {
$new_template = $template;
} else {
+ // Now that the user is being presented the editor, assume the values
+ // presented are the default template. This allows quit without save
+ // to terminate the workflow.
+ $template_is_default = true;
$new_template = $this->newInteractiveEditor($template)
->setName('new-commit')
->editInteractively();
Phabricator/Arcanist Version
arc version b76b9c4