git-annex/doc/bugs/assistant_ignore_.gitignore.mdwn
Joey Hess b191d5c595 gitignore support for the assistant and watcher
Requires git 1.8.4 or newer. When it's installed, a background
git check-ignore process is run, and used to efficiently check ignores
whenever a new file is added.

Thanks to Adam Spiers, for getting the necessary support into git for this.

A complication is what to do about files that are gitignored but have
been checked into git anyway. git commands assume the ignore has been
overridden in this case, and not need any more overriding to commit a
changed version.

However, for the assistant to do the same, it would have to run git ls-files
to check if the ignored file is in git. This is somewhat expensive. Or it
could use the running git-cat-file process to query the file that way,
but that requires transferring the whole file content over a pipe, so it
can be quite expensive too, for files that are not git-annex
symlinks.

Now imagine if the user knows that a file or directory tree will be getting
frequent changes, and doesn't want the assistant to sync it, so gitignores
it. The assistant could overload the system with repeated ls-files checks!

So, I've decided that the assistant will not automatically commit changes
to files that are gitignored. This is a tradeoff. Hopefully it won't be a
problem to adjust .gitignore settings to not ignore files you want the
assistant to autocommit, or to manually git annex add files that are listed
in .gitignore.

(This could be revisited if git-annex gets access to an interface to check
the content of the index w/o forking a git command. This could be libgit2,
or perhaps a separate git cat-file --batch-check process, so it wouldn't
need to ship over the whole file content.)

This commit was sponsored by Francois Marier. Thanks!
2013-08-02 20:37:03 -04:00

31 lines
987 B
Markdown

What steps will reproduce the problem?
1. have an existing directory with a bunch of files
2. create a `.gitignore` file that matches some files (*.log *.aux *~ etc.)
3. `git init .`
4. `git annex init work`
5. `git remote add server server:Blabla`
6. `ssh server`
7. `@server $ mkdir Blabla`
8. `@server $ cd Blabla`
9. `@server $ git init .`
10. `@server $ git annex init server`
11. `@server $ exit`
12. `git annex webapp`
What is the expected output? What do you see instead?
I expect that ingored files stay ignored,
I see instead that all the files (including the ignored) are transfered to the server
What version of git-annex are you using? On what operating system?
3.20130124, debian sid (on both machines)
> As noted in [[design/assistant/inotify]]'s TODO list, this
> needs an efficient gitignore query interface in git (DNE)
> or a gitignore parser. --[[Joey]]
[[!tag /design/assistant]]
> [[fixed|done]]; with git 1.8.4 the assistant honors .gitignore --[[Joey]]