Skip to content

Commit

Permalink
release: fix adding files before release
Browse files Browse the repository at this point in the history
when adding files on Windows, sometimes it was changing line-endings.
This was because GitPython doesn't respect autocrlf (unfortunately
this is a WONTFIX upstream, see gitpython-developers/GitPython#1441).

Workaround: use git directly
  • Loading branch information
suvayu committed Oct 11, 2023
1 parent efa25bd commit 29aa873
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions orchestra/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def prompt_add(repo: Repo) -> int:
for choice in map(int, comma_space_re.split(response)):
# trim 'a/path/to/file' or 'b/path/to/file' used by git
file_path = status[choice][3:].strip()
repo.index.add(file_path)
repo.git.add(file_path)
added += 1
return added

Expand Down Expand Up @@ -279,7 +279,7 @@ def create_tags(
prompt_add(repo)
modified = [i.a_path for i in repo.index.diff(None)]
if "pyproject.toml" in modified: # must add pyproject.toml
repo.index.add("pyproject.toml")
repo.git.add("pyproject.toml")
added = len([i for i in repo.index.diff("HEAD")])

if added > 0:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_preserve_line_endings(repo):
assert repo.index.diff(None) == [] # noop when autocrlf is 'true'
else:
assert repo.index.diff(None) # pyproject.toml rewritten w/ CRLF LE
repo.index.add("pyproject.toml")
repo.git.add("pyproject.toml")

# test
update_pkg_deps(repo, next_versions)
Expand Down

0 comments on commit 29aa873

Please sign in to comment.