Page MenuHomePhabricator

arc land failed with error #1, Already on 'branch-name'
Closed, InvalidPublic

Description

I am on a git repository hosted on gitlab and observed with phabricator. I have been working as I have always been (though just started adopting phabricator about a week ago) and all has been working fine for me until today. Now I just seem to be getting this issue on one of our repos (we are having a multi-repo setup). It consistently seems to be happening on this repo but not on another repo I just tested.

Reproduction steps:

  • git checkout -b feature/my-name
  • modify some files
  • arc diff
  • arc land

The trace ouput:

ARGV  '/home/mpadourek/.arc_install/arcanist/bin/../scripts/arcanist.php' 'land' '--trace'
 LOAD  Loaded "phutil" from "/home/mpadourek/.arc_install/libphutil/src".
 LOAD  Loaded "arcanist" from "/home/mpadourek/.arc_install/arcanist/src".
Config: Reading user configuration file "/home/mpadourek/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/home/mpadourek/Projects/hufsy/web-app/.arcconfig".
Working Copy: Path "/home/mpadourek/Projects/hufsy/web-app" is part of `git` working copy "/home/mpadourek/Projects/hufsy/web-app".
Working Copy: Project root is at "/home/mpadourek/Projects/hufsy/web-app".
Config: Did not find local configuration at "/home/mpadourek/Projects/hufsy/web-app/.git/arc/config".
>>> [0] <conduit> user.whoami() <bytes = 117>
>>> [1] <http> https://phabricator.hufsy.com/api/user.whoami
<<< [1] <http> 336,794 us
<<< [0] <conduit> 337,404 us
>>> [2] <exec> $ git symbolic-ref --quiet HEAD
<<< [2] <exec> 4,280 us
>>> [3] <exec> $ git rev-parse --symbolic-full-name 'feature/ci-dockerfile'@{upstream}
<<< [3] <exec> 4,498 us
>>> [4] <exec> $ git --version
<<< [4] <exec> 6,107 us
>>> [5] <exec> $ git ls-remote --get-url 'origin'
<<< [5] <exec> 7,755 us
>>> [6] <conduit> repository.query() <bytes = 196>
>>> [7] <http> https://phabricator.hufsy.com/api/repository.query
<<< [7] <http> 90,264 us
<<< [6] <conduit> 90,496 us
>>> [8] <exec> $ git symbolic-ref --quiet HEAD
<<< [8] <exec> 13,833 us
Landing current branch 'feature/ci-dockerfile'.
>>> [9] <exec> $ git rev-parse --symbolic-full-name 'feature/ci-dockerfile'@{upstream}
<<< [9] <exec> 7,550 us
>>> [10] <exec> $ git rev-parse --symbolic-full-name 'master'@{upstream}
<<< [10] <exec> 14,960 us
>>> [11] <exec> $ git symbolic-ref --quiet HEAD
<<< [11] <exec> 9,263 us
>>> [12] <exec> $ git rev-parse --symbolic-full-name 'feature/ci-dockerfile'@{upstream}
<<< [12] <exec> 14,828 us
 TARGET  Landing onto "master", the default target under git.
>>> [13] <exec> $ git rev-parse --symbolic-full-name 'feature/ci-dockerfile'@{upstream}
<<< [13] <exec> 11,317 us
 REMOTE  Using remote "origin", the default remote under git.
>>> [14] <exec> $ git diff --no-ext-diff --no-textconv --submodule=short --raw 'HEAD' --
>>> [15] <exec> $ git ls-files --others --exclude-standard
<<< [14] <exec> 25,959 us
<<< [15] <exec> 22,342 us
>>> [16] <exec> $ git diff-files --name-only
<<< [16] <exec> 5,424 us
>>> [17] <exec> $ git rev-parse --verify 'origin/master'
<<< [17] <exec> 3,804 us
>>> [18] <exec> $ git rev-parse --verify 'feature/ci-dockerfile'
<<< [18] <exec> 3,967 us
 FETCH  Fetching origin/master...
