我在哪里可以找到有关 column.status 语法的信息?
Where can I find info about the syntax of column.status?
来自 Git documentation 关于 git status
命令:
--column[=< options>]
--no-column
Display untracked files in columns. See configuration variable column.status
for option syntax. --column
and --no-column
without options are equivalent to always and never respectively.
我看不到选项的语法,因为 git config column.status
returns 什么都没有。在哪里可以找到有关此语法的信息? git help status
命令显示相同的信息。
查看 git-config
的手册页,git config --help
或 man git-config
应该会给您手册页。这个选项说要查看 column.ui
描述,我在这里为您展示:
column.ui
Specify whether supported commands should output in columns.
This variable consists of a list of tokens separated by spaces or commas:
These options control when the feature should be enabled (defaults to never):
always
always show in columns
never
never show in columns
auto
show in columns if the output is to the terminal
These options control layout (defaults to column). Setting any of these implies always if none of always, never, or auto are specified.
column
fill columns before rows
row
fill rows before columns
plain
show in one column
Finally, these options can be combined with a layout option (defaults to nodense):
dense
make unequal size columns to utilize more space
nodense
make equal size columns
除了 --column
的语法之外,您还有一个已在 Git 2.18(2018 年第 2 季度)中修复的错误,并再次说明其语法。
代码没有将终端宽度传播到子进程
COLUMNS
环境变量,现在是这样。
当“git tag --column=row
”试图在非默认宽度的显示器上列出现有标签时,这给“git column
”辅助子进程带来了麻烦。
参见 commit b5d5a56 (11 May 2018) by Nguyễn Thái Ngọc Duy (pclouds
)。
参见 commit be11f7a (11 May 2018) by Jeff King (peff
)。
(由 Junio C Hamano -- gitster
-- in commit 05682ee 合并,2018 年 5 月 23 日)
column: fix off-by-one default width
By default we want to fill the whole screen if possible, but we do not
want to use up all terminal columns because the last character is
going hit the border, push the cursor over and wrap.
Keep it at default value zero, which will make print_columns() set the width at
term_columns() - 1.
pager: set COLUMNS to term_columns()
After we invoke the pager, our stdout
goes to a pipe, not the
terminal, meaning we can no longer use an ioctl
to get the
terminal width.
For that reason, ad6c373 (pager: find out the terminal width before spawning the pager, 2012-02-12, Git 1.7.9.2) started caching the terminal width.
But that cache is only an in-process variable.
Any programs we spawn will also not be able to run that ioctl, but won't
have access to our cache. They'll end up falling back to our
80-column default.
You can see the problem with:
git tag --column=row
Since git-tag
spawns a pager these days, its spawned
git-column
helper will see neither the terminal on stdout
nor a useful COLUMNS
value (assuming you do not export it
from your shell already).
And you'll end up with 80-column output in the pager, regardless of your terminal size.
We can fix this by setting COLUMNS
right before spawning the
pager. That fixes this case, as well as any more complicated
ones (e.g., a paged program spawns another script which then
generates columnized output).
“git column
"(man) 的“--nl
”选项的解析器已使用 Git 2.34(2021 年第 4 季度)更正。
参见 commit c93ca46 (18 Aug 2021) by SZEDER Gábor (szeder
)。
(由 Junio C Hamano -- gitster
-- in commit cfba196 合并,2021 年 9 月 8 日)
column
: fix parsing of the '--nl
' option
Signed-off-by: SZEDER Gábor
'git column
'(man)s '--nl
' option can be used to specify a "string to be printed at the end of each line" (quoting the man page), but this option and its mandatory argument has been parsed as OPT_INTEGER
since the introduction of the command in 7e29b82 ("Add column layout skeleton and git-column
", 2012-04-21, Git v1.7.11-rc0 -- merge listed in batch #9).
Consequently, any non-number argument is rejected by parse-options, and any number other than 0 leads to segfault:
$ printf "%s\n" one two |git column --mode=plain --nl=foo
error: option `nl' expects a numerical value
$ printf "%s\n" one two |git column --mode=plain --nl=42
Segmentation fault (core dumped)
$ printf "%s\n" one two |git column --mode=plain --nl=0
one
two
Parse this option as OPT_STRING
.
git column
现在包含在其 man page 中:
--nl=<string>
来自 Git documentation 关于 git status
命令:
--column[=< options>]
--no-column
Display untracked files in columns. See configuration variablecolumn.status
for option syntax.--column
and--no-column
without options are equivalent to always and never respectively.
我看不到选项的语法,因为 git config column.status
returns 什么都没有。在哪里可以找到有关此语法的信息? git help status
命令显示相同的信息。
查看 git-config
的手册页,git config --help
或 man git-config
应该会给您手册页。这个选项说要查看 column.ui
描述,我在这里为您展示:
column.ui
Specify whether supported commands should output in columns.
This variable consists of a list of tokens separated by spaces or commas:
These options control when the feature should be enabled (defaults to never):
always
always show in columns
never
never show in columns
auto
show in columns if the output is to the terminal
These options control layout (defaults to column). Setting any of these implies always if none of always, never, or auto are specified.
column
fill columns before rows
row
fill rows before columns
plain
show in one column
Finally, these options can be combined with a layout option (defaults to nodense):
dense
make unequal size columns to utilize more space
nodense
make equal size columns
除了 --column
的语法之外,您还有一个已在 Git 2.18(2018 年第 2 季度)中修复的错误,并再次说明其语法。
代码没有将终端宽度传播到子进程
COLUMNS
环境变量,现在是这样。
当“git tag --column=row
”试图在非默认宽度的显示器上列出现有标签时,这给“git column
”辅助子进程带来了麻烦。
参见 commit b5d5a56 (11 May 2018) by Nguyễn Thái Ngọc Duy (pclouds
)。
参见 commit be11f7a (11 May 2018) by Jeff King (peff
)。
(由 Junio C Hamano -- gitster
-- in commit 05682ee 合并,2018 年 5 月 23 日)
column: fix off-by-one default width
By default we want to fill the whole screen if possible, but we do not want to use up all terminal columns because the last character is going hit the border, push the cursor over and wrap.
Keep it at default value zero, which will make print_columns() set the width at term_columns() - 1.
pager: set COLUMNS to term_columns()
After we invoke the pager, our
stdout
goes to a pipe, not the terminal, meaning we can no longer use anioctl
to get the terminal width.
For that reason, ad6c373 (pager: find out the terminal width before spawning the pager, 2012-02-12, Git 1.7.9.2) started caching the terminal width.
But that cache is only an in-process variable.
Any programs we spawn will also not be able to run that ioctl, but won't have access to our cache. They'll end up falling back to our 80-column default.
You can see the problem with:
git tag --column=row
Since
git-tag
spawns a pager these days, its spawnedgit-column
helper will see neither the terminal on stdout nor a usefulCOLUMNS
value (assuming you do not export it from your shell already).
And you'll end up with 80-column output in the pager, regardless of your terminal size.
We can fix this by setting
COLUMNS
right before spawning the pager. That fixes this case, as well as any more complicated ones (e.g., a paged program spawns another script which then generates columnized output).
“git column
"(man) 的“--nl
”选项的解析器已使用 Git 2.34(2021 年第 4 季度)更正。
参见 commit c93ca46 (18 Aug 2021) by SZEDER Gábor (szeder
)。
(由 Junio C Hamano -- gitster
-- in commit cfba196 合并,2021 年 9 月 8 日)
column
: fix parsing of the '--nl
' optionSigned-off-by: SZEDER Gábor
'
git column
'(man)s '--nl
' option can be used to specify a "string to be printed at the end of each line" (quoting the man page), but this option and its mandatory argument has been parsed asOPT_INTEGER
since the introduction of the command in 7e29b82 ("Add column layout skeleton andgit-column
", 2012-04-21, Git v1.7.11-rc0 -- merge listed in batch #9).
Consequently, any non-number argument is rejected by parse-options, and any number other than 0 leads to segfault:$ printf "%s\n" one two |git column --mode=plain --nl=foo error: option `nl' expects a numerical value $ printf "%s\n" one two |git column --mode=plain --nl=42 Segmentation fault (core dumped) $ printf "%s\n" one two |git column --mode=plain --nl=0 one two
Parse this option as
OPT_STRING
.
git column
现在包含在其 man page 中:
--nl=<string>