diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-09-08 23:30:34 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-08 23:30:34 +0300 |
commit | cfba19618f61d8dce247160d3e9516b041bb98cf (patch) | |
tree | 0c54b05ff3da61aa938bb684dd1d27eded93a2a6 | |
parent | f7ab8267401da4c124e571b7774f457ddeea17aa (diff) | |
parent | c93ca46cf5d0b0cd22e357a6460fa84fd4633440 (diff) |
Merge branch 'sg/column-nl'
The parser for the "--nl" option of "git column" has been
corrected.
* sg/column-nl:
column: fix parsing of the '--nl' option
-rw-r--r-- | Documentation/git-column.txt | 2 | ||||
-rw-r--r-- | builtin/column.c | 2 | ||||
-rwxr-xr-x | t/t9002-column.sh | 18 |
3 files changed, 20 insertions, 2 deletions
diff --git a/Documentation/git-column.txt b/Documentation/git-column.txt index f58e9c43e6..6cea9ab463 100644 --- a/Documentation/git-column.txt +++ b/Documentation/git-column.txt @@ -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. diff --git a/builtin/column.c b/builtin/column.c index 40d4b3bee2..158fdf53d9 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -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() }; diff --git a/t/t9002-column.sh b/t/t9002-column.sh index 89983527b6..6d3dbde3fe 100755 --- a/t/t9002-column.sh +++ b/t/t9002-column.sh @@ -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 |