Revert "fix `is_dirty` when switching branch with `updated` (#36162)"

This reverts commit 30c388aea8.
pull/36187/head
Maxime Desroches 5 days ago
parent b6e0d4807a
commit 61d5a50534
  1. 2
      system/updated/updated.py
  2. 7
      system/version.py

@ -113,7 +113,6 @@ def setup_git_options(cwd: str) -> None:
("protocol.version", "2"), ("protocol.version", "2"),
("gc.auto", "0"), ("gc.auto", "0"),
("gc.autoDetach", "false"), ("gc.autoDetach", "false"),
("remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*"),
] ]
for option, value in git_cfg: for option, value in git_cfg:
run(["git", "config", option, value], cwd) run(["git", "config", option, value], cwd)
@ -390,7 +389,6 @@ class Updater:
cloudlog.info("git reset in progress") cloudlog.info("git reset in progress")
cmds = [ cmds = [
["git", "checkout", "--force", "--no-recurse-submodules", "-B", branch, "FETCH_HEAD"], ["git", "checkout", "--force", "--no-recurse-submodules", "-B", branch, "FETCH_HEAD"],
["git", "branch", "--set-upstream-to", f"origin/{branch}"],
["git", "reset", "--hard"], ["git", "reset", "--hard"],
["git", "clean", "-xdff"], ["git", "clean", "-xdff"],
["git", "submodule", "sync"], ["git", "submodule", "sync"],

@ -37,7 +37,9 @@ def is_prebuilt(path: str = BASEDIR) -> bool:
@cache @cache
def is_dirty(cwd: str = BASEDIR) -> bool: def is_dirty(cwd: str = BASEDIR) -> bool:
if not get_origin() or not get_short_branch(): origin = get_origin()
branch = get_branch()
if not origin or not branch:
return True return True
dirty = False dirty = False
@ -50,9 +52,6 @@ def is_dirty(cwd: str = BASEDIR) -> bool:
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
pass pass
branch = get_branch()
if not branch:
return True
dirty = (subprocess.call(["git", "diff-index", "--quiet", branch, "--"], cwd=cwd)) != 0 dirty = (subprocess.call(["git", "diff-index", "--quiet", branch, "--"], cwd=cwd)) != 0
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
cloudlog.exception("git subprocess failed while checking dirty") cloudlog.exception("git subprocess failed while checking dirty")

Loading…
Cancel
Save