Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
tools: force core.autocrlf=false so Windows engine sync keeps LF
LNPANDYb73b14651d3d
diff --git a/tools/engine.py b/tools/engine.pyindex a053ce10..3f07c6e8 100755--- a/tools/engine.py+++ b/tools/engine.py@@ -191,9 +191,11 @@ def fetch(eng, sha, url=None):def ensure_repo(eng):- if is_repo(eng): return+ if is_repo(eng):+ git('config', 'core.autocrlf', 'false', cwd=eng)+ returnif eng.exists() and any(eng.iterdir()):- if not any(f.is_file() for _, _, fs in os.walk(eng) for f in fs):+ if not any(f.is_file() for f in eng.rglob('*')):# An empty tree is the leftover of a failed first sync: on Windows the engine sync# needs git, and the failure hit right after this folder was made, so every retry# then stopped here forever ("move it away"). Start over instead of asking.@@ -203,6 +205,7 @@ def ensure_repo(eng):eng.mkdir(parents=True, exist_ok=True)git('init', '--quiet', cwd=eng)git('config', 'advice.detachedHead', 'false', cwd=eng)+ git('config', 'core.autocrlf', 'false', cwd=eng)git('remote', 'add', 'seedds', UPSTREAM_URL, cwd=eng, check=False) # for `git fetch seedds` and pull requests upstreamdiff --git a/tools/patches.py b/tools/patches.pyindex 7851e930..391e086c 100644--- a/tools/patches.py+++ b/tools/patches.py@@ -48,7 +48,7 @@ def clean_env(**extra):def git(*a, cwd=None, check=True, inp=None, binary=False):- r = subprocess.run(['git', *a], cwd=cwd or REPO, input=inp, capture_output=True, text=not binary, env=clean_env())+ r = subprocess.run(['git', '-c', 'core.autocrlf=false', *a], cwd=cwd or REPO, input=inp, capture_output=True, text=not binary, env=clean_env())if check and r.returncode:raise Fail(f'git {" ".join(a)} failed: {(r.stderr if not binary else r.stderr.decode(errors="replace")).strip()[-1500:]}')return rdiff --git a/tools/tests/test_engine.py b/tools/tests/test_engine.pyindex f830d224..139d7ab1 100644--- a/tools/tests/test_engine.py+++ b/tools/tests/test_engine.py@@ -97,6 +97,14 @@ class Sync(Fixture):self.assertEqual(git(self.eng, 'rev-parse', '--abbrev-ref', 'HEAD'), 'nx2apple')self.assertEqual(git(self.eng, 'status', '--porcelain'), '')+ def test_sync_succeeds_when_global_autocrlf_is_true(self):+ # Windows sets core.autocrlf=true globally; checkout must not write CRLF and make `git am -3` fail on local changes+ env = dict(self.env, GIT_CONFIG_COUNT='1', GIT_CONFIG_KEY_0='core.autocrlf', GIT_CONFIG_VALUE_0='true')+ out = self.tool('sync', env=env)+ self.assertIn('ready, 1 patches', out)+ self.assertEqual(git(self.eng, 'config', '--local', '--get', 'core.autocrlf'), 'false')+ self.assertNotIn(b'\r\n', (self.eng / 'dm/a.c').read_bytes())+def test_a_second_sync_is_a_no_op_and_quiet_prints_nothing(self):self.tool('sync')before = git(self.eng, 'rev-parse', 'HEAD')