Patchwork [3,of,3,STABLE] lfs: don't automatically exclude '.hg*' files from external tracking

login
register
mail settings
Submitter Matt Harbison
Date Jan. 24, 2018, 2:37 a.m.
Message ID <414e4d9ed8518df0b69f.1516761464@Envy>
Download mbox | patch
Permalink /patch/27057/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 24, 2018, 2:37 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1516760985 18000
#      Tue Jan 23 21:29:45 2018 -0500
# Branch stable
# Node ID 414e4d9ed8518df0b69f3db69054d674cf616559
# Parent  882ea5de2df75eb058e8c8fa583e59ef61739b3c
lfs: don't automatically exclude '.hg*' files from external tracking

The only reasons I did this in the first place was because tracking externally
seems like it would always be a mistake, and the eol extension does the same
thing.  Yuya and Jun thought it might be better to not do this[1], so I'll defer
to them on this.  If a problem with say, .hgtags or .hgeol does arise, it can be
added back without breaking existing repos.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-January/110371.html

Patch

diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -131,8 +131,7 @@ 
 
     lfstrack = self.opener.options['lfstrack']
 
-    # Always exclude hg owned files
-    if not self.filename.startswith('.hg') and lfstrack(self.filename, textlen):
+    if 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
@@ -18,9 +18,7 @@ 
 # Commit small file
   $ echo s > smallfile
   $ echo '**.py = LF' > .hgeol
-  $ hg --config lfs.track='size(">1000B") | "path:.hgeol"' commit -Aqm "add small file"
-  $ hg debugdata .hgeol 0
-  **.py = LF
+  $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file"
 
 # Commit large file
   $ echo $LONG > largefile
@@ -976,6 +974,7 @@ 
 
   $ cat > .hglfs << EOF
   > [track]
+  > path:.hglfs = none()
   > **.test = size(">5B")
   > **.exclude = none()
   > ** = size(">10B")