# [PATCH v3] log: forbid log --graph --no-walk

7 messages from 2015-03-15 to 2015-03-16. Participants: Manos Pitsidianakis, Dongcan Jiang, Junio C Hamano.
Thread: https://gitlist.dev/t/38809

## Manos Pitsidianakis, 2015-03-15 00:43

Subject: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <5504D5A2.2070405@norn.io>
URL: https://gitlist.dev/e/5504D5A2.2070405%40norn.io
In-Reply-To: <md5:DbynqDqKsm8mpedJ3B12rw==>

```
In git-log, --graph shows a graphical representation of a continuous
commit history, and --no-walk shows discrete specified commits without
continuity. Using both doesn't make sense, so we forbid the combined use
of these flags.

Signed-off-by: Manos Pitsidianakis <epilys@norn.io>
---
This is a microproject intended to complement my GSoC application.
 builtin/log.c  | 2 ++
 t/t4202-log.sh | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/builtin/log.c b/builtin/log.c
index dd8f3fc..5aaf964 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -155,6 +155,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
 	memset(&w, 0, sizeof(w));
 	userformat_find_requirements(NULL, &w);
 
+	if (rev->graph && rev->no_walk)
+		die("--graph and --no-walk are incompatible");
 	if (!rev->show_notes_given && (!rev->pretty_given || w.notes))
 		rev->show_notes = 1;
 	if (rev->show_notes)
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 5f2b290..5d72713 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -887,4 +887,8 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
 	grep "^| | gpg: Good signature" actual
 '
 
+test_expect_success 'forbid log --graph --no-walk' '
+	test_must_fail git log --graph --no-walk
+'
+
 test_done
-- 
2.1.4

```

## Dongcan Jiang, 2015-03-15 01:08

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <CABwkPcpdpsVUFa_GSr=qYazYQDBr_ygQTctFXmYQf2ZsRt5bpA@mail.gmail.com>
URL: https://gitlist.dev/e/CABwkPcpdpsVUFa_GSr%3DqYazYQDBr_ygQTctFXmYQf2ZsRt5bpA%40mail.gmail.com
In-Reply-To: <5504D5A2.2070405@norn.io>

```
it seems that your patch could not pass t4052-stat-output.sh.

I think it would be better if you could improve the specification for
this change in Document/rev-list-options.txt

2015-03-15 8:43 GMT+08:00 Manos Pitsidianakis <epilys@norn.io>:
> In git-log, --graph shows a graphical representation of a continuous
> commit history, and --no-walk shows discrete specified commits without
> continuity. Using both doesn't make sense, so we forbid the combined use
> of these flags.
>
> Signed-off-by: Manos Pitsidianakis <epilys@norn.io>
> ---
> This is a microproject intended to complement my GSoC application.
>  builtin/log.c  | 2 ++
>  t/t4202-log.sh | 4 ++++
>  2 files changed, 6 insertions(+)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index dd8f3fc..5aaf964 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -155,6 +155,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
>         memset(&w, 0, sizeof(w));
>         userformat_find_requirements(NULL, &w);
>
> +       if (rev->graph && rev->no_walk)
> +               die("--graph and --no-walk are incompatible");
>         if (!rev->show_notes_given && (!rev->pretty_given || w.notes))
>                 rev->show_notes = 1;
>         if (rev->show_notes)
> diff --git a/t/t4202-log.sh b/t/t4202-log.sh
> index 5f2b290..5d72713 100755
> --- a/t/t4202-log.sh
> +++ b/t/t4202-log.sh
> @@ -887,4 +887,8 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
>         grep "^| | gpg: Good signature" actual
>  '
>
> +test_expect_success 'forbid log --graph --no-walk' '
> +       test_must_fail git log --graph --no-walk
> +'
> +
>  test_done
> --
> 2.1.4
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
江东灿（Dongcan Jiang）
Team of Search Engine & Web Mining
School of Electronic Engineering & Computer Science
Peking University, Beijing, 100871, P.R.China

```

