Why I can not land diff when untracked files exist

When I land diff when untracked files exist, it asks me if I want to stash those changes. but actually we can not stash untracked changes, so it breaks and I have to mv or rm those needed files…


Reproduction Instructions
land diff when untracked files exist

Phabricator/Arcanist Version
arcanist 65cda1596f25bb9daea1d78c46402ab61df073d5 (9 Jul 2020)

I can’t reproduce this.

I started with an untracked file in my working directory:

epriestley@orbital ~/dev/spellbook $ git status
On branch feature1
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	untracked-file.c

nothing added to commit but untracked files present (use "git add" to track)

I landed a change, was prompted to stash the untracked file, selected “y”, saw it stashed and the change landed:

epriestley@orbital ~/dev/spellbook $ arc land --revision 148
 STRATEGY  Merging with "squash" strategy, the default strategy.
 SOURCE  Landing the current branch, "feature1".
 ONTO REMOTE  Landing onto remote "origin", the default remote under Git.
 ONTO TARGET  Landing onto target "master", the default target under Git.
 INTO REMOTE  Will merge into remote "origin" by default, because this is the remote the change is landing onto.
 INTO TARGET  Will merge into target "master" by default, because this is the "onto" target.
 FETCH  Fetching "master" from remote "origin"...

  $   git fetch --no-tags --quiet -- origin master

# Request received by "local.phacility.net", forwarding to cluster host "local.phacility.net".
# Acquiring read lock for repository "spellbook" on device "local.phacility.net"...
# Acquired read lock immediately.
# Device "local.phacility.net" is already a cluster leader and does not need to be synchronized.
# Cleared to fetch on cluster host "local.phacility.net".

 INTO COMMIT  Preparing merge into "master" from remote "origin", at commit "b80db8dfdd8e".
 LANDING  These changes will land:

  *   D148 Makefile Test
        b2479e831083  wip

 >>>  Land these changes? <y>
 >>>  (Using saved response to prompt "arc.land.confirm".)


 <!> UNCOMMITTED CHANGES 
You have uncommitted changes in this working copy.

    Working Copy: /Users/epriestley/scratch/spellbook//

Untracked changes in working copy:

    untracked-file.c

  ?   To configure Git to ignore certain files in this working copy,
      add the file paths to ".git/info/exclude".

 >>>  Stash these changes and continue? [y/N/?] y
 SAVE STASH  Saved uncommitted changes from working copy.
 MERGING  b2479e831083 wip
 PUSHING  Pushing changes to "origin".

  $   git push -- origin edb937ea2771:refs/heads/master

# Request received by "local.phacility.net", forwarding to cluster host "local.phacility.net".
# Acquiring write lock for repository "spellbook"...
# Acquired write lock immediately.
# Acquiring read lock for repository "spellbook" on device "local.phacility.net"...
# Acquired read lock immediately.
# Device "local.phacility.net" is already a cluster leader and does not need to be synchronized.
# Ready to receive on cluster host "local.phacility.net".
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 348 bytes | 69.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
# Released cluster write lock.
To ssh://local.phacility.com/source/spellbook.git
   b80db8d..edb937e  edb937ea2771 -> master

 CLEANUP  Cleaning up branch "feature1". To recover, run:

    $ git checkout -b feature1 b2479e831083

 UPDATE  Updating local branch "master"...
 CHECKOUT  Checking out "master".
 LOAD STASH  Restoring uncommitted changes to working copy.
 DONE  Landed changes.

The untracked file was then restored:

epriestley@orbital ~/dev/spellbook $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	untracked-file.c

nothing added to commit but untracked files present (use "git add" to track)

but actually we can not stash untracked changes

I can’t reproduce this.

I started with an untracked file:

epriestley@orbital ~/dev/spellbook $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	untracked-file.c

nothing added to commit but untracked files present (use "git add" to track)

I ran git stash --include-untracked, as arc does:

epriestley@orbital ~/dev/spellbook $ git stash --include-untracked
Saved working directory and index state WIP on master: edb937e Makefile Test

This stashed the untracked file:

epriestley@orbital ~/dev/spellbook $ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

I restored it from the stash with git stash pop:

epriestley@orbital ~/dev/spellbook $ git stash pop
Already up to date!
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	untracked-file.c

nothing added to commit but untracked files present (use "git add" to track)
Dropped refs/stash@{0} (b3beed787daa11a197bebb7d91918ed860a0c8f6)