0

I'm using Phabricator and Arcanist CLI to attempt to land a diff that has been approved by a code reviewer. Here is the output I see:

 arc land
 STRATEGY  Merging with "squash" strategy, the default strategy.
 SOURCE  Landing the current branch, "branchName".
 ONTO REMOTE  Landing onto remote "origin", the default remote under Git.
 ONTO TARGET  Landing onto target "master", the default target under Git.
 INTO REMOTE  Will merge into remote "origin" by default, because this is the remote the change is landing onto.
 INTO TARGET  Will merge into target "master" by default, because this is the "onto" target.
 FETCH  Fetching "master" from remote "origin"...

  $   git fetch --no-tags --quiet -- origin master


 INTO COMMIT  Preparing merge into "master" from remote "origin", at commit "62210e8removed".
 LANDING  These changes will land:

  *   D4303 Revert to reviewed state
          dc0f50removed  fix checkbox error

 >>>  Land these changes? [y/N/?] y
 MERGING  dc0f50removed fix checkbox error
 MERGE  Attempting to rebase changes.
 DONE  Merge succeeded.
 LOAD STATE  Restoring local state (to ref "branchName" at commit "dc0f50removed").
[2021-08-04 20:34:32] EXCEPTION: (CommandException) Command failed with error #1!
COMMAND
git commit --author 'MyName my@email.com' --date 'Tue, 3 Aug 2021 10:46:43 -0400' -F - --

STDOUT
HEAD detached from dc0f50removed
nothing to commit, working tree clean


STDERR
(empty) at [<arcanist>/src/future/exec/ExecFuture.php:421]
arcanist(head=master, ref.master=f0f95e5b2612)
  #0 ExecFuture::raiseResultError(array) called at [<arcanist>/src/future/exec/ExecFuture.php:325]
  #1 ExecFuture::resolvex() called at [<arcanist>/src/land/engine/ArcanistGitLandEngine.php:1796]
  #2 ArcanistGitLandEngine::applyCommitOperation(string, string, string) called at [<arcanist>/src/land/engine/ArcanistGitLandEngine.php:510]
  #3 ArcanistGitLandEngine::executeMerge(ArcanistLandCommitSet, string) called at [<arcanist>/src/land/engine/ArcanistLandEngine.php:1248]
  #4 ArcanistLandEngine::execute() called at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:344]
  #5 ArcanistLandWorkflow::runWorkflow(PhutilArgumentParser) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:227]
  #6 ArcanistWorkflow::executeWorkflow(PhutilArgumentParser) called at [<arcanist>/src/toolset/ArcanistPhutilWorkflow.php:21]
  #7 ArcanistPhutilWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #8 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:171]
  #9 ArcanistRuntime::executeCore(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:37]
  #10 ArcanistRuntime::execute(array) called at [<arcanist>/support/init/init-arcanist.php:6]
  #11 require_once(string) called at [<arcanist>/bin/arc:10]

I do not believe the feature branch should be in a detached head state. I've checked it out by name. Here is the git log:

$ git log
commit dc0f5074b0cfce35525c9799bfremoved (HEAD -> branchName)
Author: name email
Date:   Tue Aug 3 10:46:43 2021 -0400

    fix checkbox error
    
    Summary: todo
    
    Test Plan: todo
    
    Reviewers: #reviewers_js, #reviewers_default
    
    Differential Revision: https://company.rs/D4303

Any idea why this error displays?

Sean D
  • 3,810
  • 11
  • 45
  • 90
  • This has little to do with Git itself, and appears to be some sort of internal bug in the code you're running. Note that there is no such thing as a "feature branch in a detached head state": the detached HEAD state *means* "not on *any* branch". It is achieved with `git switch --detach` (the flag is required) or `git checkout` with an argument that is not a branch name (the flag is implied; `--detach` can be used intentionally if you like). – torek Aug 05 '21 at 10:09
  • Thanks for correcting my wording. Any idea how to debug this? The branch works locally – Sean D Aug 05 '21 at 13:58
  • I don't have the code, so don't know how to start debugging it, but assuming it *invokes* Git (by running `git ` commands), one thing would be to look at where and when it invokes Git, and figure out why it's doing a detached-head checkout. (It may have some reason, which might be described in comments on its overall algorithm.) The error message you quoted occurs from a `git commit` command it seems to run when there is nothing to commit; that might be where I would start. – torek Aug 05 '21 at 14:46

0 Answers0