Page MenuHomePhabricator

Running arc land in a repository running git with unstaged changes that conflict with master wipes out those changes.
Closed, InvalidPublic

Description

Step 1. Create a revision on git branch example_branch
Step 2. Checkout master, make a change to example_file.php; git push.
Step 3. Checkout example_branch, make a conflicting change to example_file.php
Step 4. arc land. The command will fail, and upon restoring local branch, all your hard work on example_file.php will be gone.

This is a bug in ArcanistGitLandEngine:restoreLocalState., $api->execxLocal('reset --hard %s --', $this->localCommit);

One way to fix this is add $api->execxLocal('stash'); and $api->execxLocal('stash pop'); before and after that command, respectively.

Event Timeline

sophie created this task.Feb 23 2016, 12:53 AM

I can't immediately reproduce this, here's what I get:

$ nano README.md # make some changes

Now I have changes:

$ git status
On branch almanac9
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")

Now I'll arc land:

$ arc land
Landing current branch 'almanac9'.
 TARGET  Landing onto "master", the default target under git.
 REMOTE  Using remote "origin", the default remote under git.
You have uncommitted changes in this working copy.

  Working copy: /Users/epriestley/dev/core/lib/phabricator/

  Unstaged changes in working copy:
    README.md
Usage Exception: You can not continue with uncommitted changes. Commit or discard them before proceeding.

My working copy hasn't been touched:

$ git status
On branch almanac9
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   README.md

no changes added to commit (use "git add" and/or "git commit -a")

What did I do differently from the reproduction instructions?

Ah, ok. sorry! This was a local issue. But now I can't close this task...

I added you to Community if you want to do the honors. :)

sophie closed this task as Invalid.Feb 23 2016, 2:01 AM

thanks! :)