Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified git tag option in dbt deps #10398

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .changes/unreleased/Fixes-20240721-001703.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Fixes
body: modified tag option in git
time: 2024-07-21T00:17:03.907658+09:00
custom:
Author: jx2lee
Issue: "10381"
2 changes: 1 addition & 1 deletion core/dbt/clients/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def clone(repo, cwd, dirname=None, remove_git_dir=False, revision=None, subdirec


def list_tags(cwd):
out, err = run_cmd(cwd, ["git", "tag", "--list"], env={"LC_ALL": "C"})
out, err = run_cmd(cwd, ["git", "tag", "--no-column"], env={"LC_ALL": "C"})
tags = out.decode("utf-8").strip().split("\n")
return tags

Expand Down
19 changes: 19 additions & 0 deletions tests/unit/clients/test_git.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import unittest
from unittest.mock import MagicMock, patch

from dbt.clients.git import list_tags


class Git(unittest.TestCase):
@patch("dbt_common.clients.system.run_cmd")
@patch("subprocess.Popen")
def test_list_tags(self, mock_popen, mock_run_cmd):
mock_process = MagicMock()
mock_process.returncode = 0
mock_process.communicate.return_value = (b"v1.0.0\nv1.1.0\nv2.0.0\n", b"")
mock_popen.return_value = mock_process

cwd = "/path/to/repo"
tags = list_tags(cwd)

self.assertEqual(tags, ["v1.0.0", "v1.1.0", "v2.0.0"])
Loading