# Mutations the rawstore tests must catch. One row each: file | exact text | replacement | why
# `python3 .github/scripts/run_tests.py --mutants --only rawstore` applies each row to a scratch copy
# of rawstore/ and fails when the tests still pass. The text must occur exactly once in the file.
gwt_rawstore_doctor.py | ENV = dict(GIT_NO_LAZY_FETCH='1', | ENV = dict( | doctor's own git processes never lazy-fetch
gwt_rawstore_doctor.py | if len(packs) > max_packs: | if False: | too many packs is a finding
gwt_rawstore_doctor.py | if len(packs) > max_packs: | if len(packs) >= max_packs: | exactly --max-packs packs is still fine
gwt_rawstore_doctor.py | if uncovered > MIDX_PACKS: | if False: | many packs with no multi-pack-index is a finding
gwt_rawstore_doctor.py | if recent > PROMISOR_PER_DAY: | if False: | many promisor packs written in the last day are a finding
gwt_rawstore_doctor.py | if recent > PROMISOR_PER_DAY: | if recent >= PROMISOR_PER_DAY: | exactly the daily limit is still fine
gwt_rawstore_doctor.py | if recent > PROMISOR_PER_DAY: | if recent > PROMISOR_PER_DAY or partial: | a quiet partial clone run from a plain shell is no finding
gwt_rawstore_doctor.py | recent += os.stat(os.path.join(packdir, n)).st_mtime > day_ago | recent += 1 | promisor packs older than a day do not count
gwt_rawstore_doctor.py | elif partial and not truthy(environ.get('GIT_NO_LAZY_FETCH')): | elif partial: | GIT_NO_LAZY_FETCH set in this shell turns the note to ok
gwt_rawstore_doctor.py | (v.lstrip('-').isdigit() and int(v) != 0) | False | a non-zero integer is true, as git reads it
gwt_rawstore_doctor.py | if binary_total > max_binary_gb * GB: | if False: | tracked binaries over --max-binary-gb are a finding
gwt_rawstore_doctor.py | continue   # outside a sparse checkout: never read it from the object store | size = 10 ** 6 | a binary not in the work tree is skipped, never read from git
gwt_rawstore_doctor.py |             if size > max_tmp_gb * GB: | if False: | a scratch folder over --max-tmp-gb is a finding
gwt_rawstore_doctor.py | caches[os.path.join(d, '.cache')] = '.cache folder' | pass | a .cache folder inside the work tree is a finding
gwt_rawstore_doctor.py | caches[p] = '$' + k | pass | a GWT_*_DIR cache pointed inside the work tree is a finding
gwt_rawstore_doctor.py | if v and (k in CACHE_VARS or | if v and k.endswith('_DIR') or ( | a committed GWT_LEDGER_DIR is no cache
gwt_rawstore_doctor.py | os.path.realpath(os.path.join(top, v))} | os.path.realpath(v)} | a relative cache variable is also read from the top of the repo
gwt_rawstore_doctor.py | if n > max_tmp_gb * GB: | if True: | a cache folder under --max-tmp-gb is no finding
gwt_rawstore_doctor.py | if n > max_tmp_gb * GB: | if False: | a cache folder over --max-tmp-gb is a finding
gwt_rawstore_doctor.py | if '[Excluded]' not in r.stdout: | if False: | a big folder Time Machine still backs up is a finding
gwt_rawstore_doctor.py | if platform != 'darwin': | if False: | Time Machine checks run on macOS only
gwt_rawstore_doctor.py | return 1 if rep['findings'] else 0 | return 0 | any finding exits 1
gwt_rawstore_doctor.py |         return 2 | return 0 | a folder that is not a work tree exits 2
gwt_rawstore_doctor.py | errors='surrogateescape', | errors='strict', | a tracked path that is not UTF-8 does not crash the run
gwt_rawstore_doctor.py | except Exception as e:   # a bug must not look like exit 1, "findings" | except ZeroDivisionError as e: | an unexpected error exits 2, never 1
gwt_rawstore_doctor.py | uncovered = max(0, len(packs) - (covered or 0)) | uncovered = 0 if covered is not None else len(packs) | packs added after the multi-pack-index was written count against it
gwt_rawstore_doctor.py | shlex.quote(f) for f, _ in biggest | f for f, _ in biggest | a folder name with a space stays one argument in the printed fix
gwt_rawstore_doctor.py | 'tmutil addexclusion %s' % shlex.quote(p) | 'tmutil addexclusion %s' % p | a backed-up path with a space stays one argument in the printed fix
gwt_rawstore_doctor.py | sized[os.path.join(top, folder)] = by_folder[folder][1] | pass | a big tracked-binary folder is checked for Time Machine too
gwt_rawstore_doctor.py | if partial and git_version(version) < GEOMETRIC_PROMISOR: | if False: | a partial clone on git older than 2.53 is told to upgrade before repacking
gwt_rawstore_doctor.py | out(shown('%-5s %s: %s' % (c['level'], c['check'], c['message']))) | out('%-5s %s: %s' % (c['level'], c['check'], c['message'])) | a non-UTF-8 name prints as U+FFFD, not a crash
gwt_rawstore_doctor.py | GIT_TERMINAL_PROMPT='0', GIT_OPTIONAL_LOCKS='0', | GIT_TERMINAL_PROMPT='1', GIT_OPTIONAL_LOCKS='1', | doctor's git never prompts and never takes optional locks
gwt_rawstore_doctor.py | if n[:-5] + '.promisor' in names: | if True: | only promisor packs count as lazy fetches
gwt_rawstore_doctor.py | partial = bool(config['extensions.partialclone'] or filters or promisor) | partial = bool(promisor) | a partial clone is known from its config
gwt_rawstore_doctor.py | if os.path.isdir(p) and not os.path.islink(p): | if os.path.isdir(p): | a scratch symlink pointing outside the repo is not walked
gwt_rawstore_doctor.py | except (FileNotFoundError, subprocess.TimeoutExpired) as e: | except ZeroDivisionError as e: | no tmutil is a skip, not a crash
gwt_rawstore_doctor.py | raise CannotRun('git is not installed') from None | raise | no git exits 2
gwt_rawstore_doctor.py | head[:4] == b'MIDX' | True | a file that is not a midx covers no pack
gwt_rawstore_doctor.py | if os.path.isdir(chain): | if False: | an incremental midx chain counts its packs
gwt_rawstore.py | m.add_argument('--evict', action='store_true' | m.add_argument('--evict-later', action='store_true' | gwt-rawstore migrate takes --evict from the command line
gwt_rawstore.py | if failures: | if False: | migrate --evict deletes and untracks nothing when an upload fails
gwt_rawstore.py | f.write(('\n' if text and not text.endswith('\n') else '') + | f.write('' + | a new ignore pattern never joins the last line of a .gitignore that has no final newline
gwt_rawstore.py | - set(text.splitlines())) | ) | a second migrate does not repeat an ignore pattern
gwt_rawstore.py | *(':(literal)' + n for n in | *(n for n in | migrate untracks a scan whose name git would read as a pathspec pattern or magic
gwt_rawstore.py | for i in range(0, len(names), GIT_BATCH): | for i in range(0, len(names), len(names)): | migrate passes names to git rm in batches, so a big folder stays under the argument limit