## Manos Pitsidianakis, 2015-03-15 01:24

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <5504DF62.4050104@norn.io>
URL: https://gitlist.dev/e/5504DF62.4050104%40norn.io
In-Reply-To: <CABwkPcpdpsVUFa_GSr=qYazYQDBr_ygQTctFXmYQf2ZsRt5bpA@mail.gmail.com>

```
On 03/15/2015 03:08 AM, Dongcan Jiang wrote:
> it seems that your patch could not pass t4052-stat-output.sh.
> 
> I think it would be better if you could improve the specification for
> this change in Document/rev-list-options.txt

Can't grok why this happens. What exactly is happening in
t4052-stat-output.sh? Is it testing every possible combination of git
commands and arguments?

```

## Dongcan Jiang, 2015-03-15 01:39

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <CABwkPcpRG0d23OCuoktRdXt9nyA3RtmxGkqkoQ-wApzZvtfYDQ@mail.gmail.com>
URL: https://gitlist.dev/e/CABwkPcpRG0d23OCuoktRdXt9nyA3RtmxGkqkoQ-wApzZvtfYDQ%40mail.gmail.com
In-Reply-To: <5504DF62.4050104@norn.io>

```
Because "revs->no_walk" gets set when it comes to "git show". You can
find more information on [1].

[1] http://article.gmane.org/gmane.comp.version-control.git/264921

2015-03-15 9:24 GMT+08:00 Manos Pitsidianakis <epilys@norn.io>:
> On 03/15/2015 03:08 AM, Dongcan Jiang wrote:
>> it seems that your patch could not pass t4052-stat-output.sh.
>>
>> I think it would be better if you could improve the specification for
>> this change in Document/rev-list-options.txt
>
> Can't grok why this happens. What exactly is happening in
> t4052-stat-output.sh? Is it testing every possible combination of git
> commands and arguments?



-- 
江东灿（Dongcan Jiang）
Team of Search Engine & Web Mining
School of Electronic Engineering & Computer Science
Peking University, Beijing, 100871, P.R.China

```

## Manos Pitsidianakis, 2015-03-16 19:00

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <55072856.5090308@norn.io>
URL: https://gitlist.dev/e/55072856.5090308%40norn.io
In-Reply-To: <CABwkPcpRG0d23OCuoktRdXt9nyA3RtmxGkqkoQ-wApzZvtfYDQ@mail.gmail.com>

```
On 03/15/2015 03:39 AM, Dongcan Jiang wrote:
> Because "revs->no_walk" gets set when it comes to "git show".

So basically rewriting t4052-stat-output.sh to exclude git show --graph
cases (or similar) is not enough. If rewriting git-show code is what is
needed, is that in the scope of a microproject?

```

## Junio C Hamano, 2015-03-16 19:08

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <xmqq7fugrc9m.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq7fugrc9m.fsf%40gitster.dls.corp.google.com
In-Reply-To: <55072856.5090308@norn.io>

```
Manos Pitsidianakis <epilys@norn.io> writes:

> On 03/15/2015 03:39 AM, Dongcan Jiang wrote:
>> Because "revs->no_walk" gets set when it comes to "git show".
>
> So basically rewriting t4052-stat-output.sh to exclude git show --graph
> cases (or similar) is not enough. If rewriting git-show code is what is
> needed, is that in the scope of a microproject?

Perhaps 13b25381 (revision: forbid combining --graph and --no-walk,
2015-03-11) that is queued on 'pu' would be a good answer to this
question?

```

## Manos Pitsidianakis, 2015-03-16 19:15

Subject: Re: [PATCH v3] log: forbid log --graph --no-walk
Message-ID: <55072BEF.5040608@norn.io>
URL: https://gitlist.dev/e/55072BEF.5040608%40norn.io
In-Reply-To: <xmqq7fugrc9m.fsf@gitster.dls.corp.google.com>

```
On 03/16/2015 09:08 PM, Junio C Hamano wrote:
> Perhaps 13b25381 (revision: forbid combining --graph and --no-walk,
> 2015-03-11) that is queued on 'pu' would be a good answer to this
> question?

Didn't notice a patch was queued on 'pu', thanks.

```
