arcanist: option to ignore untracked files
Open, Needs TriagePublic

Description

I'm annoyed that arc diff always stops and asks about any .diff or .log files I have lying around.
I use git status all the time, I do NOT (usually) forget files in my commits, so I don't need arc to interrupt my workflow like this ;)

I did some research and

  • there's arc diff --allow-untracked but that's too much typing (are we lazy or what)
  • https://mail.haskell.org/pipermail/ghc-devs/2014-July/005734.html says there is (was?) no way to set this as an option once and for all, so it only suggests some alias as a workaround (which I'd like to avoid - relearning, won't work elsewhere, etc.)

Has this been requested upstream already?

Thanks.

PS: this request is solely about untracked files. Unsubmitted changes are another thing, but for these a simple git stash does the job.

dfaure created this task.Feb 21 2017, 8:48 AM
Restricted Application added a subscriber: sysadmin. · View Herald TranscriptFeb 21 2017, 8:48 AM

(it's even more nonsense that arc land also complains about untracked files. This commit has been reviewed and accepted, arc should let me push it even if I have .diff files lying around....)

bcooksley changed the visibility from "Custom Policy" to "Public (No Login Required)".Feb 21 2017, 8:53 AM
bcooksley changed the edit policy from "Custom Policy" to "All Users".
bcooksley edited projects, added Phabricator; removed Sysadmin.
bcooksley moved this task from Backlog to Feature Requests on the Phabricator board.
bcooksley removed a subscriber: sysadmin.
bcooksley added a subscriber: bcooksley.

Upstream have indicated that this is a deliberate design decision - see https://secure.phabricator.com/T4163#49095 for more detail.
In this instance I think a local alias is probably the only workable solution.

Thanks for the information.

What arrogant people they are. How can they know better than me what should be my workflow ? If they were right that it clearly must be this way, then this would mean gerrit is wrong, github is wrong, git itself is wrong, basically every other tool is wrong. The fact that git/gerrit/github/reviewboard/etc. don't do this "are you sure? you have uncommitted files! are you stupid?" step proves that it's not as clear cut as they make it. I'm asking for a non-default option, they could provide it and "people in my team who forget to add files" (which is their argument) would be told not to set the option.

Anyhow, not your fault in any way, but I have to rant, and the process is that I can't rant upstream then I have to rant somewhere :-)

mwolff added a subscriber: mwolff.Mar 9 2017, 10:28 AM

+100 to what dfaure said, totally in sync to my view of the upstream people

If it helps at all, for fd.o & Collabora, we avoid using arcanist at all, and use git-phab. That ignores untracked files by default. ;) You could also ship this patch for Arcanist to at least allow you to configure --allow-untracked as the default.

ahmadsamir added a subscriber: ahmadsamir.EditedJun 14 2018, 4:50 PM

For the sake of the next person getting here through the frustrated-online-search tunnel (like I just did a few hours ago, after the untracked files conundrum hit me about 50 times), here's a simple bash function that I came up with to use --allow-untracked with arc diff (there are probably more elegant ways to do this, but this WFM, so):

arc() {
    local __arc=PATH_TO_ARC_BINARY;
    if [[ "$1" == "diff" ]]; then
        $__arc "$1" --allow-untracked "$@";
    else
        $__arc "$@";
    fi
}

I didn't know about arc alias and I won't use it anyway, I prefer to just use arc diff.

FWIW, that untracked-files check is absolutely useless in my case, as I always commit changes with git commit; I only use arc diff to publish a diff on phabricator.kde.org.

Revisiting an old issue :)

Now, there's no arc land --allow-untracked, can I just use git push or does arc land do some more stuff in the background? I mean the diff is built when I use arc diff, the code has been reviewed and accepted already...

arc land verifies that the patch has actually been approved (this saved me from landing the wrong commits a few times), it also deletes the local feature branch. But well, it can also push to the wrong branch :-)

Both solutions close the phab merge request, though, so I guess you don't have to use arc land, if you check what you're pushing :)

Yeah, better arc land than breaking something (until the next time it gets on my nerves and I try to hack the arcanist source code, I know next to nothing about PHP... :)).

"$@" contains all arguments including "diff", so the function didn't work for me. My fixed version:

arc() {
    local __arc=`/usr/bin/which --skip-function arc`;
    if [[ "$1" == "diff" ]]; then
        shift;
        $__arc diff --allow-untracked "$@";
    else
        $__arc "$@";
    fi
}

Thanks for fixing it.

Don't underestimate the power of frustration :). Use AT YOUR OWN RISK (I don't know php, but dug away in the code anyway):

index f95742c1..ba761506 100644
--- a/src/repository/api/ArcanistRepositoryAPI.php
+++ b/src/repository/api/ArcanistRepositoryAPI.php
@@ -208,6 +208,11 @@ abstract class ArcanistRepositoryAPI extends Phobject {
    */
   private function getUncommittedPathsWithMask($mask) {
     $match = array();
+
+    if ($mask == self::FLAG_UNTRACKED) {
+      return $match;
+    }
+
     foreach ($this->getUncommittedStatus() as $path => $flags) {
       if ($flags & $mask) {
         $match[] = $path;

This neutralises the whole untracked debacle for arc. Maybe some one who actually knows php can review/vet it?

In the upstream phabricator report, the main dev said he asked several engineers and none of them gave him any satisfactory answer as to why they have untracked files in their git checkouts... to each his own, but what I came away with from that anecdote is that devs _do_ have untraked files in their git checkouts, why make the tool work against them rather than for them.

I found this https://mail.haskell.org/pipermail/ghc-devs/2014-July/005720.html , which made me search the git-confing man page and I ended up using:
git config --global status.showUntrackedFiles no

I don't find, for the time being anyway, that git reporting untracked files is useful for me, so that option makes git not consider untracked files at all.

ognarb added a subscriber: ognarb.Wed, Nov 6, 11:44 PM

@ahmadsamir In PHP always use === and !== instead of == and !=

@ahmadsamir In PHP always use === and !== instead of == and !=

Thanks for looking at this :)