holygeek / git-number

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

error: unknown option `column=never' #21

Open TechplexEngineer opened 10 years ago

TechplexEngineer commented 10 years ago

The error is:

$ git-number
error: unknown option `column=never'
usage: git status [options] [--] <filepattern>...

    -v, --verbose         be verbose
    -s, --short           show status concisely
    -b, --branch          show branch information
    --porcelain           machine-readable output
    -z, --null            terminate entries with NUL
    -u, --untracked-files[=<mode>]
                          show untracked files, optional modes: all, normal, no. (Default: all)
    --ignored             show ignored files
    --ignore-submodules[=<when>]
                          ignore changes to submodules, optional when: all, dirty, untracked. (Default: all)

Resolution is commenting out these lines: https://github.com/holygeek/git-number/blob/master/git-id#L86-L88

# if (! $untracked_in_columns) {
#     $status_opt .= " --column=never";
# }

Here is my git version:

$ git --version
git version 1.7.9
holygeek commented 10 years ago

Thanks for reporting this. I'll look into it later.

nicolashohm commented 9 years ago

same problem here. My git version: git version 1.7.10.4. @holygeek's patch works for me

meierjan commented 9 years ago

+1 for git version 1.7.2.5 on ubuntu linux

holygeek commented 9 years ago

The problem here is that somewhere between git 1.7 and the more recent git, they introduced the the --column switch to git status; and git status behavior was changed in such a way that untracked files are shown in columns by default.

If untracked files are shown in columns (as they are by default in the more recent git), git number would not be able to process file names that have spaces in them - the space-separated-chunks in the file name would be wrongly assigned with different ids, hence the need for the --column=never switch.

Omitting the --column=never option as suggested by @TechplexEngineer in the first comment to work around the lack of this option in the older git version works fine. Once your git is upgraded to the version that shows untracked files in columns then git number would fail to assign numbers to untracked files.

We could make git number be aware of this issue via environment variable, or yet another command line switch but I'm not sure if it is worth it - we can just point people who faces this problem to this issue and they can use the suggested workaround.

This is the price git number is paying for parsing a git porcelain command :)