git-annex/Command
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
..
Add.hs added ifM and nuked 11 lines of code 2012-03-14 17:43:34 -04:00
AddUnused.hs addunused: New command, the opposite of dropunused, it relinks unused content into the git repository. 2012-05-02 14:59:05 -04:00
AddUrl.hs Add annex.httpheaders and annex.httpheader-command config settings 2012-04-22 01:13:09 -04:00
Commit.hs ignore hook exit status 2012-03-14 12:41:00 -04:00
ConfigList.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
Copy.hs rework git check-attr interface 2012-02-13 23:52:21 -04:00
Dead.hs add 2011-12-02 19:22:43 -04:00
Describe.hs lint 2011-11-11 01:52:58 -04:00
Drop.hs hlint 2012-02-16 00:44:51 -04:00
DropKey.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
DropUnused.hs addunused: New command, the opposite of dropunused, it relinks unused content into the git repository. 2012-05-02 14:59:05 -04:00
Find.hs fun with symbols 2012-03-17 00:38:40 -04:00
Fix.hs type alias cleanup 2011-12-31 04:11:58 -04:00
FromKey.hs lint 2011-11-11 01:52:58 -04:00
Fsck.hs noop 2012-04-21 23:32:33 -04:00
Get.hs added ifM and nuked 11 lines of code 2012-03-14 17:43:34 -04:00
InAnnex.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
Init.hs init: When run in an already initalized repository, and without a description specified, don't delete the old description. 2011-11-12 15:42:52 -04:00
InitRemote.hs type alias cleanup 2011-12-31 04:11:58 -04:00
Lock.hs rework git check-attr interface 2012-02-13 23:52:21 -04:00
Log.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Map.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Merge.hs improve alwayscommit=false mode 2012-02-25 16:18:55 -04:00
Migrate.hs reorg 2012-02-17 00:19:47 -04:00
Move.hs added ifM and nuked 11 lines of code 2012-03-14 17:43:34 -04:00
PreCommit.hs added ifM and nuked 11 lines of code 2012-03-14 17:43:34 -04:00
RecvKey.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
Reinject.hs hlint 2012-02-16 00:44:51 -04:00
ReKey.hs variable name 2012-02-17 00:21:35 -04:00
Semitrust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
SendKey.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
Status.hs percentage library 2012-04-29 17:48:07 -04:00
Sync.hs added ifM and nuked 11 lines of code 2012-03-14 17:43:34 -04:00
Trust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Unannex.hs Support git's core.sharedRepository configuration 2012-04-21 15:36:52 -04:00
Uninit.hs support all filename encodings with ghc 7.4 2012-02-03 16:23:20 -04:00
Unlock.hs better file mode setting code 2012-04-21 16:01:56 -04:00
Untrust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Unused.hs Clean up handling of git directory and git worktree. 2012-05-18 17:03:12 -04:00
Upgrade.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Version.hs set oneshot mode on a per-command basis 2012-02-14 12:40:40 -04:00
Whereis.hs noop 2012-04-21 23:32:33 -04:00