Git Mailing List Archive mirror
 help / color / mirror / Atom feed
* [PATCH] doc: doc-diff: specify date
@ 2023-05-03 23:23 Felipe Contreras
  2023-05-05  1:15 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Felipe Contreras @ 2023-05-03 23:23 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Felipe Contreras

Otherwise comparing the output of commits with different dates generates
unnecessary diffs.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/doc-diff | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/doc-diff b/Documentation/doc-diff
index 1694300e50..554a78a12d 100755
--- a/Documentation/doc-diff
+++ b/Documentation/doc-diff
@@ -153,6 +153,7 @@ render_tree () {
 		make -j$parallel -C "$tmp/worktree" \
 			$makemanflags \
 			GIT_VERSION=omitted \
+			GIT_DATE=1970-01-01 \
 			SOURCE_DATE_EPOCH=0 \
 			DESTDIR="$tmp/installed/$dname+" \
 			install-man &&
-- 
2.40.0+fc1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: doc-diff: specify date
  2023-05-03 23:23 [PATCH] doc: doc-diff: specify date Felipe Contreras
@ 2023-05-05  1:15 ` Junio C Hamano
  2023-05-05  1:46   ` Jeff King
  2023-05-08  2:08   ` Felipe Contreras
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2023-05-05  1:15 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: git, Jeff King

Felipe Contreras <felipe.contreras@gmail.com> writes:

> Otherwise comparing the output of commits with different dates generates
> unnecessary diffs.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
>  Documentation/doc-diff | 1 +
>  1 file changed, 1 insertion(+)

Ahh, it is a fix for a fallout from 28fde3a1 (doc: set actual
revdate for manpages, 2023-04-13); when it is shown in the patch
form like this, it is kind of obvious why we need to compensate for
that change this way, but apparently "doc-diff" slipped everybody's
mind back then when we were looking at the change.

Looking at the patch text of 28fde3a1, we pass GIT_VERSION and
GIT_DATE to AsciiDoc since that version.  We were already covering
GIT_VERSION by hardcoded "omitted" string, and now we compensate for
the other one here, which means this change and the other changes
complement each other, and there shouldn't be a need to further
adjustment for that change around this area.  Looking good.

> diff --git a/Documentation/doc-diff b/Documentation/doc-diff
> index 1694300e50..554a78a12d 100755
> --- a/Documentation/doc-diff
> +++ b/Documentation/doc-diff
> @@ -153,6 +153,7 @@ render_tree () {
>  		make -j$parallel -C "$tmp/worktree" \
>  			$makemanflags \
>  			GIT_VERSION=omitted \
> +			GIT_DATE=1970-01-01 \
>  			SOURCE_DATE_EPOCH=0 \
>  			DESTDIR="$tmp/installed/$dname+" \
>  			install-man &&

I wonder what the existing SOURCE_DATE_EPOCH was trying to do there,
though.

Will queue.  Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: doc-diff: specify date
  2023-05-05  1:15 ` Junio C Hamano
@ 2023-05-05  1:46   ` Jeff King
  2023-05-05  5:55     ` Junio C Hamano
  2023-05-08  2:08   ` Felipe Contreras
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff King @ 2023-05-05  1:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Felipe Contreras, git

On Thu, May 04, 2023 at 06:15:59PM -0700, Junio C Hamano wrote:

> > diff --git a/Documentation/doc-diff b/Documentation/doc-diff
> > index 1694300e50..554a78a12d 100755
> > --- a/Documentation/doc-diff
> > +++ b/Documentation/doc-diff
> > @@ -153,6 +153,7 @@ render_tree () {
> >  		make -j$parallel -C "$tmp/worktree" \
> >  			$makemanflags \
> >  			GIT_VERSION=omitted \
> > +			GIT_DATE=1970-01-01 \
> >  			SOURCE_DATE_EPOCH=0 \
> >  			DESTDIR="$tmp/installed/$dname+" \
> >  			install-man &&
> 
> I wonder what the existing SOURCE_DATE_EPOCH was trying to do there,
> though.

It used to be necessary so that we had a reproducible build. Otherwise,
asciidoc uses the mtime of the file, and diffing two versions would have
tons of uninteresting date-differences.

After 28fde3a1 I doubt it is necessary, as the header uses $GIT_DATE
instead (it's possible the mtime may be used elsewhere, but I didn't see
any spot after grepping a built xml file. And at any rate, if it does
not produce a visible difference, that is enough for doc-diff).

-Peff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: doc-diff: specify date
  2023-05-05  1:46   ` Jeff King
@ 2023-05-05  5:55     ` Junio C Hamano
  2023-05-05 21:16       ` Jeff King
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2023-05-05  5:55 UTC (permalink / raw)
  To: Jeff King; +Cc: Felipe Contreras, git

Jeff King <peff@peff.net> writes:

>> >  			GIT_VERSION=omitted \
>> > +			GIT_DATE=1970-01-01 \
>> >  			SOURCE_DATE_EPOCH=0 \
>> >  			DESTDIR="$tmp/installed/$dname+" \
>> >  			install-man &&
>> 
>> I wonder what the existing SOURCE_DATE_EPOCH was trying to do there,
>> though.
>
> It used to be necessary so that we had a reproducible build. Otherwise,
> asciidoc uses the mtime of the file, and diffing two versions would have
> tons of uninteresting date-differences.
>
> After 28fde3a1 I doubt it is necessary, as the header uses $GIT_DATE
> instead (it's possible the mtime may be used elsewhere, but I didn't see
> any spot after grepping a built xml file. And at any rate, if it does
> not produce a visible difference, that is enough for doc-diff).

Thanks for confirming my suspicion.  I guess leaving it there still
would not hurt.  It can be removed whenever somebody motivated
enough comes and shows a well-reasoned patch that explains why it no
longer is necessary ;-)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: doc-diff: specify date
  2023-05-05  5:55     ` Junio C Hamano
@ 2023-05-05 21:16       ` Jeff King
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2023-05-05 21:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Felipe Contreras, git

