holygeek / git-number

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

git number breaks 'git add' #28

Closed KES777 closed 8 years ago

KES777 commented 8 years ago

If you add to .gitconfig

[color "status"]
    untracked = red bold

you will not able to add files

$ gn
On branch feature/login_form
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

1   modified:   XXXX

Untracked files:
  (use "git add <file>..." to include in what will be committed)

2   file.txt

no changes added to commit (use "git add" and/or "git commit -a")
$ ga 2
git add "file.txt"
fatal: pathspec 'file.txt' did not match any files
$ 

After git add " starting at file.txt" text is red. It seems git number put ESC sequence into the command

For consistency:

alias gn='git-number'
alias ga='gn add'
holygeek commented 8 years ago

Yup, I can reproduce the issue. Thanks for reporting this.

holygeek commented 8 years ago

This issue should be fixed by this commit: https://github.com/holygeek/git-number/commit/d8967d748d89a4d60b961085ea3795bed4adab7a

ga should now work.

However your "bold red" setting for the untracked files is not honored by git-number if the untracked files are set to be shown in column (which is the default is recent git versions) - only files in the first column listed in the columnar list will be shown in bold red, while the one in the subsequent columns are shown in plain red. This is because the git-id script uses the hardcoded red (non bold) color when showing the untracked files in columnar listing.

Seeing that you have set the configuration color.status.untracked "bold red", I assume that you would like git number to also use this color for showing the untracked files when they are shown in columns, which you can do by modifying the hardcoded plain red in git-id to something like \e[1;31m.

KES777 commented 8 years ago

Maybe it will be better the git-id use git config command to get color? I have not eager to dig sources git-id In any case thank you for fix. +1