comment
authorJoey Hess <joeyh@joeyh.name>
Wed, 13 Sep 2023 17:01:19 +0000 (13:01 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 13 Sep 2023 17:01:19 +0000 (13:01 -0400)
doc/bugs/--git-dir_and_--work-tree_separation_issue/comment_1_fa97996b85c0f949bbd720204db8ed46._comment [new file with mode: 0644]

diff --git a/doc/bugs/--git-dir_and_--work-tree_separation_issue/comment_1_fa97996b85c0f949bbd720204db8ed46._comment b/doc/bugs/--git-dir_and_--work-tree_separation_issue/comment_1_fa97996b85c0f949bbd720204db8ed46._comment
new file mode 100644 (file)
index 0000000..8d5ebdf
--- /dev/null
@@ -0,0 +1,61 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2023-09-13T16:46:35Z"
+ content="""
+I reproduced the behavior you showed.
+
+But git behaves the same way in the same situation. Compare these two commands:
+
+       joey@darkstar:~/tmp/bench/dir2>git --work-tree=/home/joey/tmp/bench --git-dir=/home/joey/tmp/bench/.dotfiles annex list
+       here
+       |web
+       ||bittorrent
+       |||
+       error: pathspec 'dir2/' did not match any file(s) known to git
+       Did you forget to 'git add'?
+       list: 1 failed
+
+       joey@darkstar:~/tmp/bench/dir2>git --git-dir=../.git --work-tree=.. ls-files --stage --error-unmatch --
+       error: pathspec 'dir2/' did not match any file(s) known to git
+       Did you forget to 'git add'?
+
+The second command is actually what the first command runs internally.
+
+Also, the behavior does not have anything to do with --git-dir and --work-tree:
+
+       joey@darkstar:~/tmp/bench>git init repo
+       Initialized empty Git repository in /home/joey/tmp/bench/repo/.git/
+       joey@darkstar:~/tmp/bench>cd repo
+       joey@darkstar:~/tmp/bench/repo>git-annex init
+       init  ok
+       m(recording state in git...)
+       joey@darkstar:~/tmp/bench/repo>mkdir dir2
+       joey@darkstar:~/tmp/bench/repo>cd dir2
+       joey@darkstar:~/tmp/bench/repo/dir2>git-annex list
+       here
+       |web
+       ||bittorrent
+       |||
+       error: pathspec 'dir2/' did not match any file(s) known to git
+       Did you forget to 'git add'?
+       list: 1 failed
+
+So if there's a bug here, it's that `git-annex list` displays an error message
+when run in a subdirectory that does not contain any files tracked by git.
+
+Also, many other git-annex commands run `git ls-files --error-unmatch`
+and so behave the same when run in such a subdirectory. Including whereis, find,
+get, etc.
+
+In fact, annex.skipunknown controls whether `--error-unmatch` is used.
+Setting it to true will avoid this behavior. But there were good reasons to
+change the annex.skipunknown default to false. And good reasons to use 
+`--error-unmatch` to implement that.
+
+Also, this behavior is somewhat documented, in the documentation of annex.skipunknown,
+it specifically talks about the case where no files in the current (or specified) 
+directory are tracked by git.
+
+So in my opinion, this does not seem like a bug.
+"""]]