On Thu, May 04, 2023 at 10:55:52PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> >> >  			GIT_VERSION=omitted \
> >> > +			GIT_DATE=1970-01-01 \
> >> >  			SOURCE_DATE_EPOCH=0 \
> >> >  			DESTDIR="$tmp/installed/$dname+" \
> >> >  			install-man &&
> >> 
> >> I wonder what the existing SOURCE_DATE_EPOCH was trying to do there,
> >> though.
> >
> > It used to be necessary so that we had a reproducible build. Otherwise,
> > asciidoc uses the mtime of the file, and diffing two versions would have
> > tons of uninteresting date-differences.
> >
> > After 28fde3a1 I doubt it is necessary, as the header uses $GIT_DATE
> > instead (it's possible the mtime may be used elsewhere, but I didn't see
> > any spot after grepping a built xml file. And at any rate, if it does
> > not produce a visible difference, that is enough for doc-diff).
> 
> Thanks for confirming my suspicion.  I guess leaving it there still
> would not hurt.  It can be removed whenever somebody motivated
> enough comes and shows a well-reasoned patch that explains why it no
> longer is necessary ;-)

-- >8 --
Subject: [PATCH] doc-diff: drop SOURCE_DATE_EPOCH override

The original doc-diff script set SOURCE_DATE_EPOCH to make asciidoc's
output deterministic. Otherwise, the mtime of the source files would end
up in the footer of the manpage, causing noisy and uninteresting diff
hunks.

But this has been unused since 28fde3a1f4 (doc: set actual revdate for
manpages, 2023-04-13), as the footer uses the externally-specified
GIT_DATE instead (that needs to be set consistently, too, which it now
is as of the previous commit).

Asciidoc sets several automatic attributes based on the mtime (or manual
epoch), so it's still possible to write a document that would need
SOURCE_DATE_EPOCH set to be deterministic. But if we wrote such a thing,
it's probably a mistake, and we're better off having doc-diff loudly
show it.

