git-annex/Utility
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
..
Base64.hs rename 2011-07-05 20:24:10 -04:00
CoProcess.hs refactor 2012-02-20 15:22:21 -04:00
CopyFile.hs Pass -a to cp even when it supports --reflink=auto, to preserve permissions. 2012-05-15 14:18:51 -04:00
DataUnits.hs hslint 2011-12-09 01:57:13 -04:00
Directory.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
DiskFree.hs tweak 2012-04-18 13:23:46 -04:00
Dot.hs finished hlint pass 2011-07-15 12:47:14 -04:00
Exception.hs simplify 2012-03-16 02:12:56 -04:00
FileMode.hs in which I discover void 2012-04-21 23:06:19 -04:00
FileSystemEncoding.hs perhaps more clear type 2012-03-10 11:38:38 -04:00
Format.hs hlint 2012-02-16 00:44:51 -04:00
Gpg.hs Added shared cipher mode to encryptable special remotes. 2012-04-29 14:02:43 -04:00
Inotify.hs noop 2012-04-21 23:32:33 -04:00
JSONStream.hs go go gadget hlint 2011-09-20 23:24:48 -04:00
libdiskfree.c tweak 2012-04-18 13:23:46 -04:00
libdiskfree.h Renamed diskfree.c to avoid OSX case insensativity bug. 2012-04-13 11:26:39 -04:00
Matcher.hs fun with symbols 2012-03-17 00:38:40 -04:00
Misc.hs factor out Utility.FileSystemEncoding 2012-03-09 19:08:10 -04:00
Monad.hs noop 2012-04-21 23:32:33 -04:00
PartialPrelude.hs rename readMaybe to readish 2012-01-23 17:00:10 -04:00
Path.hs move 2012-03-11 18:12:36 -04:00
Percentage.hs percentage library 2012-04-29 17:48:07 -04:00
RsyncFile.hs update 2012-05-02 11:43:30 -04:00
SafeCommand.hs add safeSystem 2011-11-09 17:28:35 -04:00
State.hs switch to the strict state monad 2012-01-29 22:55:06 -04:00
TempFile.hs IO exception rework 2012-02-03 16:47:24 -04:00
Touch.hsc unbreak code inside ifdef 2012-04-22 11:22:20 -04:00
Url.hs bugfixes 2012-04-22 01:20:17 -04:00