Namhyung Kim wrote: > --- a/Documentation/git-branch.txt > +++ b/Documentation/git-branch.txt > @@ -114,6 +114,7 @@ OPTIONS > --abbrev=<length>:: > Alter the sha1's minimum display length in the output listing. > The default value is 7. > + (and can be overrided by the `core.abbrev` config option). Nitpicks: this would be clearer without the period after "7" and without the parentheses around the following phrase. s/overrided/overridden/. > --- a/builtin/branch.c > +++ b/builtin/branch.c > @@ -613,7 +613,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int > int cmd_branch(int argc, const char **argv, const char *prefix) > { > int delete = 0, rename = 0, force_create = 0; > - int verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0; > + int verbose = 0, abbrev = -1, detached = 0; Yes. (One meaningful "c89 -pedantic" warning down, several to go.) Some squashable tests follow. Maybe they can be useful. Thanks for fixing this. Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx> --- t/t3203-branch-output.sh | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git i/t/t3203-branch-output.sh w/t/t3203-branch-output.sh index 6b7c118e..87333b49 100755 --- i/t/t3203-branch-output.sh +++ w/t/t3203-branch-output.sh @@ -3,6 +3,17 @@ test_description='git branch display tests' . ./test-lib.sh +minimum_line_length () { + awk ' + BEGIN { minlen = 99 } + { + if (length($1) < minlen) + minlen = length($1) + } + END { print minlen } + ' +} + test_expect_success 'make commits' ' echo content >file && git add file && @@ -66,6 +77,24 @@ test_expect_success 'git branch -v shows branch summaries' ' test_cmp expect actual ' +test_expect_success 'git branch -v --abbrev' ' + echo 10 >expect && + git branch -v --abbrev=10 >tmp && + awk "{print \$(NF - 1)}" <tmp >commitids && + minimum_line_length <commitids >actual && + test_cmp expect actual +' + +test_expect_success 'git branch -v respects [core] abbrev configuration' ' + git config core.abbrev 9 && + test_when_finished "git config --unset core.abbrev" && + echo 9 >expect && + git branch -v >tmp && + awk "{print \$(NF - 1)}" <tmp >commitids && + minimum_line_length <commitids >actual && + test_cmp expect actual +' + cat >expect <<'EOF' * (no branch) branch-one -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html