Merge branch 'sg/column-nl' into maint

The parser for the "--nl" option of "git column" has been
corrected.

* sg/column-nl:
  column: fix parsing of the '--nl' option
This commit is contained in:
Junio C Hamano 2021-10-12 13:51:41 -07:00
commit 69247e283c
3 changed files with 20 additions and 2 deletions

View File

@ -39,7 +39,7 @@ OPTIONS
--indent=<string>::
String to be printed at the beginning of each line.
--nl=<N>::
--nl=<string>::
String to be printed at the end of each line,
including newline character.

View File

@ -29,7 +29,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
OPT_INTEGER(0, "raw-mode", &colopts, N_("layout to use")),
OPT_INTEGER(0, "width", &copts.width, N_("maximum width")),
OPT_STRING(0, "indent", &copts.indent, N_("string"), N_("padding space on left border")),
OPT_INTEGER(0, "nl", &copts.nl, N_("padding space on right border")),
OPT_STRING(0, "nl", &copts.nl, N_("string"), N_("padding space on right border")),
OPT_INTEGER(0, "padding", &copts.padding, N_("padding space between columns")),
OPT_END()
};

View File

@ -42,6 +42,24 @@ EOF
test_cmp expected actual
'
test_expect_success '--nl' '
cat >expected <<\EOF &&
oneZ
twoZ
threeZ
fourZ
fiveZ
sixZ
sevenZ
eightZ
nineZ
tenZ
elevenZ
EOF
git column --nl="Z$LF" --mode=plain <lista >actual &&
test_cmp expected actual
'
test_expect_success '80 columns' '
cat >expected <<\EOF &&
one two three four five six seven eight nine ten eleven