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

Re: [PATCH] gitk: fix --all behavior combined with --not

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 4, 2019, 10:38 UTC
Message-ID
<nycvar.QRO.7.76.6.1907041236200.44@tvgsbejvaqbjf.bet>
In-Reply-To
<20190704080907.GA45656@book.hvoigt.net>
Hi Heiko,
On Thu, 4 Jul 2019, Heiko Voigt wrote:
Show 22 quoted lines
> In commit 4d5e1b1319 ("gitk: Show detached HEAD if --all is specified",
> 2014-09-09) the intention was to have detached HEAD shown when the --all
> argument is given.
>
> This was solved by appending HEAD to the revs list. By doing that the
> behavior using the --not argument is now broken, since that inverts the
> meaning of all following arguments passed to git rev-parse.
>
> Lets fix this by prepending HEAD instead of appending, this way there
> can not be any '--not' in front.
>
> This was discovered because
>
> 	gitk --all --not origin/master
>
> does not display the same revs as
>
> 	gitk --all ^origin/master
>
> which it should.
>
> Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Good description.
Show 14 quoted lines
> ---
>  gitk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gitk b/gitk
> index a14d7a1..19d95cd 100755
> --- a/gitk
> +++ b/gitk
> @@ -295,7 +295,7 @@ proc parseviewrevs {view revs} {
>      if {$revs eq {}} {
>  	set revs HEAD
>      } elseif {[lsearch -exact $revs --all] >= 0} {
> -	lappend revs HEAD
> +	linsert revs 0 HEAD

For a moment, I wondered whether there is any case where `HEAD` might not be appropriate as first argument, but you're right, the revision parsing machinery allows mixing options and rev arguments.

In short: this patch looks good to me.

Thanks, Dscho

Show 7 quoted lines
>      }
>      if {[catch {set ids [eval exec git rev-parse $revs]} err]} {
>  	# we get stdout followed by stderr in $err
> --
> 2.21.0
>
>
Previous: Heiko VoigtNext: Heiko Voigt
Message 2 of 12 in “gitk: fix --all behavior combined with --not”
  1. gitk: fix --all behavior combined with --notHeiko Voigt, Jul 4, 2019
  2. Johannes SchindelinJul 4, 2019
  3. Heiko VoigtJul 4, 2019
  4. Junio C HamanoJul 8, 2019
  5. Junio C HamanoJul 9, 2019
  6. Junio C HamanoJul 9, 2019
  7. Heiko VoigtJul 10, 2019
  8. Junio C HamanoJul 10, 2019
  9. Heiko VoigtJul 11, 2019
  10. Junio C HamanoJul 11, 2019
  11. Johannes SixtJul 11, 2019
  12. Heiko VoigtJul 10, 2019

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.