Evita manutenzione automatica Git durante aggiornamento Windows
This commit is contained in:
@@ -45,12 +45,15 @@ class DeployBatTests(unittest.TestCase):
|
||||
|
||||
def run_script(self, confirmation="S"):
|
||||
env = os.environ.copy()
|
||||
env.update(TEMP=str(self.base), TMP=str(self.base), PIP_NO_INDEX="1", PIP_DISABLE_PIP_VERSION_CHECK="1")
|
||||
env.update(TEMP=str(self.base), TMP=str(self.base), PIP_NO_INDEX="1", PIP_DISABLE_PIP_VERSION_CHECK="1",
|
||||
GIT_TRACE2_EVENT=str(self.base / "git-trace.jsonl"))
|
||||
command = f'""{self.script}" "{self.deploy}" "{sys.executable}""'
|
||||
return subprocess.run("cmd.exe /d /s /c " + command,
|
||||
input=confirmation + "\n\n", text=True, capture_output=True, env=env, timeout=60)
|
||||
|
||||
def test_success_preserves_config_and_saves_previous_commit(self):
|
||||
self.git("config", "maintenance.auto", "true", cwd=self.deploy)
|
||||
self.git("config", "gc.auto", "1", cwd=self.deploy)
|
||||
result = self.run_script()
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertIn("AGGIORNAMENTO COMPLETATO", result.stdout)
|
||||
@@ -58,6 +61,12 @@ class DeployBatTests(unittest.TestCase):
|
||||
self.assertEqual((self.deploy / "db_connection.json").read_text(), "LOCAL CONFIG")
|
||||
refs = self.git("for-each-ref", "--format=%(objectname)", "refs/warehouse-backups/", cwd=self.deploy)
|
||||
self.assertIn(self.before, refs)
|
||||
import json
|
||||
trace = [json.loads(line) for line in (self.base / "git-trace.jsonl").read_text(encoding="utf-8").splitlines()]
|
||||
children = [event.get("argv", []) for event in trace if event.get("event") == "child_start"]
|
||||
self.assertFalse(any("maintenance" in args or "gc" in args for args in children), children)
|
||||
self.assertEqual(self.git("config", "maintenance.auto", cwd=self.deploy).strip(), "true")
|
||||
self.assertEqual(self.git("config", "gc.auto", cwd=self.deploy).strip(), "1")
|
||||
|
||||
def test_dirty_checkout_is_not_overwritten(self):
|
||||
(self.deploy / "sample.txt").write_text("local", encoding="ascii")
|
||||
|
||||
Reference in New Issue
Block a user