From: Michael J Gruber Date: Thu, 21 Jan 2010 09:42:19 GMT Subject: Re: git locate Message-ID: <4B58217B.4040205@drmicha.warpmail.net> In-Reply-To: <4B579BA8.8050000@gmail.com> SungHyun Nam venit, vidit, dixit 21.01.2010 01:11: > Hello, > > Johannes Schindelin wrote: >> >> On Tue, 19 Jan 2010, Jakub Narebski wrote: >> >>> Johannes Schindelin writes: >>> >>>> On Wed, 20 Jan 2010, John Tapsell wrote: >>>> >>>>> Could we add a: git locate or git find >>>> >>>> How about "git ls-files \*"? >>> >>> Or "git ls-files '*filename'... >>> >>> ... but how to make an (git) alias for this? >> >> Add something like this to your $HOME/.gitconfig: >> >> [alias] >> locate = !sh -c 'git ls-files "\\*$1"' - > > The alias 'git locate' and the command 'git ls-files' runs > differently if I run them in a subdirectory. > Is it expected? > > [master] ~/srcs/git[299]$ git locate urls.txt > Documentation/urls.txt > [master] ~/srcs/git[300]$ git ls-files '*urls.txt' > Documentation/urls.txt > [master] ~/srcs/git[301]$ cd t > [master] ~/srcs/git/t[302]$ git locate urls.txt > Documentation/urls.txt > [master] ~/srcs/git/t[303]$ git ls-files '*urls.txt' > [master] ~/srcs/git/t[304]$ Yes, aliases with "!" are executed from the root of the worktree, ls-files from the current wd. Michael