#!/bin/sh # Annotate files in git with versions # # Copyright (C) 2010 Jean Delvare # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details: # http://www.gnu.org/copyleft/gpl.html # # The latest official version of this script can be found at: # ftp://ftp.kernel.org/pub/linux/kernel/people/jdelvare/scripts/git-annotate-with-tags if [ -z "$1" ] then echo "File?" exit 1 fi # Replace commit IDs with symbolic names, then strip symbolic names # to tags, and finally strip the -rc part of tags. git blame -l "$1" | \ git name-rev --tags --name-only --stdin | \ sed -e 's/^\([^~ ]*\)~[^ ]*/\1/' -e 's/^\([^ ]*\)-rc[0-9][0-9]*/\1/'