hgext/lfs/wrapper.py
changeset 40324 6637b079ae45
parent 39949 e1f97179a3f5
child 40368 fad6068249d9
--- 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