Further easier IMHO will use git blame:
git blame $ref -L'/search_pattern/,+1' filename(s)
Full example in my zfs-fuse repository:
$ git for-each-ref --format='%(refname)' -- refs/heads |
while read ref;
do git blame $ref -L'/push/,+1' zfs_operations.c;
done
, ; , , . :
f5370a5e (Emmanuel Anne 2011-02-22 20:53:17 +0100 1492) static void push(zfsvfs_t *zfsvfs, cred_t *cred, fuse_ino_t ino, file_info_t *info, const char *buf, size_t size, off_t off)
f5370a5e (Emmanuel Anne 2011-02-22 20:53:17 +0100 1512) static void push(zfsvfs_t *zfsvfs, cred_t *cred, fuse_ino_t ino, file_info_t *info, const char *buf, size_t size, off_t off)
f5370a5e (Emmanuel Anne 2011-02-22 20:53:17 +0100 1512) static void push(zfsvfs_t *zfsvfs, cred_t *cred, fuse_ino_t ino, file_info_t *info, const char *buf, size_t size, off_t off)
(1492 1512):
f5370a5e (Emmanuel Anne 2011-02-22 20:53:17 +0100 1512) void push (zfsvfs_t * zfsvfs, cred_t * cred, fuse_ino_t ino, file_info_t * info, const char * buf, size_t size, off_t off)
, ,
fatal: -L parameter 'push': No match
:
-M (detect moved lines)
-n (show source line number)
-f (show filename, especially handy with -C)
-p /