"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog diff lacks diffstat
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 18 Aug 2024 14:53:49 +1000

Download raw body.

Thread
Christian Weisgerber <naddy@mips.inka.de> wrote:
> Mark Jamsek:
> 
> > Updated/actual diff.
> > 
> > Previous diff sent was the wrong commit: after adding the diffstat to
> > blobs and trees, we don't need the do_diffstat flag as the diffstat is
> > now shown in all diff types so written unconditionally.
> 
> This is great!  I have one nitpick: When we diff two blobs, showing
> one blob ID as path doesn't make much sense.  Instead, match the
> output of "got diff -d" in this case, which is "short_ID1 -> short_ID2".

Yes, definitely! Thanks, naddy.

ok

> diff /home/naddy/got
> commit - 044ba7d9057a24ef42472c729c222bfa87d29c54
> path + /home/naddy/got
> blob - d8d0d214f46d115de70295102f416c8efa700d8d
> file + regress/tog/diff.sh
> --- regress/tog/diff.sh
> +++ regress/tog/diff.sh
> @@ -563,13 +563,16 @@ test_diff_blobs()
>  
>  	local blob_alpha_head=$(get_blob_id $testroot/repo "" alpha)
>  
> +	local short_alpha_root=$(printf '%.10s' $blob_alpha_root)
> +	local short_alpha_head=$(printf '%.10s' $blob_alpha_head)
> +
>  	cat <<EOF >$TOG_TEST_SCRIPT
>  SCREENDUMP
>  EOF
>  
>  	cat <<EOF >$testroot/view.expected
>  [1/12] diff $blob_alpha_root $blob_alpha_head
> -M  $blob_alpha_head  |  1+  1-
> +M  $short_alpha_root -> $short_alpha_head  |  1+  1-
>  
>  1 file changed, 1 insertion(+), 1 deletion(-)
>  
> blob - 4066c6daccca293de31dc4c0f20604184235fb77
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -5419,7 +5419,7 @@ create_diff(struct tog_diff_view_state *s)
>  
>  	/*
>  	 * The diffstat requires the diff to be built first, but we want the
> -	 * diffstat to prepend the diff when displayed. Build the diff first
> +	 * diffstat to precede the diff when displayed. Build the diff first
>  	 * in the temporary file and write the diffstat and/or commit info to
>  	 * the persistent file (s->f) from which views are drawn, then append
>  	 * the diff from the temp file to the diffstat/commit info in s->f.
> @@ -5445,7 +5445,7 @@ create_diff(struct tog_diff_view_state *s)
>  	case GOT_OBJ_TYPE_BLOB:
>  		err = got_diff_objects_as_blobs(&lines, &nlines,
>  		    s->f1, s->f2, s->fd1, s->fd2, s->id1, s->id2,
> -		    s->label1, s->label2, tog_diff_algo, s->diff_context,
> +		    NULL, NULL, tog_diff_algo, s->diff_context,
>  		    s->ignore_whitespace, s->force_text_diff, &dsa, s->repo,
>  		    tmp_diff_file);
>  		if (err != NULL)


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68