# HG changeset patch # User Matt Harbison # Date 2018-01-14 01:07:14 # Node ID 588d02d9208a91d440617432077a79c83e5c27b5 # Parent fc39e2bfcd709f0b04c5191295f2639357a13527 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. diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -130,7 +130,9 @@ def filelogaddrevision(orig, self, text, 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, diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -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 @@ lfs requirement 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 @@ enabled adds the lfs requirement 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 @@ enabled adds the lfs requirement # 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