Share vc-git from a single copy at the repository root
Four templates need it and two did not have it. The paper copy called gawk -f ~/bin/vc-git.awk while shipping vc-git.awk beside itself, so it only worked for someone who had also installed the awk script by hand; it now calls the copy it ships with. Templates link to ../../resources/, which new_tex_document has to dereference when it extracts one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,7 +14,7 @@ viewpdf: all
|
|||||||
evince *.pdf
|
evince *.pdf
|
||||||
|
|
||||||
vc:
|
vc:
|
||||||
vc-git
|
resources/vc-git
|
||||||
|
|
||||||
pdf: all
|
pdf: all
|
||||||
|
|
||||||
|
|||||||
1
letter_template/resources/vc-git
Symbolic link
1
letter_template/resources/vc-git
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git
|
||||||
1
letter_template/resources/vc-git.awk
Symbolic link
1
letter_template/resources/vc-git.awk
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git.awk
|
||||||
1
memo_template/resources/vc-git
Symbolic link
1
memo_template/resources/vc-git
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git
|
||||||
1
memo_template/resources/vc-git.awk
Symbolic link
1
memo_template/resources/vc-git.awk
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git.awk
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# This is file 'vc' from the vc bundle for TeX.
|
|
||||||
# The original file can be found at CTAN:support/vc.
|
|
||||||
# This file is Public Domain.
|
|
||||||
|
|
||||||
# Parse command line options.
|
|
||||||
full=0
|
|
||||||
mod=0
|
|
||||||
while [ -n "$(echo $1 | grep '-')" ]; do
|
|
||||||
case $1 in
|
|
||||||
-f ) full=1 ;;
|
|
||||||
-m ) mod=1 ;;
|
|
||||||
* ) echo 'usage: vc [-f] [-m]'
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
# English locale.
|
|
||||||
LC_ALL=C
|
|
||||||
git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %ai%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %ci%n" |gawk -v script=log -v full=$full -f ~/bin/vc-git.awk > vc
|
|
||||||
if [ "$mod" = 1 ]
|
|
||||||
then
|
|
||||||
git status |gawk -v script=status -f ~/bin/vc-git.awk >> vc
|
|
||||||
fi
|
|
||||||
1
paper_template/resources/vc-git
Symbolic link
1
paper_template/resources/vc-git
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
# This is file 'vc-git.awk' from the vc bundle for TeX.
|
|
||||||
# The original file can be found at CTAN:support/vc.
|
|
||||||
# This file is Public Domain.
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
if (script=="status") {
|
|
||||||
modified = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Process output of "git log".
|
|
||||||
script=="log" && /^Hash:/ { Hash = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Abr. Hash:/ { AbrHash = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Parent Hashes:/ { ParentHashes = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Abr. Parent Hashes:/ { AbrParentHashes = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Name:/ { AuthorName = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Email:/ { AuthorEmail = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Date:/ { AuthorDate = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Name:/ { CommitterName = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Email:/ { CommitterEmail = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Date:/ { CommitterDate = substr($0, 2+match($0, ":")) }
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
### Changed index?
|
|
||||||
script=="status" && /^# Changes to be committed:/ { modified = 1 }
|
|
||||||
### Unstaged modifications?
|
|
||||||
script=="status" && /^# Changed but not updated:/ { modified = 2 }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END {
|
|
||||||
|
|
||||||
### Process output of "git log".
|
|
||||||
if (script=="log") {
|
|
||||||
### Standard encoding is UTF-8.
|
|
||||||
if (Encoding == "") Encoding = "UTF-8"
|
|
||||||
### Extract relevant information from variables.
|
|
||||||
LongDate = substr(AuthorDate, 1, 25)
|
|
||||||
DateRAW = substr(LongDate, 1, 10)
|
|
||||||
DateISO = DateRAW
|
|
||||||
DateTEX = DateISO
|
|
||||||
gsub("-", "/", DateTEX)
|
|
||||||
Time = substr(LongDate, 12, 14)
|
|
||||||
### Write file identification to vc.tex.
|
|
||||||
print "%%% This file has been generated by the vc bundle for TeX."
|
|
||||||
print "%%% Do not edit this file!"
|
|
||||||
print "%%%"
|
|
||||||
### Write Git specific macros.
|
|
||||||
print "%%% Define Git specific macros."
|
|
||||||
print "\\gdef\\GITHash{" Hash "}%"
|
|
||||||
print "\\gdef\\GITAbrHash{" AbrHash "}%"
|
|
||||||
print "\\gdef\\GITParentHashes{" ParentHashes "}%"
|
|
||||||
print "\\gdef\\GITAbrParentHashes{" AbrParentHashes "}%"
|
|
||||||
print "\\gdef\\GITAuthorName{" AuthorName "}%"
|
|
||||||
print "\\gdef\\GITAuthorEmail{" AuthorEmail "}%"
|
|
||||||
print "\\gdef\\GITAuthorDate{" AuthorDate "}%"
|
|
||||||
print "\\gdef\\GITCommitterName{" CommitterName "}%"
|
|
||||||
print "\\gdef\\GITCommitterEmail{" CommitterEmail "}%"
|
|
||||||
print "\\gdef\\GITCommitterDate{" CommitterDate "}%"
|
|
||||||
### Write generic version control macros.
|
|
||||||
print "%%% Define generic version control macros."
|
|
||||||
print "\\gdef\\VCRevision{\\GITAbrHash}%"
|
|
||||||
print "\\gdef\\VCAuthor{\\GITAuthorName}%"
|
|
||||||
print "\\gdef\\VCDateRAW{" DateRAW "}%"
|
|
||||||
print "\\gdef\\VCDateISO{" DateISO "}%"
|
|
||||||
print "\\gdef\\VCDateTEX{" DateTEX "}%"
|
|
||||||
print "\\gdef\\VCTime{" Time "}%"
|
|
||||||
print "\\gdef\\VCModifiedText{\\textcolor{red}{with local modifications!}}%"
|
|
||||||
print "%%% Assume clean working copy."
|
|
||||||
print "\\gdef\\VCModified{0}%"
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
|
||||||
}
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
if (script=="status") {
|
|
||||||
print "%%% Is working copy modified?"
|
|
||||||
print "\\gdef\\VCModified{" modified "}%"
|
|
||||||
if (modified==0) {
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
|
||||||
} else {
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
paper_template/resources/vc-git.awk
Symbolic link
1
paper_template/resources/vc-git.awk
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git.awk
|
||||||
24
resources/vc-git
Executable file
24
resources/vc-git
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This is file 'vc' from the vc bundle for TeX.
|
||||||
|
# The original file can be found at CTAN:support/vc.
|
||||||
|
# This file is Public Domain.
|
||||||
|
|
||||||
|
# Parse command line options.
|
||||||
|
full=0
|
||||||
|
mod=0
|
||||||
|
while [ -n "$(echo $1 | grep '-')" ]; do
|
||||||
|
case $1 in
|
||||||
|
-f ) full=1 ;;
|
||||||
|
-m ) mod=1 ;;
|
||||||
|
* ) echo 'usage: vc [-f] [-m]'
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
# English locale.
|
||||||
|
LC_ALL=C
|
||||||
|
git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %ai%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %ci%n" |gawk -v script=log -v full=$full -f ./resources/vc-git.awk > vc
|
||||||
|
if [ "$mod" = 1 ]
|
||||||
|
then
|
||||||
|
git status |gawk -v script=status -f ./resources/vc-git.awk >> vc
|
||||||
|
fi
|
||||||
89
resources/vc-git.awk
Normal file
89
resources/vc-git.awk
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# This is file 'vc-git.awk' from the vc bundle for TeX.
|
||||||
|
# The original file can be found at CTAN:support/vc.
|
||||||
|
# This file is Public Domain.
|
||||||
|
BEGIN {
|
||||||
|
|
||||||
|
### Process output of "git status".
|
||||||
|
if (script=="status") {
|
||||||
|
modified = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Process output of "git log".
|
||||||
|
script=="log" && /^Hash:/ { Hash = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Abr. Hash:/ { AbrHash = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Parent Hashes:/ { ParentHashes = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Abr. Parent Hashes:/ { AbrParentHashes = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Author Name:/ { AuthorName = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Author Email:/ { AuthorEmail = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Author Date:/ { AuthorDate = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Committer Name:/ { CommitterName = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Committer Email:/ { CommitterEmail = substr($0, 2+match($0, ":")) }
|
||||||
|
script=="log" && /^Committer Date:/ { CommitterDate = substr($0, 2+match($0, ":")) }
|
||||||
|
|
||||||
|
### Process output of "git status".
|
||||||
|
### Changed index?
|
||||||
|
script=="status" && /^# Changes to be committed:/ { modified = 1 }
|
||||||
|
### Unstaged modifications?
|
||||||
|
script=="status" && /^# Changed but not updated:/ { modified = 2 }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
END {
|
||||||
|
|
||||||
|
### Process output of "git log".
|
||||||
|
if (script=="log") {
|
||||||
|
### Standard encoding is UTF-8.
|
||||||
|
if (Encoding == "") Encoding = "UTF-8"
|
||||||
|
### Extract relevant information from variables.
|
||||||
|
LongDate = substr(AuthorDate, 1, 25)
|
||||||
|
DateRAW = substr(LongDate, 1, 10)
|
||||||
|
DateISO = DateRAW
|
||||||
|
DateTEX = DateISO
|
||||||
|
gsub("-", "/", DateTEX)
|
||||||
|
Time = substr(LongDate, 12, 14)
|
||||||
|
### Write file identification to vc.tex.
|
||||||
|
print "%%% This file has been generated by the vc bundle for TeX."
|
||||||
|
print "%%% Do not edit this file!"
|
||||||
|
print "%%%"
|
||||||
|
### Write Git specific macros.
|
||||||
|
print "%%% Define Git specific macros."
|
||||||
|
print "\\gdef\\GITHash{" Hash "}%"
|
||||||
|
print "\\gdef\\GITAbrHash{" AbrHash "}%"
|
||||||
|
print "\\gdef\\GITParentHashes{" ParentHashes "}%"
|
||||||
|
print "\\gdef\\GITAbrParentHashes{" AbrParentHashes "}%"
|
||||||
|
print "\\gdef\\GITAuthorName{" AuthorName "}%"
|
||||||
|
print "\\gdef\\GITAuthorEmail{" AuthorEmail "}%"
|
||||||
|
print "\\gdef\\GITAuthorDate{" AuthorDate "}%"
|
||||||
|
print "\\gdef\\GITCommitterName{" CommitterName "}%"
|
||||||
|
print "\\gdef\\GITCommitterEmail{" CommitterEmail "}%"
|
||||||
|
print "\\gdef\\GITCommitterDate{" CommitterDate "}%"
|
||||||
|
### Write generic version control macros.
|
||||||
|
print "%%% Define generic version control macros."
|
||||||
|
print "\\gdef\\VCRevision{\\GITAbrHash}%"
|
||||||
|
print "\\gdef\\VCAuthor{\\GITAuthorName}%"
|
||||||
|
print "\\gdef\\VCDateRAW{" DateRAW "}%"
|
||||||
|
print "\\gdef\\VCDateISO{" DateISO "}%"
|
||||||
|
print "\\gdef\\VCDateTEX{" DateTEX "}%"
|
||||||
|
print "\\gdef\\VCTime{" Time "}%"
|
||||||
|
print "\\gdef\\VCModifiedText{\\textcolor{red}{with local modifications!}}%"
|
||||||
|
print "%%% Assume clean working copy."
|
||||||
|
print "\\gdef\\VCModified{0}%"
|
||||||
|
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
||||||
|
}
|
||||||
|
|
||||||
|
### Process output of "git status".
|
||||||
|
if (script=="status") {
|
||||||
|
print "%%% Is working copy modified?"
|
||||||
|
print "\\gdef\\VCModified{" modified "}%"
|
||||||
|
if (modified==0) {
|
||||||
|
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
||||||
|
} else {
|
||||||
|
print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# This is file 'vc' from the vc bundle for TeX.
|
|
||||||
# The original file can be found at CTAN:support/vc.
|
|
||||||
# This file is Public Domain.
|
|
||||||
|
|
||||||
# Parse command line options.
|
|
||||||
full=0
|
|
||||||
mod=0
|
|
||||||
while [ -n "$(echo $1 | grep '-')" ]; do
|
|
||||||
case $1 in
|
|
||||||
-f ) full=1 ;;
|
|
||||||
-m ) mod=1 ;;
|
|
||||||
* ) echo 'usage: vc [-f] [-m]'
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
# English locale.
|
|
||||||
LC_ALL=C
|
|
||||||
git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %ai%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %ci%n" |gawk -v script=log -v full=$full -f ./resources/vc-git.awk > vc
|
|
||||||
if [ "$mod" = 1 ]
|
|
||||||
then
|
|
||||||
git status |gawk -v script=status -f ~/bin/vc-git.awk >> vc
|
|
||||||
fi
|
|
||||||
1
slides_template/resources/vc-git
Symbolic link
1
slides_template/resources/vc-git
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
# This is file 'vc-git.awk' from the vc bundle for TeX.
|
|
||||||
# The original file can be found at CTAN:support/vc.
|
|
||||||
# This file is Public Domain.
|
|
||||||
BEGIN {
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
if (script=="status") {
|
|
||||||
modified = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Process output of "git log".
|
|
||||||
script=="log" && /^Hash:/ { Hash = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Abr. Hash:/ { AbrHash = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Parent Hashes:/ { ParentHashes = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Abr. Parent Hashes:/ { AbrParentHashes = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Name:/ { AuthorName = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Email:/ { AuthorEmail = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Author Date:/ { AuthorDate = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Name:/ { CommitterName = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Email:/ { CommitterEmail = substr($0, 2+match($0, ":")) }
|
|
||||||
script=="log" && /^Committer Date:/ { CommitterDate = substr($0, 2+match($0, ":")) }
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
### Changed index?
|
|
||||||
script=="status" && /^# Changes to be committed:/ { modified = 1 }
|
|
||||||
### Unstaged modifications?
|
|
||||||
script=="status" && /^# Changed but not updated:/ { modified = 2 }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
END {
|
|
||||||
|
|
||||||
### Process output of "git log".
|
|
||||||
if (script=="log") {
|
|
||||||
### Standard encoding is UTF-8.
|
|
||||||
if (Encoding == "") Encoding = "UTF-8"
|
|
||||||
### Extract relevant information from variables.
|
|
||||||
LongDate = substr(AuthorDate, 1, 25)
|
|
||||||
DateRAW = substr(LongDate, 1, 10)
|
|
||||||
DateISO = DateRAW
|
|
||||||
DateTEX = DateISO
|
|
||||||
gsub("-", "/", DateTEX)
|
|
||||||
Time = substr(LongDate, 12, 14)
|
|
||||||
### Write file identification to vc.tex.
|
|
||||||
print "%%% This file has been generated by the vc bundle for TeX."
|
|
||||||
print "%%% Do not edit this file!"
|
|
||||||
print "%%%"
|
|
||||||
### Write Git specific macros.
|
|
||||||
print "%%% Define Git specific macros."
|
|
||||||
print "\\gdef\\GITHash{" Hash "}%"
|
|
||||||
print "\\gdef\\GITAbrHash{" AbrHash "}%"
|
|
||||||
print "\\gdef\\GITParentHashes{" ParentHashes "}%"
|
|
||||||
print "\\gdef\\GITAbrParentHashes{" AbrParentHashes "}%"
|
|
||||||
print "\\gdef\\GITAuthorName{" AuthorName "}%"
|
|
||||||
print "\\gdef\\GITAuthorEmail{" AuthorEmail "}%"
|
|
||||||
print "\\gdef\\GITAuthorDate{" AuthorDate "}%"
|
|
||||||
print "\\gdef\\GITCommitterName{" CommitterName "}%"
|
|
||||||
print "\\gdef\\GITCommitterEmail{" CommitterEmail "}%"
|
|
||||||
print "\\gdef\\GITCommitterDate{" CommitterDate "}%"
|
|
||||||
### Write generic version control macros.
|
|
||||||
print "%%% Define generic version control macros."
|
|
||||||
print "\\gdef\\VCRevision{\\GITAbrHash}%"
|
|
||||||
print "\\gdef\\VCAuthor{\\GITAuthorName}%"
|
|
||||||
print "\\gdef\\VCDateRAW{" DateRAW "}%"
|
|
||||||
print "\\gdef\\VCDateISO{" DateISO "}%"
|
|
||||||
print "\\gdef\\VCDateTEX{" DateTEX "}%"
|
|
||||||
print "\\gdef\\VCTime{" Time "}%"
|
|
||||||
print "\\gdef\\VCModifiedText{\\textcolor{red}{with local modifications!}}%"
|
|
||||||
print "%%% Assume clean working copy."
|
|
||||||
print "\\gdef\\VCModified{0}%"
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
|
||||||
}
|
|
||||||
|
|
||||||
### Process output of "git status".
|
|
||||||
if (script=="status") {
|
|
||||||
print "%%% Is working copy modified?"
|
|
||||||
print "\\gdef\\VCModified{" modified "}%"
|
|
||||||
if (modified==0) {
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision}%"
|
|
||||||
} else {
|
|
||||||
print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
1
slides_template/resources/vc-git.awk
Symbolic link
1
slides_template/resources/vc-git.awk
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../resources/vc-git.awk
|
||||||
Reference in New Issue
Block a user