dbt-labs / dbt-labs/dbt

Use `git tag --no-column` for listing tags for `dbt deps`

Open
#10,381 3 comments 0 reactions 0 assignees View on GitHub
deps engine:v1 help_wanted type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Housekeeping

- [X] I am a maintainer of dbt-core

### Short description

Use `git tag --no-column` instead of [`git tag --list`](https://github.com/dbt-labs/dbt-core/blob/c215697a02d7c452c64d4d66f7ba77cf6f2181b6/core/dbt/clients/git.py#L75) to prevent the issue described in https://github.com/dbt-labs/dbt-core/issues/10305

### Acceptance criteria

Use `git tag --no-column` instead of [`git tag --list`](https://github.com/dbt-labs/dbt-core/blob/c215697a02d7c452c64d4d66f7ba77cf6f2181b6/core/dbt/clients/git.py#L75).

### Suggested Tests

1. Current tests in CI.
2. Manual testing after changing the git configuration:
```shell
git config --local column.ui always
```

### Impact to Other Teams

Should not have impact to other teams

### Will backports be required?

No

### Context

As described in https://github.com/dbt-labs/dbt-core/issues/10305#issuecomment-2171943583, if a user updates their git client to always use columnar output like the following, it will break `dbt deps`:
```shell
git config --local column.ui always
```

So in order to make `dbt deps` more resilient, we could update [this](https://github.com/dbt-labs/dbt-core/blob/c215697a02d7c452c64d4d66f7ba77cf6f2181b6/core/dbt/clients/git.py#L75) to be:
```shell
out, err = run_cmd(cwd, ["git", "tag", "--no-column"], env={"LC_ALL": "C"})
```

The thing to be careful of is git clients that might not have the `--no-column` flag available.

It looks like `--no-column` was introduced in [v1.7.11](https://github.com/git/git/blob/daed0c68e94967bfbb3f87e15f7c9090dc1aa1e1/Documentation/RelNotes/1.7.11.txt#L16-L17) by https://github.com/git/git/commit/d96e3c150f2b4508f2e7d23ce9183d5b807c2155 around June 2012, so we might be okay there.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.