Skip to content

Commit

Permalink
add default hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed Dec 20, 2023
1 parent 507a9c5 commit 4dcde16
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .config/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# Post-{commit,checkout,merge} hook for the gitinfo package.
#
# This file is adapted from the original post-xxx hook by
# Brent Longborough and distributed as part of the gitinfo package.
# The original file may be obtained from
# http://www.ctan.org/tex-archive/macros/latex/contrib/gitinfo
#
# The only difference with the original file resides in the definition of
# the 'prefixes' variable.
#
prefixes="paper"
for pref in $prefixes
do
git log -1 --date=short \
--pretty=format:"\usepackage[%
shash={%h},
lhash={%H},
authname={%an},
authemail={%ae},
authsdate={%ad},
authidate={%ai},
authudate={%at},
commname={%an},
commemail={%ae},
commsdate={%ad},
commidate={%ai},
commudate={%at},
refnames={%d}
]{gitsetinfo}" HEAD > $pref/gitHeadInfo.gin
done
31 changes: 31 additions & 0 deletions .config/hooks/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# Post-{commit,checkout,merge} hook for the gitinfo package.
#
# This file is adapted from the original post-xxx hook by
# Brent Longborough and distributed as part of the gitinfo package.
# The original file may be obtained from
# http://www.ctan.org/tex-archive/macros/latex/contrib/gitinfo
#
# The only difference with the original file resides in the definition of
# the 'prefixes' variable.
#
prefixes="paper"
for pref in $prefixes
do
git log -1 --date=short \
--pretty=format:"\usepackage[%
shash={%h},
lhash={%H},
authname={%an},
authemail={%ae},
authsdate={%ad},
authidate={%ai},
authudate={%at},
commname={%an},
commemail={%ae},
commsdate={%ad},
commidate={%ai},
commudate={%at},
refnames={%d}
]{gitsetinfo}" HEAD > $pref/gitHeadInfo.gin
done
31 changes: 31 additions & 0 deletions .config/hooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# Post-{commit,checkout,merge} hook for the gitinfo package.
#
# This file is adapted from the original post-xxx hook by
# Brent Longborough and distributed as part of the gitinfo package.
# The original file may be obtained from
# http://www.ctan.org/tex-archive/macros/latex/contrib/gitinfo
#
# The only difference with the original file resides in the definition of
# the 'prefixes' variable.
#
prefixes="paper"
for pref in $prefixes
do
git log -1 --date=short \
--pretty=format:"\usepackage[%
shash={%h},
lhash={%H},
authname={%an},
authemail={%ae},
authsdate={%ad},
authidate={%ai},
authudate={%at},
commname={%an},
commemail={%ae},
commsdate={%ad},
commidate={%ai},
commudate={%at},
refnames={%d}
]{gitsetinfo}" HEAD > $pref/gitHeadInfo.gin
done
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
2. Fork this repository to your GitHub account.
3. Clone your fork with `git clone https://github.com/<your-github-id>/report.git`.
4. Add the original repository as a remote so you can pull updates in the future with `git remote add upstream https://github.com/dpo/report.git`.
5. Install the git hooks with `cp .config/hooks/* .git/hooks/ && chmod +x .git/hooks/*`.

## GitHub Actions

Expand Down

0 comments on commit 4dcde16

Please sign in to comment.