[mythtv] Github tarball from commit can change

Alec Leamas leamas.alec at gmail.com
Tue Sep 29 07:17:20 UTC 2015


On 29/09/15 04:09, Craig Treleaven wrote:

> I spleunked around a bit more.  The following commit by stuartm seems to have set up this hook (?) for when git archive is run:
>
> https://github.com/MythTV/mythtv/commit/cc037a8804c3f260e33f5611272b192699927662
>
> I don’t understand the process enough to say if this is the reason why we got a different archive Sep 25 v. Sep 17.  But the only difference is the EXPORTED_VERSION file which is somehow updated based on the ‘.gitattributes’ file.
>

Although git shines in a lot of areas, this is not one of them. Anyway, 
you have it all described in the git-attributes manpage, look for 
'export-subst'. Basically, the .gitattributes file tells git to make 
certain substitutions on the files GITHASH and EXPORTED_VERSION when 
running git-archive(1). Since downloading a commit from github is an 
implicit git-archive invocation the pieces falls into place.

The pattern in GITHASH  and ExPORTED_VERSION are also described in the 
git-attributes manpage (by a reference to git-log).

The last piece is the version.sh file. The purpose of this seems to be 
to make the variables SOURCE_VERSION and BRANCH available. The commit 
seems to make this work also on an exported tree using the 
EXPORTED_VERSION or VERSION file. I presume that before the commit, 
version.sh only worked on a clone with complete git information (i. e., 
the .git directory) in place or a working VERSION file. As for VERSION, 
I have no idea where it comes from.

Note that this does not break the basic git promise that that two 
checkouts of the same commit gives the same files. These transformations 
are done by git-archive which is not the same as a checkout. That is, in 
this export-subst scenario pulling a commit directly from github will 
give a different result than "git clone <url>; git checkout <commit>". 
In the latter case there will be no substitutions on GITHASH and 
EXPORTED_VERSION.

I think. Hopefully someone who understands this better could chime in; 
I'm on somewhat thin ice here.

Cheers!

--alec




More information about the mythtv-dev mailing list