# HG changeset patch # User Dan Villiom Podlaski Christiansen <danchr@gmail.com> # Date 1622556720 -7200 # Tue Jun 01 16:12:00 2021 +0200 # Node ID f340b95ed9c85ee39ecb8f583c2aef51ca564d48 # Parent 7a3caae2567d3fd6780772d48e87a1fbdd83dedb gitdirstate: use os.access() rather than bare except diff --git a/hggit/gitdirstate.py b/hggit/gitdirstate.py --- a/hggit/gitdirstate.py +++ b/hggit/gitdirstate.py @@ -99,12 +99,8 @@ files.append(util.expandpath(path)) patterns = [] # Only use .gitignore if there's no .hgignore - try: - fp = open(files[0], 'rb') - fp.close() - except: - fns = self._finddotgitignores() - for fn in fns: + if not os.access(files[0], os.R_OK): + for fn in self._finddotgitignores(): d = os.path.dirname(fn) fn = self.pathto(fn) if not os.path.exists(fn):