develooper Front page | perl.perl5.porters | Postings from July 2019

Re: Transition from RT to GitHub [FAQ]

Thread Previous | Thread Next
Craig A. Berry
July 14, 2019 13:35
Re: Transition from RT to GitHub [FAQ]
Message ID:
On Sat, Jul 13, 2019 at 11:53 PM Tomasz Konojacki <> wrote:
> On Fri, 12 Jul 2019, at 16:56, Craig A. Berry wrote:
> > I think you are right.  I have poked around a bit to see if any
> > server-side scripting is available on GitHub and so far the answer
> > seems to be no.  So we have no way to include git_version.h in a
> > tarball or zipball downloaded from GitHub.
> >
> export-subst in .gitattributes[1] allows to use $Format:foo$
> placeholders in specified files. Github does expand them in generated
> tarballs.
> While this feature isn't able to fully recreate the output of 'git
> describe', it can write the id and timestamp of the current commit to
> a file.
> [1] -

Excellent!  That actually gets us most of the way there.  First I did this:

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..25cb6862f6
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+.patchfile export-subst
diff --git a/.patchfile b/.patchfile
new file mode 100644
index 0000000000..857a0a976e
--- /dev/null
+++ b/.patchfile
@@ -0,0 +1 @@
+$Format:%D$ $Format:%cI$ $Format:%H$
\ No newline at end of file

(N.B.  For testing, I made a .patchfile that can sit alongside a
.patch, but an alternative would be to remove .patch from .gitignore
and check in one that has the format templates here shown in

Then I generated an archive and extracted the .patchfile to observe
the substitutions:

$ git archive --format=zip --prefix="bleadtest/"
--output="../" HEAD
$ cd ..
$ unzip bleadtest/.patchfile
  inflating: bleadtest/.patchfile
$ cat bleadtest/.patchfile
HEAD -> blead 2019-07-14T08:09:14-05:00 f74569cca2268c4643aaedd3b6f31c9bbb49d141

Then I compared that to the file we currently generate in a git repository:

$ perl Porting/ > .patch
$ cat .patch
blead 2019-07-14.13:09:14 f74569cca2268c4643aaedd3b6f31c9bbb49d141

So the new file generated at archive time has the branch name, the
timestamp of the last commit, and the sha1 of the last commit just
like the existing file.  We might have to fiddle with the time format
to match exactly, and we are missing the git describe output that is
the 4th item in the existing .patch file.  Maybe someone deeply versed
in the --pretty formats knows a way to get that, or maybe we can live
without it.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About