make head stop waiting for input
===

I'm developing "custom grep" wrapper for git. It shows first line of the file matching pattern. This line expected to be the header of the file.

I've created alias and everything went OK, until I tried search for pattern, which cannot be found in the working folder. Since no files were found, `head` and `sed` commands has nothing to work with and command hands and waits for input.

How to prevent this? I would like script to interrupt if no input is given. Definitely I could create separate script, assign list of files to variable and check length of this variable. But I would prefer sweet & neat oneliner-alias. 

Is it possible? Here is my `.gitconfig` alias section:

    [alias]	
        gg = !sh -c 'head -n1 -q `git grep --name-only $0` | sed s/OBJECT.//'
