I've created some bash functions which handle tagging some files with
revision information, but even after reading the git manual I'm not
really sure how to integrate them so that they remove revision expansion
before each check-in (to avoid cluttering the repository with keyword
substitutions), and add them back (with the current commit info) after
each commit.
These are the functions:
# Show some kind of useful revision string, like the RCS $Id$ string. I
# think commit hash, filename, hostname containing the repository, and
# timestamp should be plenty of information to track down a given file.
git-id () {
for file in "$@"; do
_date=$(date +'%F %T %Z')
git log -1 \
--pretty=format:"[%h] \"$file\" $(hostname -f) ($_date)" \
"$file"
done
}
# Replace the $Id$ keyword string in the file itself.
git-export () {
for file in "$@"; do
echo Modifying $file...
_id=$(git-id "$file")
sed -ri 's/\$(Id|Revision).*\$/$Id: '"$_id"' $/' "$file"
done
}
# Clean the $Id$ keyword string to prevent cluttering the repository
# with keyword-revision diffs when we check the file back in.
git-unexport () {
for file in "$@"; do
echo Resetting $file...
sed -ri 's/\$Id.*\$/$Id$/' "$file"
done
}
How do I hook this in the way I want so that it's handled automatically?
--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Linus Torvalds | Re: O_DIRECT question |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Dave Airlie | Re: [2.6.25-rc6] possible regression: X server dying |
| Florian Schmidt | blacklist kernel boot option |
git: | |
| Petr Baudis | repo.or.cz wishes? |
| Jon Smirl | ! [rejected] master -> master (non-fast forward) |
| Matthieu Moy | [BUG] git-svn dcommit fails (connection closed unexpectedly) |
| Jakub Narebski | Git User's Survey 2007 partial summary |
| Ondřej Surý | openbgp not exporing ipv6 to routing tables |
| Nick Guenther | Re: Real men don't attack straw men |
| Christophe Rioux | OpenBSD as host for VMWare Server |
| Bambero | two wan interfaces |
| Warner Losh | Re: SMP re-eetrancy in "bottom half" drivers |
| Martin Husemann | Re: Prototype kernel continuation-passing for NetBSD |
| Martin Husemann | Dynamic registry of ehternet frame types |
| der Mouse | Re: file id alignment |
