changeset 35648:588d02d9208a

lfs: always exclude '.hg*' text files I can't think of any problematic scenarios (though things might get interesting with .hgtags, since every head is consulted). The eol extension explicitly disables handling these files, and that seems reasonable here too.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 13 Jan 2018 20:07:14 -0500
parents fc39e2bfcd70
children 1f0690bfc683
files hgext/lfs/wrapper.py tests/test-lfs.t
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/lfs/wrapper.py	Mon Jan 15 00:16:11 2018 +0530
+++ b/hgext/lfs/wrapper.py	Sat Jan 13 20:07:14 2018 -0500
@@ -130,7 +130,9 @@
         textlen -= offset
 
     lfstrack = self.opener.options['lfstrack']
-    if lfstrack(self.filename, textlen):
+
+    # Always exclude hg owned files
+    if not self.filename.startswith('.hg') and lfstrack(self.filename, textlen):
         flags |= revlog.REVIDX_EXTSTORED
 
     return orig(self, text, transaction, link, p1, p2, cachedelta=cachedelta,
--- a/tests/test-lfs.t	Mon Jan 15 00:16:11 2018 +0530
+++ b/tests/test-lfs.t	Sat Jan 13 20:07:14 2018 -0500
@@ -17,7 +17,10 @@
 
 # Commit small file
   $ echo s > smallfile
-  $ hg commit -Aqm "add small file"
+  $ echo '**.py = LF' > .hgeol
+  $ hg --config lfs.track='size(">1000B") | "path:.hgeol"' commit -Aqm "add small file"
+  $ hg debugdata .hgeol 0
+  **.py = LF
 
 # Commit large file
   $ echo $LONG > largefile
@@ -70,7 +73,7 @@
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 2 changes to 2 files
+  added 2 changesets with 3 changes to 3 files
   calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
   $ grep lfs $TESTTMP/server/.hg/requires
   lfs
@@ -104,8 +107,8 @@
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 2 changes to 2 files
-  new changesets b29ba743f89d:00c137947d30
+  added 2 changesets with 3 changes to 3 files
+  new changesets 0ead593177f7:b88141481348
   (run 'hg update' to get a working copy)
   $ grep lfs .hg/requires $TESTTMP/server/.hg/requires
   .hg/requires:lfs
@@ -117,7 +120,7 @@
 
 # Update to the last revision containing the large file
   $ hg update
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 # Check the blobstore has been populated on update
   $ find .hg/store/lfs/objects | sort