diff -r 2c0aa02ecd5a -r 6637b079ae45 hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py Tue Oct 16 16:24:46 2018 +0200 +++ b/hgext/lfs/wrapper.py Thu Sep 20 17:27:01 2018 -0700 @@ -46,7 +46,13 @@ '''Wrap server command to announce lfs server capability''' caps = orig(repo, proto) if util.safehasattr(repo.svfs, 'lfslocalblobstore'): - # XXX: change to 'lfs=serve' when separate git server isn't required? + # Advertise a slightly different capability when lfs is *required*, so + # that the client knows it MUST load the extension. If lfs is not + # required on the server, there's no reason to autoload the extension + # on the client. + if b'lfs' in repo.requirements: + caps.append('lfs-serve') + caps.append('lfs') return caps