Skip to content

Commit

Permalink
Fix bug with autoupdating the stack_walker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jul 15, 2024
1 parent 164366e commit 016ecaf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions upstream_utils/upstream_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def get_repo_path(self, tempdir=None):
return dest

def open_repo(self, *, err_msg_if_absent):
os.chdir(tempfile.gettempdir()
os.chdir(tempfile.gettempdir())

dest = self.get_repo_path(os.getcwd())

Expand Down Expand Up @@ -365,19 +365,20 @@ def format_patch(self, tag=None):
err_msg_if_absent='There\'s nothing to run format-patch on. Run the "clone" and "rebase" commands first.'
)

start_commit = tag
if self.pre_patch_commits > 0:
commits_since_tag_output = subprocess.run(
["git", "log", "--format=format:%h", f"{tag}..HEAD"],
capture_output=True,
).stdout
commits_since_tag = commits_since_tag_output.count(b"\n") + 1
tag = f"HEAD~{commits_since_tag - self.pre_patch_commits}"
start_commit = f"HEAD~{commits_since_tag - self.pre_patch_commits}"

subprocess.run(
[
"git",
"format-patch",
f"{tag}..HEAD",
f"{start_commit}..HEAD",
"--abbrev=40",
"--zero-commit",
"--no-signature",
Expand Down

0 comments on commit 016ecaf

Please sign in to comment.