Arc has a spurious failure on arc diff


#1

Observed Behavior:
When we run arc diff, we sometimes run into this error where:
Exception
Failed to parse git symbolic-ref output!
(Run with --trace for a full exception trace.)

It happens at line: https://github.com/phacility/arcanist/blob/3b6b523c2b236e3724a1e115f126cb6fd05fa128/src/repository/api/ArcanistGitAPI.php#L514

I added a print statement. in a diff:

      if (!$branch) {
-        pht('STDOUT FROM SYMBOLIC REF: %s', $stdout);
        throw new Exception(
-          pht('Failed to parse %s output!', 'git symbolic-ref'));
+          pht('Failed to parse %s output [%s]!', 'git symbolic-ref', $stdout));
      }

The output we got:

Exception
Failed to parse git symbolic-ref output [refs/heads/0
]!

What Phabricator should be doing.

Phabricator Version:
phabricator 58a1731403eb2e8b6590b2ef7b2cb11be447de55 (Sat, Sep 30) arcanist 822bc53ca306e06314560d8a76f68771d732e8e0 (Feb 24 2017) phutil 796cb1c2ee274397a8a7bc6c10566fd751619d6d (Mar 4 2017)

Reproduction Steps:
spuriously. run enough times:

    arc_cmd = [
        'arc',
        '--conduit-uri',
        CONDUIT_URI,
        '--conduit-token',
        conduit_token,
        'diff',
        '--skip-staging',
        '--skip-binaries',
        '--only',
        '--allow-untracked',
        '--base',
        'git:HEAD^'
    ]

#2

Thanks, see https://secure.phabricator.com/D18678.