samtools / htsjdk

A Java API for high-throughput sequencing data (HTS) formats.
http://samtools.github.io/htsjdk/
283 stars 242 forks source link

Bug in .gitignore? #1503

Closed dariober closed 4 years ago

dariober commented 4 years ago

The .gitignore in commit e803eea contains the line:

build/

I think this makes the directories src/test/java/htsjdk/samtools/cram/build/ and src/main/java/htsjdk/samtools/cram/build/ to be erroneously ignored. Shouldn't it be something like build/* instead?


Steps to reproduce:

git clone https://github.com/samtools/htsjdk
cd htsjdk

New file src/main/java/htsjdk/samtools/cram/build/foo.txt is ignored:

touch src/main/java/htsjdk/samtools/cram/build/foo.txt

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

nothing to commit, working tree clean

Edit .gitignore and try again, now foo.txt is picked up:

sed -i 's|build/|build/*|' .gitignore 

git status

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

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:   .gitignore

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

    src/main/java/htsjdk/samtools/cram/build/foo.txt

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

This is with git 2.17.1

jmarshall commented 4 years ago

Even better as /build/ to indicate that it's supposed to only affect build in the top-level directory.

whaleberg commented 4 years ago

Oh wow. That's a dumb bug. Thanks for finding this!