Skip to content

Commit 3794ffc

Browse files
committed
precommit fixes
1 parent a226f18 commit 3794ffc

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

commit0/harness/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Files(TypedDict):
1515
eval_script: Dict[str, Path]
1616
patch: Dict[str, Path]
1717

18+
1819
BASE_BRANCH = "commit0"
1920

2021
# Constants - Evaluation Log Directories

commit0/harness/run_pytest_ids.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,24 @@ def main(
8282
)
8383
except Exception as e:
8484
raise e
85+
commit_id = ""
8586
if branch == "reference":
8687
commit_id = example["reference_commit"]
8788
else:
8889
# Check if it's a local branch
8990
if branch in local_repo.branches:
90-
commit_id = local_repo.commit(branch)
91+
commit_id = local_repo.commit(branch).hexsha
9192
else:
9293
found_remote_branch = False
9394
for remote in local_repo.remotes:
9495
remote.fetch() # Fetch latest updates from each remote
9596

9697
# Check if the branch exists in this remote
9798
for ref in remote.refs:
98-
if ref.remote_head == branch: # Compare branch name without remote prefix
99-
commit_id = local_repo.commit(ref.name)
99+
if (
100+
ref.remote_head == branch
101+
): # Compare branch name without remote prefix
102+
commit_id = local_repo.commit(ref.name).hexsha
100103
found_remote_branch = True
101104
break # Branch found, no need to keep checking this remote
102105
if found_remote_branch:

commit0/harness/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def main(
2929
continue
3030
clone_url = f"https://github.com/{example['repo']}.git"
3131
clone_dir = os.path.abspath(os.path.join(base_dir, repo_name))
32-
branch = dataset_name.split('/')[-1]
32+
branch = dataset_name.split("/")[-1]
3333
repo = clone_repo(clone_url, clone_dir, branch, logger)
3434
if BASE_BRANCH in repo.branches:
35-
repo.git.branch('-d', BASE_BRANCH)
36-
repo.git.checkout('-b', BASE_BRANCH)
35+
repo.git.branch("-d", BASE_BRANCH)
36+
repo.git.checkout("-b", BASE_BRANCH)
3737
logger.info("Checked out the base commit: commit 0")
3838

3939

0 commit comments

Comments
 (0)