holygeek / git-number

Use numbers for dealing with files in git
ISC License
281 stars 25 forks source link

Quote Issue #48

Open TechplexEngineer opened 11 months ago

TechplexEngineer commented 11 months ago

If you have a crazy file name with bash variable sequences:

Product-${productVersion} Docker (Build ${buildDate}.${buildNumber}).tar

and it shows in git status like this:

Untracked files:
  (use "git add <file>..." to include in what will be committed)
1   Product-${productVersion} Docker (Build ${buildDate}.${buildNumber}).tar

And you try to remove it with:

git number -c rm 1

The generated command uses double quotes for the filename. Using single quotes would resolve the issue

Generated Command

git number -c rm "Product-\${productVersion} Docker (Build \${buildDate}.\${buildNumber}).tar"
holygeek commented 3 months ago

There's no easy way to deal with crazy filenames. With that said, this particular filename appear to work fine when I tried it:

$ git number
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
1       Product-${productVersion} Docker (Build ${buildDate}.${buildNumber}).tar

nothing added to commit but untracked files present (use "git add" to track)
$ git number -c rm 1
rm "Product-\${productVersion} Docker (Build \${buildDate}.\${buildNumber}).tar"
$ git number
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)