git-annex/Command
Joey Hess d7c93b8913 fully support core.symlinks=false in all relevant symlink handling code
Refactored annex link code into nice clean new library.

Audited and dealt with calls to createSymbolicLink.
Remaining calls are all safe, because:

Annex/Link.hs:  ( liftIO $ createSymbolicLink linktarget file
  only when core.symlinks=true
Assistant/WebApp/Configurators/Local.hs:                createSymbolicLink link link
  test if symlinks can be made
Command/Fix.hs: liftIO $ createSymbolicLink link file
  command only works in indirect mode
Command/FromKey.hs:     liftIO $ createSymbolicLink link file
  command only works in indirect mode
Command/Indirect.hs:                    liftIO $ createSymbolicLink l f
  refuses to run if core.symlinks=false
Init.hs:                createSymbolicLink f f2
  test if symlinks can be made
Remote/Directory.hs:    go [file] = catchBoolIO $ createSymbolicLink file f >> return True
  fast key linking; catches failure to make symlink and falls back to copy
Remote/Git.hs:          liftIO $ catchBoolIO $ createSymbolicLink loc file >> return True
  ditto
Upgrade/V1.hs:                          liftIO $ createSymbolicLink link f
  v1 repos could not be on a filesystem w/o symlinks

Audited and dealt with calls to readSymbolicLink.
Remaining calls are all safe, because:

Annex/Link.hs:		( liftIO $ catchMaybeIO $ readSymbolicLink file
  only when core.symlinks=true
Assistant/Threads/Watcher.hs:		ifM ((==) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file))
  code that fixes real symlinks when inotify sees them
  It's ok to not fix psdueo-symlinks.
Assistant/Threads/Watcher.hs:		mlink <- liftIO (catchMaybeIO $ readSymbolicLink file)
  ditto
Command/Fix.hs:	stopUnless ((/=) (Just link) <$> liftIO (catchMaybeIO $ readSymbolicLink file)) $ do
  command only works in indirect mode
Upgrade/V1.hs:	getsymlink = takeFileName <$> readSymbolicLink file
  v1 repos could not be on a filesystem w/o symlinks

Audited and dealt with calls to isSymbolicLink.
(Typically used with getSymbolicLinkStatus, but that is just used because
getFileStatus is not as robust; it also works on pseudolinks.)
Remaining calls are all safe, because:

Assistant/Threads/SanityChecker.hs:                             | isSymbolicLink s -> addsymlink file ms
  only handles staging of symlinks that were somehow not staged
  (might need to be updated to support pseudolinks, but this is
  only a belt-and-suspenders check anyway, and I've never seen the code run)
Command/Add.hs:         if isSymbolicLink s || not (isRegularFile s)
  avoids adding symlinks to the annex, so not relevant
Command/Indirect.hs:                            | isSymbolicLink s -> void $ flip whenAnnexed f $
  only allowed on systems that support symlinks
Command/Indirect.hs:            whenM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f) $ do
  ditto
Seek.hs:notSymlink f = liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f
  used to find unlocked files, only relevant in indirect mode
Utility/FSEvents.hs:                    | Files.isSymbolicLink s = runhook addSymlinkHook $ Just s
Utility/FSEvents.hs:                                            | Files.isSymbolicLink s ->
Utility/INotify.hs:                             | Files.isSymbolicLink s ->
Utility/INotify.hs:                     checkfiletype Files.isSymbolicLink addSymlinkHook f
Utility/Kqueue.hs:              | Files.isSymbolicLink s = callhook addSymlinkHook (Just s) change
  all above are lower-level, not relevant

Audited and dealt with calls to isSymLink.
Remaining calls are all safe, because:

Annex/Direct.hs:			| isSymLink (getmode item) =
  This is looking at git diff-tree objects, not files on disk
Command/Unused.hs:		| isSymLink (LsTree.mode l) = do
  This is looking at git ls-tree, not file on disk
Utility/FileMode.hs:isSymLink :: FileMode -> Bool
Utility/FileMode.hs:isSymLink = checkMode symbolicLinkMode
  low-level

Done!!
2013-02-17 16:43:14 -04:00
..
Add.hs fully support core.symlinks=false in all relevant symlink handling code 2013-02-17 16:43:14 -04:00
AddUnused.hs block all commands that don't work in direct mode 2012-12-29 14:28:19 -04:00
AddUrl.hs add: Improved detection of files that are modified while being added. 2013-02-14 16:54:36 -04:00
Assistant.hs where indentation 2012-11-12 01:05:04 -04:00
Commit.hs where indentation 2012-11-12 01:05:04 -04:00
ConfigList.hs more descriptive name for oneshot 2012-09-15 20:46:38 -04:00
Copy.hs More commands work in direct mode repositories: find, whereis, move, copy, drop, log. 2013-01-05 17:17:04 -04:00
Dead.hs dead: Remove dead repository from all groups. 2012-10-10 15:39:13 -04:00
Describe.hs lint 2011-11-11 01:52:58 -04:00
Direct.hs convert notBareRepo to a CommandCheck 2012-12-29 14:45:19 -04:00
Drop.hs proper fix for dropunused 2013-02-15 17:58:49 -04:00
DropKey.hs more descriptive name for oneshot 2012-09-15 20:46:38 -04:00
DropUnused.hs webapp and assistant glacier support 2012-11-24 16:30:15 -04:00
Find.hs More commands work in direct mode repositories: find, whereis, move, copy, drop, log. 2013-01-05 17:17:04 -04:00
Fix.hs guard readSymbolicLink 2013-01-05 16:07:27 -04:00
FromKey.hs convert notBareRepo to a CommandCheck 2012-12-29 14:45:19 -04:00
Fsck.hs fully support core.symlinks=false in all relevant symlink handling code 2013-02-17 16:43:14 -04:00
Get.hs drop: Suggest using git annex move when numcopies prevents dropping a file. 2013-01-09 18:53:59 -04:00
Group.hs simplify 2012-10-01 15:17:21 -04:00
Help.hs where indentation 2012-11-12 01:05:04 -04:00
Import.hs convert notBareRepo to a CommandCheck 2012-12-29 14:45:19 -04:00
InAnnex.hs where indentation 2012-11-12 01:05:04 -04:00
Indirect.hs fully support core.symlinks=false in all relevant symlink handling code 2013-02-17 16:43:14 -04:00
Init.hs where indentation 2012-11-12 01:05:04 -04:00
InitRemote.hs whitespace fixes 2012-12-13 00:45:27 -04:00
Lock.hs block all commands that don't work in direct mode 2012-12-29 14:28:19 -04:00
Log.hs More commands work in direct mode repositories: find, whereis, move, copy, drop, log. 2013-01-05 17:17:04 -04:00
Map.hs where indentation 2012-11-12 01:05:04 -04:00
Merge.hs improve alwayscommit=false mode 2012-02-25 16:18:55 -04:00
Migrate.hs add: Improved detection of files that are modified while being added. 2013-02-14 16:54:36 -04:00
Move.hs proper fix for dropunused 2013-02-15 17:58:49 -04:00
PreCommit.hs pre-commit: Update direct mode mappings. 2013-02-06 12:44:19 -04:00
RecvKey.hs safe recv-key in direct mode 2013-01-11 16:03:45 -04:00
Reinject.hs block all commands that don't work in direct mode 2012-12-29 14:28:19 -04:00
ReKey.hs migrate, rekey: copy rather than hard linking in crippled filesystem mode 2013-02-15 13:51:50 -04:00
Semitrust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
SendKey.hs Special remotes now all rollback storage of keys that get modified during the transfer, which can happen in direct mode. 2013-01-09 18:42:29 -04:00
Status.hs type based git config handling for remotes 2013-01-01 13:58:14 -04:00
Sync.hs fully support core.symlinks=false in all relevant symlink handling code 2013-02-17 16:43:14 -04:00
TransferInfo.hs fixes for transfer resume 2012-09-24 13:18:16 -04:00
TransferKey.hs quiet calls to transferkey 2012-09-24 13:36:05 -04:00
Trust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Unannex.hs uninit, unannex --fast: If hard link creation fails, fall back to slow mode. 2013-02-06 14:02:18 -04:00
Ungroup.hs simplify 2012-10-01 15:17:21 -04:00
Uninit.hs block all commands that don't work in direct mode 2012-12-29 14:28:19 -04:00
Unlock.hs block all commands that don't work in direct mode 2012-12-29 14:28:19 -04:00
Untrust.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Unused.hs type based git config handling for remotes 2013-01-01 13:58:14 -04:00
Upgrade.hs clean up check selection code 2011-10-29 15:19:05 -04:00
Version.hs where indentation 2012-11-12 01:05:04 -04:00
Vicfg.hs vicfg: Quote filename. Closes: #696193 2012-12-18 12:19:24 -04:00
Watch.hs convert notBareRepo to a CommandCheck 2012-12-29 14:45:19 -04:00
WebApp.hs webapp: Now allows restarting any threads that crash. 2013-01-26 17:09:33 +11:00
Whereis.hs More commands work in direct mode repositories: find, whereis, move, copy, drop, log. 2013-01-05 17:17:04 -04:00
XMPPGit.hs flush stdout 2012-11-09 14:33:34 -04:00