git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git show doesn't work on file names with square brackets

From
Kirill Likhodedov <kirill.likhodedov@jetbrains.com>
Date
Feb 6, 2016, 14:29 UTC
Message-ID
<25D155FA-6F05-425C-AB2D-7F0B44E0D1C5@jetbrains.com>
In-Reply-To
<alpine.DEB.2.20.1602061518220.2964@virtualbox>
Hi Johannes,
thanks for your answer, but unfortunately it doesn’t help.
Show 11 quoted lines
> On 06 Feb 2016, at 17:21 , Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> This is expected behavior of the Bash you are using. The commands that I
> think would reflect your intentions would be:
> 
> 	git init brackets
> 	cd brackets
> 	echo 'asd' > 'bra[ckets].txt'
> 	git add 'bra[ckets].txt'
> 	git commit -m initial
> 	git show 'HEAD:bra[ckets].txt’
Nope. This command sequence doesn’t work for me: the same error is returned:
    # git show 'HEAD:bra[ckets].txt'
    fatal: ambiguous argument 'HEAD:bra[ckets].txt': both revision and filename
> You could also escape the brackets with a backslash, as you did, but you
> would have to do it *every* time you write the path, not just in the `git
> add` incantation.
As I mentioned at the end of my original message, escaping doesn't help either. `git add` works fine both with and without escape. It was auto-completed by bash completion, and I just forgot to remove the backslashes before pasting the code here. At any case, escaping doesn’t work with `git show`.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 27 in “git show doesn't work on file names with square brackets”
  1. Kirill LikhodedovFeb 6, 2016
  2. Johannes SchindelinFeb 6, 2016
  3. Kirill LikhodedovFeb 6, 2016
  4. Johannes SchindelinFeb 6, 2016
  5. Duy NguyenFeb 6, 2016
  6. Kirill LikhodedovFeb 7, 2016
  7. Duy NguyenFeb 8, 2016
  8. Jeff KingFeb 8, 2016
  9. Jeff KingFeb 8, 2016
  10. Jeff KingFeb 8, 2016
  11. Junio C HamanoFeb 8, 2016
  12. Jeff KingFeb 8, 2016
  13. Jeff KingFeb 8, 2016
  14. Jeff KingFeb 8, 2016
  15. Junio C HamanoFeb 8, 2016
  16. Jeff KingFeb 10, 2016
  17. Junio C HamanoFeb 9, 2016
  18. Jeff KingFeb 10, 2016
  19. Junio C HamanoFeb 10, 2016
  20. Jeff KingFeb 10, 2016
  21. 1/3 checkout: reorder check_filename conditionalJeff King, Feb 10, 2016
  22. Junio C HamanoFeb 10, 2016
  23. 2/3 check_filename: tighten dwim-wildcard ambiguityJeff King, Feb 10, 2016
  24. 3/3 get_sha1: don't die() on bogus search stringsJeff King, Feb 10, 2016
  25. Junio C HamanoFeb 10, 2016
  26. Kirill LikhodedovFeb 7, 2016
  27. Johannes SchindelinFeb 7, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.