Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #381 from openedx/iamsobanjaved/fix-deleted-file
Browse files Browse the repository at this point in the history
fix: remove file from git tree when delete
  • Loading branch information
iamsobanjaved authored Aug 31, 2023
2 parents 3197db4 + f443f1e commit 890a9c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions jenkins/github_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,12 @@ def update_list_of_files(self, repository, repo_root, file_path_list, commit_mes
input_trees_list = []
base_git_tree = repository.get_git_tree(sha)
for file_path in file_path_list:
content = self.get_file_contents(repo_root, file_path)
input_tree = InputGitTreeElement(file_path, "100644", "blob", content=content)
if os.path.exists(os.path.join(repo_root, file_path)):
content = self.get_file_contents(repo_root, file_path)
input_tree = InputGitTreeElement(file_path, "100644", "blob", content=content)
else:
# Remove file from git tree as the file is removed
input_tree = InputGitTreeElement(file_path, "100644", "blob", sha=None)
input_trees_list.append(input_tree)
if len(input_trees_list) > 0:
new_git_tree = repository.create_git_tree(input_trees_list, base_tree=base_git_tree)
Expand Down

0 comments on commit 890a9c4

Please sign in to comment.