Signed-off-by: Jeff King <peff@peff.net>
---
 Documentation/doc-diff | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/doc-diff b/Documentation/doc-diff
index 554a78a12d..fb09e0ac0e 100755
--- a/Documentation/doc-diff
+++ b/Documentation/doc-diff
@@ -154,7 +154,6 @@ render_tree () {
 			$makemanflags \
 			GIT_VERSION=omitted \
 			GIT_DATE=1970-01-01 \
-			SOURCE_DATE_EPOCH=0 \
 			DESTDIR="$tmp/installed/$dname+" \
 			install-man &&
 		mv "$tmp/installed/$dname+" "$tmp/installed/$dname"
-- 
2.40.1.802.gdef2a8734a


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] doc: doc-diff: specify date
  2023-05-05  1:15 ` Junio C Hamano
  2023-05-05  1:46   ` Jeff King
@ 2023-05-08  2:08   ` Felipe Contreras
  1 sibling, 0 replies; 6+ messages in thread
From: Felipe Contreras @ 2023-05-08  2:08 UTC (permalink / raw)
  To: Junio C Hamano, Felipe Contreras; +Cc: git, Jeff King

Junio C Hamano wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
> 
> > Otherwise comparing the output of commits with different dates generates
> > unnecessary diffs.
> >
> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> > ---
> >  Documentation/doc-diff | 1 +
> >  1 file changed, 1 insertion(+)
> 
> Ahh, it is a fix for a fallout from 28fde3a1 (doc: set actual
> revdate for manpages, 2023-04-13); when it is shown in the patch
> form like this, it is kind of obvious why we need to compensate for
> that change this way, but apparently "doc-diff" slipped everybody's
> mind back then when we were looking at the change.

Yes. doc-diff is an odd duck, because it can't be easily integrated to
the testing framework.

Sometimes a diff in the documentation is intentional, so the fact that
doc-diff generates an output from HEAD~ to HEAD is precisely what was
intended. However, sometimes it's not. Maybe a flag inside the commit
message such as GitHub's `[no ci]` might help, but it's beyond me how
could that be cleanly integrated to continous integration machinery.

For now doc-diff is meant to be run manually, therefore it's expected
that some unexpeced diffs are inevitably going to slip by, and more
relevantly: issues in doc-diff itself are going to slip by.

> Looking at the patch text of 28fde3a1, we pass GIT_VERSION and
> GIT_DATE to AsciiDoc since that version.  We were already covering
> GIT_VERSION by hardcoded "omitted" string, and now we compensate for
> the other one here, which means this change and the other changes
> complement each other, and there shouldn't be a need to further
> adjustment for that change around this area.  Looking good.

Yes. I think we should be passing a semi-real version instead, like
`0.0.0`, just to see how a real version would look like, but that's
orthogonal.

> > diff --git a/Documentation/doc-diff b/Documentation/doc-diff
> > index 1694300e50..554a78a12d 100755
> > --- a/Documentation/doc-diff
> > +++ b/Documentation/doc-diff
> > @@ -153,6 +153,7 @@ render_tree () {
> >  		make -j$parallel -C "$tmp/worktree" \
> >  			$makemanflags \
> >  			GIT_VERSION=omitted \
> > +			GIT_DATE=1970-01-01 \
> >  			SOURCE_DATE_EPOCH=0 \
> >  			DESTDIR="$tmp/installed/$dname+" \
> >  			install-man &&
> 
> I wonder what the existing SOURCE_DATE_EPOCH was trying to do there,
> though.

I also wondered the same, but again: orthogonal.

Cheers.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-08  2:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-03 23:23 [PATCH] doc: doc-diff: specify date Felipe Contreras
2023-05-05  1:15 ` Junio C Hamano
2023-05-05  1:46   ` Jeff King
2023-05-05  5:55     ` Junio C Hamano
2023-05-05 21:16       ` Jeff King
2023-05-08  2:08   ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).