Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions airflow_dbt_python/hooks/fs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def _upload(
if self.upload_filter(f) is False:
continue

repo.stage(str(f.relative_to(source)))
repo.get_worktree().stage([str(f.relative_to(source))])

ts = dt.datetime.now(dt.timezone.utc)
repo.do_commit(
repo.get_worktree().commit(
self.commit_msg.format(ts=ts).encode(), self.commit_author.encode()
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ gcs = [
]
git = [
"apache-airflow-providers-ssh>=3.0.0",
"dulwich>=0.24.3",
"dulwich>=1.0.0",
]
postgres = [
"dbt-postgres>=1.8.0,<2.0.0",
Expand Down
15 changes: 10 additions & 5 deletions tests/hooks/test_git_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,20 +317,23 @@ def repo_dir(tmp_path):
def repo(repo_dir, dbt_project_file, test_files, profiles_file, repo_branch):
"""Initialize a git repo with some dbt test files."""
repo = Repo.init(repo_dir, default_branch=repo_branch)

shutil.copyfile(dbt_project_file, repo_dir / "dbt_project.yml")
repo.stage("dbt_project.yml")
repo.get_worktree().stage("dbt_project.yml")

shutil.copyfile(profiles_file, repo_dir / "profiles.yml")
repo.stage("profiles.yml")
repo.get_worktree().stage("profiles.yml")

for test_file in test_files:
remote_subdir = repo_dir / test_file.parent.name
remote_subdir.mkdir(exist_ok=True)
shutil.copyfile(test_file, remote_subdir / test_file.name)

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

repo.do_commit(b"Test first commit", committer=b"Test user <test@user.com>")
repo.get_worktree().commit(
b"Test first commit", committer=b"Test user <test@user.com>"
)

yield repo

Expand All @@ -341,7 +344,7 @@ def repo(repo_dir, dbt_project_file, test_files, profiles_file, repo_branch):
def git_server(repo, repo_name):
"""A testing local TCP git server."""
backend = DictBackend({repo_name.encode(): repo})
dul_server = TCPGitServer(backend, b"localhost", 0)
dul_server = TCPGitServer(backend, "localhost", 0)

server_thread = threading.Thread(target=dul_server.serve)
server_thread.start()
Expand All @@ -351,6 +354,8 @@ def git_server(repo, repo_name):
yield server_address, server_port

dul_server.shutdown()
dul_server.server_close()

server_thread.join()


Expand Down
56 changes: 28 additions & 28 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.