Skip to content

Commit

Permalink
git-submit-pr: fix treefmt and branches without remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Jan 20, 2025
1 parent 7892ee7 commit cf88fe9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions home/bin/git-submit-pr
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ def tracked_remote() -> TrackedRemote:
check=True,
stdout=subprocess.PIPE,
).stdout.strip()
remote, branch = data.split("/", 1)
parts = data.split("/")
if len(parts) == 1: # FIXME: there got to be a better way to detect this.
remote = "origin"
branch = parts[0]
else:
remote, branch = parts
return TrackedRemote(remote, branch)
except subprocess.CalledProcessError as e:
msg = f"Error while running git command: {e}"
Expand Down Expand Up @@ -101,7 +106,7 @@ def run_treefmt(target: TrackedRemote) -> None:
stdout=subprocess.PIPE,
).stdout.strip()

has_treefmt = f"(val: val ? {current_system} && (val.{current_system}.name == \"treefmt\" || val.{current_system}.name == \"treefmt-nix\"))"
has_treefmt = f'(val: val ? {current_system} && (val.{current_system}.name == "treefmt" || val.{current_system}.name == "treefmt-nix"))'
result = subprocess.run(
["nix", "eval", ".#formatter", "--apply", has_treefmt],
stdout=subprocess.PIPE,
Expand Down

0 comments on commit cf88fe9

Please sign in to comment.