8

来自有关命令的Git 文档:git status

--column[=<选项>]
--no-column
在列中显示未跟踪的文件。有关选项语法,请参见配置变量column.status--column--no-column 没有选项分别相当于总是从不

我看不到选项的语法,因为git config column.status没有返回任何内容。在哪里可以找到有关此语法的信息?该git help status命令显示相同的信息。

4

2 回答 2

5

查看 的手册页git-configgit 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
于 2015-09-14T12:30:30.533 回答
0

除了 的语法之外--column,您还有一个已在 Git 2.18(2018 年第二季度)中修复的错误,并再次说明其语法。

该代码没有通过 COLUMNS环境变量将终端宽度传播到子进程,现在它会这样做。当“ ”试图以非默认宽度在显示器上列出现有标签时,这给“ ”辅助子进程
带来了麻烦。git columngit tag --column=row

请参阅Nguyễn Thái Ngọc Duy ( ) 的提交 b5d5a56(2018 年 5 月 11 日。 请参阅Jeff King ( ) 的提交 be11f7a(2018 年 5 月 11 日(由Junio C Hamano 合并 -- --提交 05682ee中,2018 年 5 月 23 日)pclouds
peff
gitster

列:修复一个默认宽度

默认情况下,如果可能,我们希望填满整个屏幕,但我们不想用完所有终端列,因为最后一个字符会碰到边框,将光标推到上面并换行。
保持默认值为零,这将使 print_columns() 将宽度设置为 term_columns() - 1。

寻呼机:将 COLUMNS 设置为 term_columns()

调用寻呼机后,我们stdout转到管道,而不是终端,这意味着我们不能再使用 anioctl来获取终端宽度。
出于这个原因,ad6c373(寻呼机:在产生寻呼机之前找出终端宽度,2012-02-12,Git 1.7.9.2)开始缓存终端宽度。

但是该缓存只是一个进程内变量。
我们生成的任何程序也将无法运行该 ioctl,但无法访问我们的缓存。他们最终会退回到我们默认的 80 列。

您可以通过以下方式查看问题:

git tag --column=row

由于git-tag这些天产生了一个寻呼机,它产生的 git-column助手既不会在标准输出上看到终端,也不会看到有用的COLUMNS值(假设您还没有从 shell 中导出它)。
无论您的终端大小如何,您最终都会在寻呼机中输出 80 列。

我们可以通过COLUMNS在产生寻呼机之前进行设置来解决这个问题。这解决了这种情况,以及任何更复杂的情况(例如,分页程序生成另一个脚本,然后生成列输出)。


" " ( man )--nl的 " " 选项的解析器已在 Git 2.34 (Q4 2021) 中更正。git column

请参阅SZEDER Gábor ( )提交的 c93ca46(2021 年 8 月 18 日) 。(由Junio C Hamano 合并 -- --cfba196 提交中,2021 年 9 月 8 日)szeder
gitster

column--nl: 修复 ' ' 选项的解析

签字人:SZEDER Gábor

' git column' ( man ) s ' --nl' 选项可用于指定“要在每行末尾打印的字符串”(引用手册页),但是OPT_INTEGER自从引入7e29b82中的命令(“添加列布局骨架和git-column”,2012-04-21,Git v1.7.11-rc0 --合并在批次 #9中列出)。
因此,任何非数字参数都会被 parse-options 拒绝,并且任何非 0 的数字都会导致段错误:

$ 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

将此选项解析为OPT_STRING.

git column现在在其手册页中包含:

--nl=<string>

于 2018-05-23T20:13:38.037 回答