Skip to content

Commit 462b45a

Browse files
committed
fix: Replace other instances of do_commit
1 parent 566f4cf commit 462b45a

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

airflow_dbt_python/hooks/fs/git.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,10 @@ def _upload(
9393
if self.upload_filter(f) is False:
9494
continue
9595

96-
# Starting from dulwich version 1.0.0, stage is an attribute of WorkTree class
97-
try:
98-
repo.stage(str(f.relative_to(source)))
99-
except AttributeError:
100-
repo.get_worktree().stage(str(f.relative_to(source)))
96+
repo.get_worktree().stage(str(f.relative_to(source)))
10197

10298
ts = dt.datetime.now(dt.timezone.utc)
103-
repo.do_commit(
99+
repo.get_worktree().commit(
104100
self.commit_msg.format(ts=ts).encode(), self.commit_author.encode()
105101
)
106102

tests/hooks/test_git_hook.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ def repo(repo_dir, dbt_project_file, test_files, profiles_file, repo_branch):
331331

332332
repo.get_worktree().stage(f"{test_file.parent.name}/{test_file.name}")
333333

334-
repo.do_commit(b"Test first commit", committer=b"Test user <test@user.com>")
334+
repo.get_worktree().commit(
335+
b"Test first commit", committer=b"Test user <test@user.com>"
336+
)
335337

336338
yield repo
337339

0 commit comments

Comments
 (0)