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

gtg-min alias definition resolves tag permanently #43

Open
nathanperkins opened this issue Aug 17, 2024 · 1 comment · May be fixed by #44
Open

gtg-min alias definition resolves tag permanently #43

nathanperkins opened this issue Aug 17, 2024 · 1 comment · May be fixed by #44

Comments

@nathanperkins
Copy link

Using double-quotes to define the gtg-min alias causes the tag to be permanently resolved when defining the alias, rather than when the alias is called.

$ alias gtg-min="git tag -s -a $(git-semver -target minor)"
$ alias gtg-min
alias gtg-min='git tag -s -a 0.2.0'

Then, calling the alias multiple times uses the same tag and fails:

$ gtg-min
fatal: tag '0.2.0' already exists

Using single-quotes fixes the issue:

$ alias gtg-min='git tag -s -a $(git-semver -target minor)'
$ alias gtg-min
alias gtg-min='git tag -s -a $(git-semver -target minor)'

Seems like pretty standard bash behavior but in case the version is interesting:

$ bash --version
GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
nathanperkins added a commit to nathanperkins/git-semver that referenced this issue Aug 17, 2024
With the `gtg-min` alias, using double-quotes calls git-semver immediately and encodes the current tag permanently in the alias. Then, every time you call the alias, it uses the same tag and fails with `fatal: tag 'x.y.z' already exists`.

We change it to single quotes so that the subcommand is not resolved at definition and calling the alias will generate a new tag every time.

Fixes mdomke#43
@nathanperkins nathanperkins linked a pull request Aug 17, 2024 that will close this issue
@nathanperkins
Copy link
Author

Out for review: #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant