From 841e8799332e45b47256bea68793c9903b996ea7 Mon Sep 17 00:00:00 2001 From: Yuqi WANG Date: Fri, 7 Jun 2024 18:00:13 +0800 Subject: [PATCH 1/2] fix format --- helpers/GitHelper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/helpers/GitHelper.py b/helpers/GitHelper.py index 2b67ddf..8d99df7 100644 --- a/helpers/GitHelper.py +++ b/helpers/GitHelper.py @@ -3,6 +3,7 @@ from git import Repo + class GitHelper(object): """ Helper class for GIT @@ -42,9 +43,9 @@ def push_changes_in_pull_request(self, repository, message, target_branch, head_ r.git.execute(['git', 'config', '--global', '--add', 'safe.directory', clone_path]) r.git.execute(['git', 'checkout', '-b', target_branch]) files_to_add = r.git.execute( - ['git', 'ls-files', '--others', '--exclude-standard', 'grep', '\\.java', '|', 'grep', 'src/test']) + ['git', 'ls-files', '--others', '--exclude-standard', 'grep', '\\\.java', '|', 'grep', 'src/test']) r.git.execute(['git', 'add', files_to_add]) r.git.commit('-am', message) r.git.push('origin', target_branch) - self.create_pull_request(repository, message, '', target_branch, head_branch, token) \ No newline at end of file + self.create_pull_request(repository, message, '', target_branch, head_branch, token) From 845dd605119723f6ce03bb6e92435577cfe4f9c0 Mon Sep 17 00:00:00 2001 From: Yuqi WANG Date: Fri, 7 Jun 2024 20:13:07 +0800 Subject: [PATCH 2/2] final fix --- helpers/GitHelper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helpers/GitHelper.py b/helpers/GitHelper.py index 8d99df7..0bbb8f1 100644 --- a/helpers/GitHelper.py +++ b/helpers/GitHelper.py @@ -43,8 +43,10 @@ def push_changes_in_pull_request(self, repository, message, target_branch, head_ r.git.execute(['git', 'config', '--global', '--add', 'safe.directory', clone_path]) r.git.execute(['git', 'checkout', '-b', target_branch]) files_to_add = r.git.execute( - ['git', 'ls-files', '--others', '--exclude-standard', 'grep', '\\\.java', '|', 'grep', 'src/test']) - r.git.execute(['git', 'add', files_to_add]) + ['git', 'ls-files', '--others', '--exclude-standard', 'grep', '\\.java', '|', 'grep', 'src/test']) + files_to_add = files_to_add.split("\n") + for file in files_to_add: + r.git.execute(['git', 'add', file]) r.git.commit('-am', message) r.git.push('origin', target_branch)