fix(local-agent): 🐛 Add -- flag to safely unstage changes on unborn branches during git reset
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
ac86138c14
commit
a905acc83d
1 changed files with 6 additions and 2 deletions
|
|
@ -302,7 +302,9 @@ class LocalCommitAgent:
|
|||
|
||||
if not message:
|
||||
logger.warning(f"Empty message for {repo_name}, skipping")
|
||||
_git(repo_path, "reset", "HEAD")
|
||||
# Unstage path-by-path — safe on unborn branches (no initial commit)
|
||||
# where `git reset HEAD` fails because HEAD is unresolved.
|
||||
_git(repo_path, "reset", "--", *allowed)
|
||||
return False
|
||||
|
||||
# Dry-run gate — log intent, unstage, do not commit or push
|
||||
|
|
@ -311,7 +313,9 @@ class LocalCommitAgent:
|
|||
f"[DRY-RUN] {repo_name} ({branch}) would commit {len(allowed)} file(s) "
|
||||
f"with message: {message.splitlines()[0] if message else '(empty)'}"
|
||||
)
|
||||
_git(repo_path, "reset", "HEAD")
|
||||
# Unstage path-by-path — safe on unborn branches (no initial commit)
|
||||
# where `git reset HEAD` fails because HEAD is unresolved.
|
||||
_git(repo_path, "reset", "--", *allowed)
|
||||
return False
|
||||
|
||||
# Commit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue