Concretely, I'm proposing the attached. Peter didn't like PG_COMMIT_HASH, so I have PG_COMMIT_REFSPEC below, but I'm not wedded to that if a better name is proposed.
regards, tom lane
diff --git a/GNUmakefile.in b/GNUmakefile.in index 30553b2a95..27357e5e3b 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -102,10 +102,18 @@ distdir-location: # on, Unix machines. $(distdir).tar.gz: - $(GIT) -C $(srcdir) -c core.autocrlf=false archive --format tar.gz -9 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@ +ifneq ($(PG_COMMIT_REFSPEC),) + $(GIT) -C $(srcdir) -c core.autocrlf=false archive --format tar.gz -9 --prefix $(distdir)/ $(PG_COMMIT_REFSPEC) -o $(abs_top_builddir)/$@ +else + @echo "Please specify PG_COMMIT_REFSPEC." && exit 1 +endif $(distdir).tar.bz2: - $(GIT) -C $(srcdir) -c core.autocrlf=false -c tar.tar.bz2.command='$(BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@ +ifneq ($(PG_COMMIT_REFSPEC),) + $(GIT) -C $(srcdir) -c core.autocrlf=false -c tar.tar.bz2.command='$(BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ $(PG_COMMIT_REFSPEC) -o $(abs_top_builddir)/$@ +else + @echo "Please specify PG_COMMIT_REFSPEC." && exit 1 +endif distcheck: dist rm -rf $(dummy)
--- mk-one-release.orig 2024-04-23 17:30:08.983226671 -0400 +++ mk-one-release 2024-04-26 15:17:29.713669677 -0400 @@ -39,13 +39,17 @@ mkdir pgsql git archive ${gitref} | tar xf - -C pgsql # Include the git ref in the output tarballs +# (This has no effect with v17 and up; instead we rely on "git archive" +# to include the commit hash in the tar header) echo ${gitref} >pgsql/.gitrevision cd pgsql ./configure # Produce .tar.gz and .tar.bz2 files -make dist +# (With v17 and up, this will repeat the "git archive" call; the contents +# of the working directory don't matter directly to the results.) +make dist PG_COMMIT_REFSPEC=${gitref} # Generate md5 and sha256 sums, and copy files to output for x in *.tar.*; do