From e6b5913428189abb834bd52b6d4c562219aacdf6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 26 Oct 2013 15:53:05 -0400 Subject: sync: print a hint about receive.denyNonFastForwards when a push fails --- Command/Sync.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Command') diff --git a/Command/Sync.hs b/Command/Sync.hs index d792f156f..0c3804c1f 100644 --- a/Command/Sync.hs +++ b/Command/Sync.hs @@ -184,7 +184,11 @@ pushRemote remote branch = go =<< needpush showStart "push" (Remote.name remote) next $ next $ do showOutput - inRepo $ pushBranch remote branch + ok <- inRepo $ pushBranch remote branch + unless ok $ do + warning $ unwords [ "Pushing to " ++ Remote.name remote ++ " failed." ] + showNote "(non-fast-forward problems can be solved by setting receive.denyNonFastforwards to false in the remote's git config)" + return ok {- Pushes a regular branch like master to a remote. Also pushes the git-annex - branch. @@ -211,6 +215,9 @@ pushRemote remote branch = go =<< needpush - But overwriting of data on synced/git-annex can happen, in a race. - The only difference caused by using a forced push in that case is that - the last repository to push wins the race, rather than the first to push. + - + - The sync push will fail to overwrite if receive.denyNonFastforwards is + - set on the remote. -} pushBranch :: Remote -> Git.Ref -> Git.Repo -> IO Bool pushBranch remote branch g = tryIO (directpush g) `after` syncpush g -- cgit v1.2.3