Page MenuHomePhorge

Fix ArcanistWorkflow::shouldRequireCleanUntrackedFiles
Needs ReviewPublic

Authored by amybones on Fri, May 30, 23:48.

Details

Reviewers
None
Group Reviewers
O1: Blessed Committers
Summary

This previously only worked for more traditional workflows like diff because it
expected $this->arguments to be an array. But in modern workflows, it's a
PhutilArgumentParser instead. Since extension workflows might also like to
use the more modern approach and require a clean working copy, it seems like
this ought to be fixed.

Test Plan

Make a quick and simple custom workflow and try using $this->requireCleanWorkingCopy().

Before:

$ arc publish # a new command for my project
[2025-05-30 23:42:32] EXCEPTION: (Error) Cannot use object of type PhutilArgumentParser as array at [<arcanist>/src/workflow/ArcanistWorkflow.php:1009]
arc-thing(), arcanist(head=lfn/master, ref.lfn/master=8691fb3816a0)
  #0 ArcanistWorkflow::shouldRequireCleanUntrackedFiles() called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1122]
  #1 ArcanistWorkflow::requireCleanWorkingCopy() called at [<arc-thing>/workflow/MediaThingArcPublishWorkflow.php:80]
  #2 MediaThingArcPublishWorkflow::runWorkflow(PhutilArgumentParser) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:227]
  #3 ArcanistWorkflow::executeWorkflow(PhutilArgumentParser) called at [<arcanist>/src/toolset/ArcanistPhutilWorkflow.php:21]
  #4 ArcanistPhutilWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:493]
  #5 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:171]
  #6 ArcanistRuntime::executeCore(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:37]
  #7 ArcanistRuntime::execute(array) called at [<arcanist>/support/init/init-arcanist.php:6]
  #8 require_once(string) called at [<arcanist>/bin/arc:10]

After:

$ arc publish
... success!

Diff Detail

Repository
rARC Arcanist
Branch
arc_workflow_fixes (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2031
Build 2031: arc lint + arc unit