>>> [19] <exec> $ git fetch --quiet -- 'origin' 'master'
<<< [19] <exec> 3,667,876 us
>>> [20] <exec> $ git log --oneline 'origin/master'..'bb03a3c756f141fef7e406e456761b26ba2e5506' --
<<< [20] <exec> 9,211 us
These commits will be landed:

      - bb03a3c Merge branch 'master' into feature/ci-dockerfile
      - dcc54cf Added dockerfiles to speed up builds.

>>> [21] <exec> $ git rev-parse HEAD
<<< [21] <exec> 7,667 us
>>> [22] <exec> $ git rev-parse --abbrev-ref HEAD
<<< [22] <exec> 6,609 us
>>> [23] <exec> $ git checkout 'feature/ci-dockerfile' --
<<< [23] <exec> 114,754 us
>>> [24] <exec> $ git checkout 'feature/ci-dockerfile' --
<<< [24] <exec> 160,176 us
 INTERRUPTED!  Restoring working copy to its original state.
>>> [25] <exec> $ git checkout 'feature/ci-dockerfile' --
<<< [25] <exec> 144,616 us

[2017-05-17 16:09:04] EXCEPTION: (CommandException) Command failed with error #1!
COMMAND
git checkout 'feature/ci-dockerfile' --

STDOUT
(empty)

STDERR
Already on 'feature/ci-dockerfile'
 {>} (CommandException) Command failed with error #1!
COMMAND
git checkout 'feature/ci-dockerfile' --

STDOUT
(empty)

STDERR
Already on 'feature/ci-dockerfile'
 at [<phutil>/src/future/exec/ExecFuture.php:369]
arcanist(head=master, ref.master=3c4735795a29), phutil(head=master, ref.master=a900d7b63e95)
  #0 <#2> ArcanistGitLandEngine::restoreLocalState() called at [<arcanist>/src/land/ArcanistGitLandEngine.php:55]
  #1 ExecFuture::resolvex() called at [<arcanist>/src/repository/api/ArcanistRepositoryAPI.php:406]
  #2 ArcanistRepositoryAPI::execxLocal(string, string) called at [<arcanist>/src/land/ArcanistGitLandEngine.php:528]
  #3 ArcanistGitLandEngine::restoreLocalState() called at [<arcanist>/src/land/ArcanistGitLandEngine.php:66]
  #4 ArcanistGitLandEngine::__destruct() called at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:296]
  #5 ArcanistLandWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]

Version information:

arcanist 3c4735795a2963c5ddff6dceaf60122d01ca3dc0 (3 May 2017)
libphutil a900d7b63e954e221efe140f0f33d3d701524aae (23 Apr 2017)

Event Timeline

Can you show me the output of these commands?

$ git checkout master
$ git checkout master
$ echo $?
$ git --version

Here's an example of what I'm looking for:

epriestley@orbital ~/dev/phabricator $ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
epriestley@orbital ~/dev/phabricator $ git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
epriestley@orbital ~/dev/phabricator $ echo $?
0
epriestley@orbital ~/dev/phabricator $ git --version
git version 2.11.0

Ha yeah that is interesting

mpadourek@silver-needle:~/Projects/hufsy/web-app/scripts$ git checkout master
M	scripts/Dockerfile
Already on 'master'
Your branch is up-to-date with 'origin/master'.
mpadourek@silver-needle:~/Projects/hufsy/web-app/scripts$ git checkout master
M	scripts/Dockerfile
Already on 'master'
Your branch is up-to-date with 'origin/master'.
mpadourek@silver-needle:~/Projects/hufsy/web-app/scripts$ echo $?
1
mpadourek@silver-needle:~/Projects/hufsy/web-app/scripts$ git --version
git version 2.7.4

Ahhh I just got it now, this project has some git-hooks and presumably they are failing silently somehow. Thanks for that indirect pointer. This can be closed.

There doesn't appear to be any reasonable way for us to perform something like git checkout --skip-hooks, and I think we shouldn't even if we could.

git should ideally maybe emit something like Warning: post-checkout hook "xyz" failed. to stderr but that would be an issue for the Git upstream.

We could say "checkout failed, you might have a bad hook" but I'd want to wait for more users to run into this first, and maybe try to pursue a fix in git with the upstream.

While it would have saved me some time and some wondering if this kind of error message would have been in place I agree, it would ideally be in git. I'll see if there is anything about that on the git front.