diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -993,8 +993,10 @@ # if file data starts with '\1\n', empty metadata block is # prepended, which adds 4 bytes to filelog.size(). return self._filelog.cmp(self._filenode, fctx.data()) - if self.size() == fctx.size(): + if self.size() == fctx.size() or self.flags() == b'l': # size() matches: need to compare content + # issue6456: Always compare symlinks because size can represent + # encrypted string for EXT-4 encryption(fscrypt). return self._filelog.cmp(self._filenode, fctx.data()) # size() differs diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1279,7 +1279,12 @@ or size == -2 # other parent or fn in copymap ): - madd(fn) + if (stat.S_ISLNK(st.st_mode) and size != st.st_size): + # issue6456: Size returned may be longer due to + # encryption on EXT-4 fscrypt, undecided. + ladd(fn) + else: + madd(fn) elif ( time != st[stat.ST_MTIME] and time != st[stat.ST_MTIME] & _rangemask