git-annex/Git
Joey Hess bb4f31a0ee Clean up handling of git directory and git worktree.
Baked into the code was an assumption that a repository's git directory
could be determined by adding ".git" to its work tree (or nothing for bare
repos). That fails when core.worktree, or GIT_DIR and GIT_WORK_TREE are
used to separate the two.

This was attacked at the type level, by storing the gitdir and worktree
separately, so Nothing for the worktree means a bare repo.

A complication arose because we don't learn where a repository is bare
until its configuration is read. So another Location type handles
repositories that have not had their config read yet. I am not entirely
happy with this being a Location type, rather than representing them
entirely separate from the Git type. The new code is not worse than the
old, but better types could enforce more safety.

Added support for core.worktree. Overriding it with -c isn't supported
because it's not really clear what to do if a git repo's config is read, is
not bare, and is then overridden to bare. What is the right git directory
in this case? I will worry about this if/when someone has a use case for
overriding core.worktree with -c. (See Git.Config.updateLocation)

Also removed and renamed some functions like gitDir and workTree that
misused git's terminology.

One minor regression is known: git annex add in a bare repository does not
print a nice error message, but runs git ls-files in a way that fails
earlier with a less nice error message. This is because before --work-tree
was always passed to git commands, even in a bare repo, while now it's not.
2012-05-18 17:03:12 -04:00
..
AutoCorrect.hs compute distance in correct direction 2012-04-14 16:01:08 -04:00
Branch.hs removed another 10 lines via ifM 2012-03-16 01:59:07 -04:00
CatFile.hs fix filename encoding for git cat-file 2012-02-26 14:11:50 -04:00
CheckAttr.hs cleanup 2012-02-21 00:16:24 -04:00
Command.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Config.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Construct.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Filename.hs handle C-style escapes in Format 2011-12-23 01:05:16 -04:00
HashObject.hs cleanup 2012-02-21 00:16:24 -04:00
Index.hs Add --include, which is the same as --not --exclude. 2011-12-22 14:00:17 -04:00
LsFiles.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
LsTree.hs support all filename encodings with ghc 7.4 2012-02-03 16:23:20 -04:00
Queue.hs Added a annex.queuesize setting 2012-02-15 11:14:19 -04:00
Ref.hs bup: Properly handle key names with spaces or other things that are not legal git refs. 2012-04-11 12:45:49 -04:00
Sha.hs log --after=date 2012-01-06 17:24:03 -04:00
SharedRepository.hs Support git's core.sharedRepository configuration 2012-04-21 15:36:52 -04:00
Types.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
UnionMerge.hs noop 2012-04-21 23:32:33 -04:00
Url.hs rename readMaybe to readish 2012-01-23 17:00:10 -04:00
Version.hs Can now be built with older git versions (before 1.7.7); the resulting binary should only be used with old git. 2011-12-22 15:01:13 -04:00