Page MenuHomePhabricator

arc diff does not prompt to add untracked files using git
Closed, ResolvedPublic

Description

After D11843, when running arc diff with only untracked changes within the working copy, the previous behaviour displaying the message 'To ignore these %s change(s)...' does not occur and user is not asked if they wish to add the untracked files to the commit.

The new behaviour appears to cause arc diff to launch the $EDITOR, with the new-commit template, without prompting to add files, therefore after completing the template and saving, arc attempts to run the linters and unit tests before returning: Usage Exception: No changes found. (Did you specify the wrong commit range?)

ArcanistWorkflow.php still appears to contain the warning messages for 'To ignore these %s change(s)...' but this check isn't processed as neither $unstaged or $uncommitted is true.

To reproduce

  1. touch test.txt
  2. arc diff
  3. Fill out template and save

Environment

Event Timeline

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

In a follow up question to D11990, after we upgraded, the result of the patch for us, using the same use case above, is:

$ arc diff
You have uncommitted changes in this working copy.

  Working copy: /home/<<< PATH TO REPO >>>

  Untracked changes in working copy:
  (To ignore this change, add it to ".git/info/exclude".)
    test.txt

    Do you want to create a new commit with these changes? [y/N] y

Exception
Command failed with error #1!
COMMAND
git commit -F '/tmp/50iztapwufocgscw/9966-yxyiS9'

STDOUT
On branch master
Your branch is up-to-date with 'origin/master'.

Untracked files:
        test.txt

nothing added to commit but untracked files present


STDERR
(empty)
(Run with `--trace` for a full exception trace.)

This appears to happen as the askForAdd($all_uncommitted) doesn't include untracked files. D11995 is the patch we have been using internally to add the untracked files, and this seems to fix our use case, and appears similar to the old behaviour.