Skip to content

Commit

Permalink
Make .ver information more precise
Browse files Browse the repository at this point in the history
Rather than simply HEAD, for each PDF use the most recent commit
contributing to any of that PDF's source files. Add "-dirty" only
if the particular PDF's source files are dirty.

Use committer date (%cD) rather than author date (%aD) to better
reflect when rebased or otherwise amended work appears on master.
  • Loading branch information
jmarshall committed May 26, 2018
1 parent badb8f3 commit 47aaedf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 0 additions & 2 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,4 @@ Therefore:
* If a series of changes are being made or several pull requests are being merged at once, the PDF updates can be batched up and just made once at the end.
* Conversely, if there are changes pending to several (even unrelated) PDFs, there is no reason not to commit them all at once.

If you are working on several PDFs at once, be careful in step 3 and perhaps use `make clean new/VCFv4.2.pdf new/VCFv4.3.pdf; make VCFv4.2.pdf VCFv4.3.pdf` to ensure that spurious “-dirty” commit hashes don't make their way into your PDFs.

<!-- vim:set linebreak: -->
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ new/%.pdf: %.tex
pdflatex --output-directory new $<
while grep -q 'Rerun to get [a-z-]* right' new/$*.log; do pdflatex --output-directory new $< || exit; done

new/CRAMv2.1.ver new/CRAMv3.ver: img/CRAMFileFormat2-1-fig001.png img/CRAMFileFormat2-1-fig002.png img/CRAMFileFormat2-1-fig003.png img/CRAMFileFormat2-1-fig004.png img/CRAMFileFormat2-1-fig005.png img/CRAMFileFormat2-1-fig006.png img/CRAMFileFormat2-1-fig007.png

new/VCFv4.1.ver new/VCFv4.2.ver new/VCFv4.3.ver: img/all_orientations-400x296.png img/derivation-400x267.png img/erosion-400x211.png img/inserted_contig-400x247.png img/inserted_sequence-400x189.png img/inversion-400x95.png img/microhomology-400x248.png img/multiple_mates-400x280.png img/phasing-400x259.png img/reciprocal_rearrangement-400x192.png img/telomere-400x251.png

new/%.ver: %.tex
echo "@newcommand*@commitdesc{`git describe --always --dirty`}@newcommand*@headdate{`git rev-list -n1 --format=%aD HEAD $< | sed '1d;s/.*, *//;s/ *[0-9]*:.*//'`}" | tr @ \\ > $@
./genversion.sh $^ > $@


mostlyclean:
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: >
baseurl: "/hts-specs"
url: "http://samtools.github.io"
github_username: samtools
exclude: ["*.tex", img, new, Makefile, MAINTAINERS.md, README.md]
exclude: ["*.sh", "*.tex", img, new, Makefile, MAINTAINERS.md, README.md]

# Build settings
markdown: kramdown
Expand Down
19 changes: 19 additions & 0 deletions genversion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# Add "-dirty" only if any of *this* PDF's source files is dirty
test -n "$(git status --porcelain "$@")" && dirty=-dirty

git rev-list -n1 --format='date %cD' HEAD -- "$@" | while read key value
do
case $key in
commit)
value=$(git describe --always $value)
echo "@newcommand*@commitdesc{$value$dirty}"
;;
date)
# Cut unwanted fields from "[Day, ]DD Mon YYYY[ HH:MM:SS +ZZZZ]"
value=$(echo $value | sed 's/.*, *//;s/ *[0-9]*:.*//')
echo "@newcommand*@headdate{$value}"
;;
esac
done | tr @ \\

0 comments on commit 47aaedf

Please sign in to comment.