mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
improve git get patch
This commit is contained in:
@@ -25,12 +25,14 @@ class SWEBenchSSHBox(DockerSSHBox):
|
||||
swe_instance: dict | None = None,
|
||||
skip_workspace_mount: bool = True,
|
||||
sandbox_plugins: list[PluginRequirement] = [], # noqa: B006
|
||||
workspace_dir_name: str | None = None,
|
||||
):
|
||||
if swe_instance_id is None:
|
||||
raise ValueError('swe_instance_id must be provided!')
|
||||
self.swe_instance_id = swe_instance_id
|
||||
self.swe_instance = swe_instance
|
||||
self.skip_workspace_mount = skip_workspace_mount
|
||||
self.workspace_dir_name = workspace_dir_name
|
||||
|
||||
assert (
|
||||
container_image is not None
|
||||
@@ -94,6 +96,7 @@ class SWEBenchSSHBox(DockerSSHBox):
|
||||
swe_instance=instance,
|
||||
skip_workspace_mount=skip_workspace_mount,
|
||||
sandbox_plugins=sandbox_plugins,
|
||||
workspace_dir_name=workspace_dir_name,
|
||||
)
|
||||
logger.info(f"SSH box started for instance {instance['instance_id']}.")
|
||||
|
||||
@@ -123,7 +126,13 @@ class SWEBenchSSHBox(DockerSSHBox):
|
||||
|
||||
def get_diff_patch(self):
|
||||
# add everything to the index
|
||||
exit_code, output = self.execute('git add --all')
|
||||
exit_code, output = self.execute(f'cd /workspace/{self.workspace_dir_name}')
|
||||
if exit_code != 0:
|
||||
logger.error('Failed to cd to the repo')
|
||||
return ''
|
||||
|
||||
# add everything to the index
|
||||
exit_code, output = self.execute('git add -A')
|
||||
if exit_code != 0:
|
||||
logger.error('Failed to add everything to the index')
|
||||
return ''
|
||||
|
||||
Reference in New Issue
Block a user