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

Git tag error despite using hint #2785

Closed
1 task done
WildCard65 opened this issue Aug 11, 2020 · 7 comments · Fixed by git-for-windows/build-extra#302
Closed
1 task done

Git tag error despite using hint #2785

WildCard65 opened this issue Aug 11, 2020 · 7 comments · Fixed by git-for-windows/build-extra#302

Comments

@WildCard65
Copy link

WildCard65 commented Aug 11, 2020

  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
git version 2.28.0.windows.1
cpu: x86_64
built from commit: 77982caf269b7ee713a76da2bcf260c34d3bf7a7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
Microsoft Windows [Version 10.0.19041.423]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
Editor Option: VisualStudioCode
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

Windows OpenSSH preview V8.1.0.0p1

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

PowerShell 7

git tag -f 2.1.1 v2.1.1^{}

Note: This was provided by GIT itself as a hint

hint: You have created a nested tag. The object referred to by your new tag is
hint: already a tag. If you meant to tag the object that it points to, use:
hint:
hint:   git tag -f 2.1.1 v2.1.1^{}
hint: Disable this message with "git config advice.nestedTag false"
  • What did you expect to occur after running these commands?

Expected results

  • What actually happened instead?

error: switch `n' expects a numerical value

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

Unknown ATM.

@PhilipOakley
Copy link

That error message appears to be from static int context_callback in grep.c
Not sure why that's happening.

Does the tag already exist, or are your arguments in the reverse order? Ultimately, what were you trying to do?

@WildCard65
Copy link
Author

Tag 'v2.1.1' exists while '2.1.1' is the new name.

The command was provided by GIT itself, so if its the wrong order, blame GIT.

The expected results link answers your last one.

@dscho
Copy link
Member

dscho commented Aug 11, 2020

Try quoting v2.1.1^{}, like so:

git tag -f 2.1.1 "v2.1.1^{}"

@WildCard65
Copy link
Author

@dscho You're suggestion is correct, on the flip side, I needed to surround BOTH tag values in quotes:
git tag -f "2.1.1" "v2.1.1^{}"

@dscho
Copy link
Member

dscho commented Aug 12, 2020

Okay. In my tests, it was not necessary to quote the "2.1.1", but maybe I hold this thing wrong.

In any case, I think this is to be expected. Git cannot possibly guess that you're in a PowerShell instead of a POSIX shell (such as Bash), therefore it cannot really make sure that the command-line you are presented with uses PowerShell quoting rules.

So unless anybody here has any splendid ideas, I think we will need to close this ticket without having a better solution.

@WildCard65
Copy link
Author

How about a warning stating the hint is geared for a POSIX shell and that changes like quoting would be required.

@PhilipOakley
Copy link

Possibly c/should be part of our FAQ's (user editable) or the Known issues of the Release notes (PR against the BuildExtra repo that holds that bit.

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.

3 participants