Skip to content

Commit

Permalink
Fix/branch option (#645)
Browse files Browse the repository at this point in the history
* fix/branch-option updating changelog, fix branch specification

* fix/branch-option updating changelog, fix branch specification

* fix/branch-option linting
  • Loading branch information
anabellabuckvar authored Feb 10, 2025
1 parent 14329fd commit 8b1f392
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fixed ability to specify branch for Netlaify

## [v0.18.13] - 2025-01-29

### Added

- Add ability to specify branch for Netlify

## [v0.18.12] - 2025-01-29

### Added
Expand Down
27 changes: 14 additions & 13 deletions snooty/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,16 +1751,20 @@ def __init__(
)

username = getpass.getuser()
try:
branch = subprocess.check_output(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
cwd=root,
encoding="utf-8",
stderr=subprocess.PIPE,
).strip()
except subprocess.CalledProcessError as err:
logger.info("git error getting branch name: %s", err.stderr)
branch = "current"

if custom_branch:
branch = custom_branch
else:
try:
branch = subprocess.check_output(
["git", "rev-parse", "--abbrev-ref", "HEAD"],
cwd=root,
encoding="utf-8",
stderr=subprocess.PIPE,
).strip()
except subprocess.CalledProcessError as err:
logger.info("git error getting branch name: %s", err.stderr)
branch = "current"

self.prefix = [self.config.name, username, branch]

Expand All @@ -1769,9 +1773,6 @@ def __init__(
self.config, self.targets.copy_clean_slate()
)

if custom_branch:
branch = custom_branch

self.asset_dg: "networkx.DiGraph[FileId]" = networkx.DiGraph()
self.backend.on_config(self.config, branch)

Expand Down

0 comments on commit 8b1f392

Please sign in to comment.