From 1ac79e6fe5664995c48c460ba632d6ad2e5408a0 Mon Sep 17 00:00:00 2001
From: Joey Hess <joeyh@joeyh.name>
Date: Tue, 6 Oct 2015 17:29:44 -0400
Subject: [PATCH] copy --auto was checking the wrong repo's preferred content.
 (--from was checking what --to should, and vice-versa.) Fixed this bug, which
 was introduced in version 5.20150727.

---
 Command/Copy.hs                                           | 6 +++---
 debian/changelog                                          | 3 +++
 .../git_annex_preferred_content_strange_behavior.mdwn     | 2 ++
 .../comment_4_6e0f6ec54098f6e8fde80f733dd9c124._comment   | 8 ++++++++
 4 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 doc/bugs/git_annex_preferred_content_strange_behavior/comment_4_6e0f6ec54098f6e8fde80f733dd9c124._comment

diff --git a/Command/Copy.hs b/Command/Copy.hs
index 77711f05b2..1711b0c633 100644
--- a/Command/Copy.hs
+++ b/Command/Copy.hs
@@ -52,7 +52,7 @@ start o file key = stopUnless shouldCopy $
 		| autoMode o = want <||> numCopiesCheck file key (<)
 		| otherwise = return True
 	want = case Command.Move.fromToOptions (moveOptions o) of
-		ToRemote _ -> 
-			wantGet False (Just key) (Just file)
-		FromRemote dest -> (Remote.uuid <$> getParsed dest) >>=
+		ToRemote dest -> (Remote.uuid <$> getParsed dest) >>=
 			wantSend False (Just key) (Just file)
+		FromRemote _ ->
+			wantGet False (Just key) (Just file)
diff --git a/debian/changelog b/debian/changelog
index 1c1aa63c7b..a2624d20a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,9 @@ git-annex (5.20150931) UNRELEASED; urgency=medium
   * Ported disk free space checking code to work on Solaris.
   * Windows webapp: Fix support for entering password when setting
     up a ssh remote.
+  * copy --auto was checking the wrong repo's preferred content.
+    (--from was checking what --to should, and vice-versa.)
+    Fixed this bug, which was introduced in version 5.20150727.
 
  -- Joey Hess <id@joeyh.name>  Thu, 01 Oct 2015 12:42:56 -0400
 
diff --git a/doc/bugs/git_annex_preferred_content_strange_behavior.mdwn b/doc/bugs/git_annex_preferred_content_strange_behavior.mdwn
index 89d6cac90e..4ee0d51944 100644
--- a/doc/bugs/git_annex_preferred_content_strange_behavior.mdwn
+++ b/doc/bugs/git_annex_preferred_content_strange_behavior.mdwn
@@ -49,3 +49,5 @@ git annex copy --to b --auto # now, it copies the file to b. Why ??
 ### 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)
 
 Definitely! git-annex is a wonderful tool that I have been using every day to manage all my files for 2 years now. Thank you for this excellent software.
+
+> [[fixed|done]] --[[Joey]]
diff --git a/doc/bugs/git_annex_preferred_content_strange_behavior/comment_4_6e0f6ec54098f6e8fde80f733dd9c124._comment b/doc/bugs/git_annex_preferred_content_strange_behavior/comment_4_6e0f6ec54098f6e8fde80f733dd9c124._comment
new file mode 100644
index 0000000000..78cde36163
--- /dev/null
+++ b/doc/bugs/git_annex_preferred_content_strange_behavior/comment_4_6e0f6ec54098f6e8fde80f733dd9c124._comment
@@ -0,0 +1,8 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 4"""
+ date="2015-10-06T21:28:43Z"
+ content="""
+Indeed, the logic got switched to opposite it should during the
+optparse-applicative transition.
+"""]]