Page MenuHomePhabricator

Arcanist Ignoring .gitignore
Closed, InvalidPublic

Description

I mentioned before how the binaries were being pushed up to the repository despite the --skip-binaries flag on arc diff, and @epriestley mentioned using a .gitignore file. I created one and commited it, also untracking and removing the binaries from before, as per standard Git protocol (I RTD'd.)

.gitignore
*.a
*.o
*.exe
**/bin
**/obj
pawlib/

I also waited for a couple of months to make sure that it wasn't a lagging bug fix or some repository weirdness. Yet, on all of our repositories, including the one the above file is from, the binaries continue to be pushed up to both the repos and to Files. These are all repos hosted on Phabricator.

Side note, this also brings up again the other problem that there is no way to remove files in bulk from Files (T9514). If I wanted to nuke all these binaries (of which there are currently thousands), I would have to do so one. at. a. time.


  1. Ensure .gitignore is present, committed, and properly configured to ignore binary file types. (Also, ensure there are some such binary files added to the local folder but not yet "added".)
  2. I make changes to my repository (i.e. to code files).
  3. In a Terminal, I run git add . and arc diff.
  4. I fill out the arc diff form. (It makes no difference if creating or updating a diff.)
  5. Note that Arcanist is listing all the binaries in the repository as "Uploaded". They similarly appear in the Differential.

Event Timeline

Please include reproduction instructions when filing a bug report. See Contributing Bug Reports.

Hmm, okay, I wrote those out in list form to make it a bit more obvious. I don't have any way to try and duplicate that here.

Those reproduction instructions do not describe a bug. When you change a file and add it, it is expected that it will be part of any diffs or commits.

Perhaps you mean to include a step involving .gitignore?

Aih, I'm having one of those days.

I can't reproduce this. Here's what I did:

I created a .gitignore in a repository, and configured it to ignore file.bin in the same repository:

$ nano .gitignore
$ cat .gitignore 
file.bin
$ git add .
$ git commit -am 'Ignore "file.bin"'
[master 790a0e7] Ignore "file.bin"
 1 file changed, 1 insertion(+)
 create mode 100644 .gitignore

Now I added content to file.bin (the ignored file, representing a compiled binary) and file.txt (a non-ignored file, representing source code):

$ head -c256 /dev/random > file.bin
$ nano file.txt

Note that git status does not report status for the ignored file.bin, because it is .gitignored:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	file.txt

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

The file is present, however:

$ wc -c file.bin 
     256 file.bin

Now, I ran git add . to add all files:

$ git add .

Here's the new git status:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   file.txt

Now I committed:

$ git commit -m 'source changes'
[master 82e34fe] source changes
 1 file changed, 1 insertion(+)
 create mode 100644 file.txt

Now I'll make a diff:

$ arc diff --conduit-uri=http://local.phacility.com/
Linting...
No lint engine configured for this project.
Running unit tests...
No unit test engine is configured for this project.
 SKIP STAGING  Unable to determine repository for this change.
Updating commit message...
Created a new Differential revision:
        Revision URI: http://local.phacility.com/D107

Included changes:
  A       .gitignore
  A       file.txt

Note that file.bin was not uploaded, none of the commits include it, and the revision in the web does not include it either:

Screen Shot 2015-12-30 at 2.32.52 PM.png (538×1 px, 47 KB)

Hm, I attempted another reproduction of the issue on a clean repo, and I can't get it to happen now either. Perhaps something didn't get the memo when I untracked some old binaries in the other repos. GA and mark this as invalid, I suppose, and I'll update here if I pinpoint a problem. Thanks anyway. :\