Skip to content

Commit

Permalink
chore: remove some unecessary loggings in check_out_repo_target
Browse files Browse the repository at this point in the history
Signed-off-by: Trong Nhan Mai <[email protected]>
  • Loading branch information
tromai committed Nov 7, 2023
1 parent 94f490d commit 28144e7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/macaron/slsa_analyzer/git_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def check_out_repo_target(git_obj: Git, branch_name: str = "", digest: str = "",
# Switch to the target branch by running ``git checkout <branch_name>`` in the target repository.
# We need to use force checkout to prevent issues similar to https://github.com/oracle/macaron/issues/530.
git_obj.repo.git.checkout("--force", res_branch)
except GitCommandError as error:
logger.error("Cannot checkout branch %s. Error: %s", res_branch, error)
except GitCommandError:
logger.error("Cannot checkout branch %s.", res_branch)
return False

logger.info("Successfully checkout branch %s.", res_branch)
Expand All @@ -120,20 +120,19 @@ def check_out_repo_target(git_obj: Git, branch_name: str = "", digest: str = "",
try:
# Pull the latest changes on the current branch fast-forward only.
git_obj.repo.git.pull("--ff-only")
except GitCommandError as error:
logger.error(error)
except GitCommandError:
logger.error("Cannot pull the latest changes.")
return False

if digest:
# Checkout the specific commit that the user want by running ``git checkout <commit>`` in the target repository.
# We need to use force checkout to prevent issues similar to https://github.com/oracle/macaron/issues/530.
try:
git_obj.repo.git.checkout("--force", digest)
except GitCommandError as error:
except GitCommandError:
logger.error(
"Commit %s cannot be checked out. Error: %s",
"Commit %s cannot be checked out.",
digest,
error,
)
return False

Expand Down

0 comments on commit 28144e7

Please sign in to comment.