Page MenuHomePhabricator

`arc patch` fails to detect that the working copy commit exists?
Closed, ResolvedPublic

Description

From IRC, both the hashes are the same:

avive: so this just happened: This diff is against commit dc73630fa47423918cc82d68213c57a25dc7200a, but the commit is nowhere in the working copy. Try to apply it against the current working copy state? (dc73630fa47423918cc82d68213c57a25dc7200a)

Event Timeline

epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added a project: Arcanist.
epriestley added a subscriber: epriestley.

Possibly a windows / "\r" issue

git version 1.9.4.msysgit.0, on windows (git bash).

@btrahan, not sure what your Windows situation looks like nowadays, but if it's not a huge pain this might be something simple like a missing trim().

What was the arc patch command that did this? Where the patch comes from has implications in the code.

Also, can you reproduce this at will? Could I reproduce this at will? If I can reproduce it - awesome, how? - and otherwise it may be easiest for me to give you an instrumentation patch for arc so i can get some more information about what's going on.

At a quick glance, the error message has the same string for the two hashes, so i don't think there's any extra spacing such that trim can save the day. Also from the quick glance I'm curious what the output of

git show -s --format=%H dc73630fa47423918cc82d68213c57a25dc7200a --

is in a repository that can reproduce this issue *before* you run arc patch...? This is the meat of the hasLocalCommit call which is necessarily returning false for you to get this error message.

The command was arc patch 2252; It's an open revision.

It reproduces in the same repo every time, at least with this revision and being in the same state. It might be the first time I try to patch on windows in a very long time.

I've now cloned again that repo on the same host:

  • git show... prints the hash; piping it to wc -c says "41" (which is the same as it does on linux).
  • HEAD has advanced by one commit - arc patch still can't find dc7, which is now HEAD~.
  • after git reset --hard dc7... - same message from before.

I was able to recreate this using Javelin: cloning it and running arc patch 1884 fails to find fb9944c, which does exist in history.

Also seeing this on a different, private repo. It is on windows.

same output as originally mentioned on IRC:

This diff is against commit 8e007ae3ddc8d0a587a55042229e643e3b6b73d7, but
 the commit is nowhere in the working copy. Try to apply it against the
 current working copy state? (8e007ae3ddc8d0a587a55042229e643e3b6b73d7)
 [Y/n] n

Output of

PS:> git show -s --format=%H 8e007ae3ddc8d0a587a55042229e643e3b6b73d7 --
8e007ae3ddc8d0a587a55042229e643e3b6b73d7

I have also been seeing this.

This diff is against commit 84c135a58fc84a165d422d7775eab98b0fe43fe0, but
  the commit is nowhere in the working copy. Try to apply it against the
  current working copy state? (84c135a58fc84a165d422d7775eab98b0fe43fe0)
  [Y/n]

If I throw the exception that is silently ignored here, then I get this:

Exception
Command failed with error #128!
COMMAND
git show -s --format=" H" "84c135a58fc84a165d422d7775eab98b0fe43fe0" --

STDOUT
(empty)

STDERR
fatal: invalid --pretty format:  H

(Run with --trace for a full exception trace.)

The "%H" is being replaced with " H" (percent is turning to a space, which is mentioned in the comments around line 160.

Thanks for the info! (@bluehawk in particular provided what is hopefully the clues to fix this issue)

Can folks try D10333 and see if it fixes the issue? My windows box seems to generally stall out at the moment for arc patch commands and isn't that helpful.

I was actually in the middle of submitting the exact same diff when you submitted yours :)