Skip to content

.gitignore parse crash breaks getdirstate

Hallow!

my project have entry \.directory in .gitignore, that lead to crash on windows platform:

    #!python
    ** Mercurial version (5.6.1).  TortoiseHg version (5.7rc0+5-a627b2be721a)
    ** Command: --nofork
    ** CWD: D:\projects\hg\thg\thg.work
    ** Encoding: cp1251
    ** Extensions loaded: convert, strip, mq, rebase, record, transplant, highlight, show, commitextras, fix, share, hggit, censor, histedit, closehead, remotenames, schemes, eol, extdiff, patchbomb, amend, evolve, topic, absorb, split, uncommit, tortoisehg.util.configitems
    ** Python version: 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)]
    ** Windows version: sys.getwindowsversion(major=6, minor=3, build=9600, platform=2, service_pack='')
    ** Processor architecture: x64
    ** Qt-5.13.2 PyQt-5.13.2 QScintilla-2.10.8
    Traceback (most recent call last):
      File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 77, in gignore
        ignorefunc = matchmod.match(root, b'', [], allpats)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py", line 276, in match
        kindpats = normalize(include, b'glob', root, cwd, auditor, warn)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py", line 329, in _donormalize
        pat = pathutil.canonpath(root, cwd, pat, auditor=auditor)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\pathutil.py", line 263, in canonpath
        raise error.Abort(
    mercurial.error.Abort: \.directory not under root 'D:\projects\askon\spodes\DLMS.meterkit\cosemlib'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 83, in gignore
        matchmod.match(root, b'', [], extrapatterns)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py", line 276, in match
        kindpats = normalize(include, b'glob', root, cwd, auditor, warn)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py", line 329, in _donormalize
        pat = pathutil.canonpath(root, cwd, pat, auditor=auditor)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\pathutil.py", line 263, in canonpath
        raise error.Abort(
    mercurial.error.Abort: \.directory not under root 'D:\projects\askon\spodes\DLMS.meterkit\cosemlib'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\eclipse\plugins\org.python.pydev.core_8.1.0.202012051215\pysrc\_pydev_bundle\pydev_monkey_qt.py", line 205, in _new_run
        return self._original_run()
      File "D:\projects\hg\thg\thg.work\tortoisehg\hgqt\status.py", line 760, in run
        status = self.repo.status(**stopts)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\localrepo.py", line 3014, in status
        return self[node1].status(
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py", line 427, in status
        r = ctx2._buildstatus(
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py", line 1961, in _buildstatus
        s = self._dirstatestatus(match, listignored, listclean, listunknown)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py", line 1870, in _dirstatestatus
        cmp, s = self._repo.dirstate.status(
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\dirstate.py", line 1247, in status
        self.walk(match, subrepos, listunknown, listignored, full=full)
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\dirstate.py", line 925, in walk
        ignore = self._ignore
      File "D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\scmutil.py", line 1702, in __get__
        entry.obj = self.func(obj)
      File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 113, in _ignore
        return gignore(self._root, files, self._ui.warn,
      File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 85, in gignore
        raise error.Abort(b'%s: %s' % (b'extra patterns', inst[0]))
    TypeError: 'Abort' object is not subscriptable
    

inho: such crash should not breaks gitdirstate - gignore could skip failure entrues, and warn user about failure.

Edited by alexrayne
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information