From eac26f13db9d38b9b4e73a63c710552a9dc56b27 Mon Sep 17 00:00:00 2001
From: Joey Hess <joeyh@joeyh.name>
Date: Tue, 12 Apr 2016 14:19:34 -0400
Subject: [PATCH] Fix bug in annex.largefiles mimetype= matching when git-annex
 is run in a subdirectory of the repository.

---
 Limit.hs                                                       | 2 +-
 debian/changelog                                               | 2 ++
 .../largefiles_not_working_when_set_in_.gitattributes.mdwn     | 3 +++
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Limit.hs b/Limit.hs
index dc38b172d6..4bd5dd59e3 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -104,7 +104,7 @@ matchMagic (Just magic) glob = Right $ const go
  	cglob = compileGlob glob CaseSensative -- memoized
 	go (MatchingKey _) = pure False
 	go (MatchingFile fi) = liftIO $ catchBoolIO $
-		matchGlob cglob <$> magicFile magic (matchFile fi)
+		matchGlob cglob <$> magicFile magic (currFile fi)
 	go (MatchingInfo _ _ _ mimeval) = matchGlob cglob <$> getInfo mimeval
 matchMagic Nothing _ = Left "unable to load magic database; \"mimetype\" cannot be used"
 #endif
diff --git a/debian/changelog b/debian/changelog
index bfde90da19..a455655c42 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,8 @@ git-annex (6.20160319) UNRELEASED; urgency=medium
   * sync: Show output of git commit.
   * annex.thin and annex.hardlink are now supported on Windows.
   * unannex --fast now makes hard links on Windows.
+  * Fix bug in annex.largefiles mimetype= matching when git-annex
+    is run in a subdirectory of the repository.
 
  -- Joey Hess <id@joeyh.name>  Wed, 23 Mar 2016 11:42:36 -0400
 
diff --git a/doc/bugs/largefiles_not_working_when_set_in_.gitattributes.mdwn b/doc/bugs/largefiles_not_working_when_set_in_.gitattributes.mdwn
index 9452cbff25..7eb1332a29 100644
--- a/doc/bugs/largefiles_not_working_when_set_in_.gitattributes.mdwn
+++ b/doc/bugs/largefiles_not_working_when_set_in_.gitattributes.mdwn
@@ -72,3 +72,6 @@ lrwxrwxrwx 1 vagrant vagrant   189 Apr  6 15:20 tempfile -> ../.git/annex/object
 ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
 
 
+> Thanks for reporting. This was a dumb bug; it used the wrong path to the
+> file for mimetype=, which was relative to the top of the repository.
+> [[fixed|done]] --[[Joey]]