git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2/GSoC/MICRO] revision: forbid combining --graph and --no-walk

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 8, 2015, 19:40 UTC
Message-ID
<xmqqwq2rqnvp.fsf@gitster.dls.corp.google.com>
In-Reply-To
<3de5837561c07fbf8d6187578fc37b3dbf2ea5f7.1425702676.git.dongcan.jiang@gmail.com>
Dongcan Jiang <dongcan.jiang@gmail.com> writes:
> Because --graph is about connected history while
> --no-walk is about discrete points. [1]

The convention around here is that the title of the patch on the Subject line is *not* the beginning part of the first sentence, you would need to phrase the above more like:

        Because "--graph" is about ... discrete points, it does not
        make sense to allow giving these two options at the same
        time.
to make it a complete sentence.
> It's a pity that git-show has to allow such combination
> in order to make t4052-stat-output.sh compatible. [2]

If you feel "It's a pity", it actually is OK to make a good argument for "fixing" the test without adding the workaround. A replacement commit message for the above two lines for such an approach might look like:

        This change makes a few calls to "show --graph" fail in
        t4052, but asking to show one commit _with_ graph is a
        nonsensical thing to do.  Correct these offending tests that
        expected "--graph" to be useful by removing "--graph" in
        their invocations (and adjusting the expected output, of
        course).

That way, people who do find it actually useful that "show --graph HEAD" that shows something like this

        $ git show --graph -s 52d5bf778
        *   commit 52d5bf77875275bbfc1bf1d7b690f355d5c869e4
        |\  Merge: 36ab768 189c860
        | | Author: Junio C Hamano <gitster@pobox.com>
        | | Date:   Fri Mar 6 15:02:33 2015 -0800
        | | 
        | |     Merge branch 'bw/kwset-use-unsigned'
        ...
can react and argue why it is useful to them.  

It is important to notice that your "It's a pity" will no longer apply, if we are keeping the feature because it is useful. It would be clear that we would be keeping the feature not because we are too lazy to correct tests, but because it is actually useful.

> Signed-off-by: Dongcan Jiang <dongcan.jiang@gmail.com>
>
> Thanks-to: Eric Sunshine, René Scharfe, Junio C Hamano

These look unusual for a few reasons: S-o-b is not at the end, we usually say Helped-by: instead, and we do not use Thanks-to: with multiple names on a single line.

Please do not try to be original without a good reason. We may start counting the number of times people appear on these footers to see how much contribution those who do not directly author commits (read: those who mentor others) are making.

Show 13 quoted lines
> diff --git a/t/t4202-log.sh b/t/t4202-log.sh
> index 5f2b290..fed162e 100755
> --- a/t/t4202-log.sh
> +++ b/t/t4202-log.sh
> @@ -887,4 +887,10 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
>  	grep "^| | gpg: Good signature" actual
>  '
>
> +test_expect_success 'log --graph --no-walk is forbidden' '
> +	echo "fatal: cannot combine --no-walk with --graph" >expect-error &&
> +	test_must_fail git log --graph --no-walk 2>error &&
> +	test_cmp expect-error error
> +'

I do not think we want to check exact phrasing of the error message here. Just the second line (without the " 2>error &&" at the end) should be sufficient.

Show 5 quoted lines
> +test_expect_success 'rev-list --graph --no-walk is forbidden' '
> +	echo "fatal: cannot combine --no-walk with --graph" >expect-error &&
> +	test_must_fail git rev-list --graph --no-walk 2>error &&
> +	test_cmp expect-error error
> +'

The same comment (about preferring not to check the error message) applies here, and more importantly, this is not a good test because "git rev-list --graph" without the forbidden "--no-walk" would fail for other reasons. Perhaps

	test_must_fail git rev-list --graph --no-walk HEAD

or something, assuming that there is already a commit pointed by HEAD at this point in the test (I didn't check).

Thanks.
Previous: Dongcan JiangNext: Dongcan Jiang
Message 7 of 13 in “[GSoC][MICRO] Forbid "log --graph --no-walk"”
  1. [GSoC][MICRO] Forbid "log --graph --no-walk"Dongcan Jiang, Mar 6, 2015
  2. Eric SunshineMar 6, 2015
  3. Dongcan JiangMar 6, 2015
  4. Junio C HamanoMar 6, 2015
  5. René ScharfeMar 6, 2015
  6. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 7, 2015
  7. Junio C HamanoMar 8, 2015
  8. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 9, 2015
  9. Junio C HamanoMar 10, 2015
  10. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 11, 2015
  11. Junio C HamanoMar 17, 2015
  12. Eric SunshineMar 17, 2015
  13. revision: forbid combining --graph and --no-walkDongcan Jiang, Mar 18, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.