mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: use get_hermes_home(), consolidate git_cmd, update tests
Follow-up for salvaged PR #2352: - Replace hardcoded Path(os.getenv('HERMES_HOME', ...)) with get_hermes_home() from hermes_constants (2 places) - Consolidate redundant git_cmd_base into the existing git_cmd variable, constructed once before fork detection - Update autostash tests for the unmerged index check added in the previous commit
This commit is contained in:
parent
6b0022bb7b
commit
67ae7a79df
2 changed files with 16 additions and 13 deletions
|
|
@ -2942,15 +2942,15 @@ def _count_commits_between(git_cmd: list[str], cwd: Path, base: str, head: str)
|
|||
|
||||
def _should_skip_upstream_prompt() -> bool:
|
||||
"""Check if user previously declined to add upstream."""
|
||||
hermes_home = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes"))
|
||||
return (hermes_home / SKIP_UPSTREAM_PROMPT_FILE).exists()
|
||||
from hermes_constants import get_hermes_home
|
||||
return (get_hermes_home() / SKIP_UPSTREAM_PROMPT_FILE).exists()
|
||||
|
||||
|
||||
def _mark_skip_upstream_prompt():
|
||||
"""Create marker file to skip future upstream prompts."""
|
||||
try:
|
||||
hermes_home = Path(os.getenv("HERMES_HOME", Path.home() / ".hermes"))
|
||||
(hermes_home / SKIP_UPSTREAM_PROMPT_FILE).touch()
|
||||
from hermes_constants import get_hermes_home
|
||||
(get_hermes_home() / SKIP_UPSTREAM_PROMPT_FILE).touch()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
@ -3210,12 +3210,13 @@ def cmd_update(args):
|
|||
cwd=PROJECT_ROOT, check=False, capture_output=True
|
||||
)
|
||||
|
||||
# Detect if we're updating from a fork (before any branch logic)
|
||||
git_cmd_base = ["git"]
|
||||
# Build git command once — reused for fork detection and the update itself.
|
||||
git_cmd = ["git"]
|
||||
if sys.platform == "win32":
|
||||
git_cmd_base = ["git", "-c", "windows.appendAtomically=false"]
|
||||
git_cmd = ["git", "-c", "windows.appendAtomically=false"]
|
||||
|
||||
origin_url = _get_origin_url(git_cmd_base, PROJECT_ROOT)
|
||||
# Detect if we're updating from a fork (before any branch logic)
|
||||
origin_url = _get_origin_url(git_cmd, PROJECT_ROOT)
|
||||
is_fork = _is_fork(origin_url)
|
||||
|
||||
if is_fork:
|
||||
|
|
@ -3230,9 +3231,6 @@ def cmd_update(args):
|
|||
|
||||
# Fetch and pull
|
||||
try:
|
||||
git_cmd = ["git"]
|
||||
if sys.platform == "win32":
|
||||
git_cmd = ["git", "-c", "windows.appendAtomically=false"]
|
||||
|
||||
print("→ Fetching updates...")
|
||||
fetch_result = subprocess.run(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue