Skip to content

Commit

Permalink
fix: use git cli to obtain recipe commit sha, since there seems to be…
Browse files Browse the repository at this point in the history
… no fast and correct way to do that with gitpython (#892)
  • Loading branch information
johanneskoester authored May 22, 2023
1 parent ee3f725 commit a6fd713
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bioconda_utils/build_failure.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from typing import Optional, Union
from bioconda_utils.githandler import GitHandler
import subprocess as sp

from ruamel.yaml import YAML, CommentedMap
import conda.exports
Expand Down Expand Up @@ -39,10 +40,8 @@ def get_recipe_commit_sha(self):
if self.git_handler is None:
self.git_handler = GitHandler()
# Get last commit sha of recipe
commit = self.git_handler.repo.head.commit
tree = commit.tree
file_blob = tree[os.path.join(self.recipe_path, "meta.yaml")]
commit_sha = file_blob.binsha.hex()
filepath = os.path.join(self.recipe_path, "meta.yaml")
commit_sha = sp.run(["git", "rev-list", "-1", "HEAD", filepath], check=True, capture_output=True).stdout.decode().strip()
return commit_sha

def skiplists_current_recipe(self):
Expand Down

0 comments on commit a6fd713

Please sign in to comment.