{"thread":{"id":"22296","subject":"git locate","startedAt":"2010-01-20T01:17:17Z","lastAt":"2010-06-03T13:39:50Z","messageCount":17,"participants":["John Tapsell","Johannes Schindelin","Jakub Narebski","SungHyun Nam","Michael J Gruber","Štěpán Němec","Sverre Rabbelier","Bruce Stephens","Matthieu Moy","Nguyen Thai Ngoc Duy","Clemens Buchacher"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"132157","messageId":"43d8ce651001191717l58d10919j691f4e5b056fe9b5@mail.gmail.com","threadId":"22296","inReplyTo":null,"subject":"git locate","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2010-01-20T01:17:17Z","receivedAt":"2010-01-20T01:17:17Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"Hey all,\n\n  Could we add a:  git locate <filename>       or git find <filename>\n that is just an alias to \"git ls-files | grep filename\" ?\n\nReasons:\n\n1) git ls-files   does not autocomplete, since it's an low-level\nplumbing command\n2) It's nice having shell equivalents - e.g.  git grep etc\n\nJohn\n"},{"id":"132159","messageId":"alpine.DEB.1.00.1001200224270.4985@pacific.mpi-cbg.de","threadId":"22296","inReplyTo":"43d8ce651001191717l58d10919j691f4e5b056fe9b5@mail.gmail.com","subject":"Re: git locate","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-01-20T01:24:47Z","receivedAt":"2010-01-20T01:24:47Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 20 Jan 2010, John Tapsell wrote:\n\n>   Could we add a:  git locate <filename>       or git find <filename>\n\nHow about \"git ls-files \\*<filename>\"?\n\nCiao,\nDscho\n"},{"id":"132161","messageId":"m3zl49bk0o.fsf@localhost.localdomain","threadId":"22296","inReplyTo":"alpine.DEB.1.00.1001200224270.4985@pacific.mpi-cbg.de","subject":"Re: git locate","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-01-20T02:14:46Z","receivedAt":"2010-01-20T02:14:46Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> On Wed, 20 Jan 2010, John Tapsell wrote:\n> \n> >   Could we add a:  git locate <filename>       or git find <filename>\n> \n> How about \"git ls-files \\*<filename>\"?\n\nOr \"git ls-files '*filename'...\n\n... but how to make an (git) alias for this?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"132171","messageId":"alpine.DEB.1.00.1001201021060.31129@intel-tinevez-2-302","threadId":"22296","inReplyTo":"m3zl49bk0o.fsf@localhost.localdomain","subject":"Re: git locate","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-01-20T09:32:10Z","receivedAt":"2010-01-20T09:32:10Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 19 Jan 2010, Jakub Narebski wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > On Wed, 20 Jan 2010, John Tapsell wrote:\n> > \n> > >   Could we add a:  git locate <filename>       or git find <filename>\n> > \n> > How about \"git ls-files \\*<filename>\"?\n> \n> Or \"git ls-files '*filename'...\n> \n> ... but how to make an (git) alias for this?\n\nAdd something like this to your $HOME/.gitconfig:\n\n[alias]\n        locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n\nCiao,\nDscho\n"},{"id":"132178","messageId":"201001201106.20739.jnareb@gmail.com","threadId":"22296","inReplyTo":"alpine.DEB.1.00.1001201021060.31129@intel-tinevez-2-302","subject":"Re: git locate","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-01-20T10:06:19Z","receivedAt":"2010-01-20T10:06:19Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 20 Jan 2010, Johannes Schindelin wrote:\n> On Tue, 19 Jan 2010, Jakub Narebski wrote:\n>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>>> On Wed, 20 Jan 2010, John Tapsell wrote:\n>>> \n>>>>   Could we add a:  git locate <filename>       or git find <filename>\n>>> \n>>> How about \"git ls-files \\*<filename>\"?\n>> \n>> Or \"git ls-files '*filename'...\n>> \n>> ... but how to make an (git) alias for this?\n> \n> Add something like this to your $HOME/.gitconfig:\n> \n> [alias]\n>         locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n\nThanks a lot, Dscho!\n\n\nI think it would be nice to have this trick \n\n  alias.<cmd> = !sh -c '<commands with $1, $@, $#>' -\n\ndescribed in git-config (alias) documentation.  Unfortunately I don't\nunderstand this trick well enough to do it myself...\n\n-- \nJakub Narebski\nPoland\n"},{"id":"132187","messageId":"43d8ce651001200307r651a6a54ib298c4b708016b11@mail.gmail.com","threadId":"22296","inReplyTo":"201001201106.20739.jnareb@gmail.com","subject":"Re: git locate","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2010-01-20T11:07:05Z","receivedAt":"2010-01-20T11:07:05Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"2010/1/20 Jakub Narebski <jnareb@gmail.com>:\n> On Wed, 20 Jan 2010, Johannes Schindelin wrote:\n>> On Tue, 19 Jan 2010, Jakub Narebski wrote:\n>>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>>>> On Wed, 20 Jan 2010, John Tapsell wrote:\n>>>>\n>>>>>   Could we add a:  git locate <filename>       or git find <filename>\n>>>>\n>>>> How about \"git ls-files \\*<filename>\"?\n>>>\n>>> Or \"git ls-files '*filename'...\n>>>\n>>> ... but how to make an (git) alias for this?\n>>\n>> Add something like this to your $HOME/.gitconfig:\n>>\n>> [alias]\n>>         locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n>\n\nI think having this alias by default would be very nice though - it's\npretty common to locate/find files, and it's nice to have unixy\nequivalents in git.\n\nIf this really isn't wanted, then perhaps the ls-files command should\nbe bash auto-completed?\n\nThanks!\n\nJohn\n"},{"id":"132189","messageId":"alpine.DEB.1.00.1001201238370.31129@intel-tinevez-2-302","threadId":"22296","inReplyTo":"201001201106.20739.jnareb@gmail.com","subject":"Re: git locate","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-01-20T11:43:21Z","receivedAt":"2010-01-20T11:43:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 20 Jan 2010, Jakub Narebski wrote:\n\n> On Wed, 20 Jan 2010, Johannes Schindelin wrote:\n> > On Tue, 19 Jan 2010, Jakub Narebski wrote:\n> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> >>> On Wed, 20 Jan 2010, John Tapsell wrote:\n> >>> \n> >>>>   Could we add a:  git locate <filename>       or git find <filename>\n> >>> \n> >>> How about \"git ls-files \\*<filename>\"?\n> >> \n> >> Or \"git ls-files '*filename'...\n> >> \n> >> ... but how to make an (git) alias for this?\n> > \n> > Add something like this to your $HOME/.gitconfig:\n> > \n> > [alias]\n> >         locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n> \n> Thanks a lot, Dscho!\n> \n> \n> I think it would be nice to have this trick \n> \n>   alias.<cmd> = !sh -c '<commands with $1, $@, $#>' -\n\nHeh.  I initially read @$^&*#^&*@#$.\n\n> described in git-config (alias) documentation.  Unfortunately I don't \n> understand this trick well enough to do it myself...\n\nI tried to explain things properly in\n\nhttp://git.wiki.kernel.org/index.php/Aliases#Advanced_aliases_with_arguments\n\nCiao,\nDscho\n"},{"id":"132245","messageId":"4B579BA8.8050000@gmail.com","threadId":"22296","inReplyTo":"alpine.DEB.1.00.1001201021060.31129@intel-tinevez-2-302","subject":"Re: git locate","fromName":"SungHyun Nam","fromEmail":"goweol@gmail.com","sentAt":"2010-01-21T00:11:20Z","receivedAt":"2010-01-21T00:11:20Z","isPatch":false,"sender":{"key":"goweol@gmail.com","avatar":null},"body":"Hello,\n\nJohannes Schindelin wrote:\n>\n> On Tue, 19 Jan 2010, Jakub Narebski wrote:\n>\n>> Johannes Schindelin<Johannes.Schindelin@gmx.de>  writes:\n>>\n>>> On Wed, 20 Jan 2010, John Tapsell wrote:\n>>>\n>>>>    Could we add a:  git locate<filename>        or git find<filename>\n>>>\n>>> How about \"git ls-files \\*<filename>\"?\n>>\n>> Or \"git ls-files '*filename'...\n>>\n>> ... but how to make an (git) alias for this?\n>\n> Add something like this to your $HOME/.gitconfig:\n>\n> [alias]\n>          locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n\nThe alias 'git locate' and the command 'git ls-files' runs\ndifferently if I run them in a subdirectory.\nIs it expected?\n\n[master] ~/srcs/git[299]$ git locate urls.txt\nDocumentation/urls.txt\n[master] ~/srcs/git[300]$ git ls-files '*urls.txt'\nDocumentation/urls.txt\n[master] ~/srcs/git[301]$ cd t\n[master] ~/srcs/git/t[302]$ git locate urls.txt\nDocumentation/urls.txt\n[master] ~/srcs/git/t[303]$ git ls-files '*urls.txt'\n[master] ~/srcs/git/t[304]$\n\nThanks,\nnamsh\n"},{"id":"132288","messageId":"4B58217B.4040205@drmicha.warpmail.net","threadId":"22296","inReplyTo":"4B579BA8.8050000@gmail.com","subject":"Re: git locate","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-01-21T09:42:19Z","receivedAt":"2010-01-21T09:42:19Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"SungHyun Nam venit, vidit, dixit 21.01.2010 01:11:\n> Hello,\n> \n> Johannes Schindelin wrote:\n>>\n>> On Tue, 19 Jan 2010, Jakub Narebski wrote:\n>>\n>>> Johannes Schindelin<Johannes.Schindelin@gmx.de>  writes:\n>>>\n>>>> On Wed, 20 Jan 2010, John Tapsell wrote:\n>>>>\n>>>>>    Could we add a:  git locate<filename>        or git find<filename>\n>>>>\n>>>> How about \"git ls-files \\*<filename>\"?\n>>>\n>>> Or \"git ls-files '*filename'...\n>>>\n>>> ... but how to make an (git) alias for this?\n>>\n>> Add something like this to your $HOME/.gitconfig:\n>>\n>> [alias]\n>>          locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n> \n> The alias 'git locate' and the command 'git ls-files' runs\n> differently if I run them in a subdirectory.\n> Is it expected?\n> \n> [master] ~/srcs/git[299]$ git locate urls.txt\n> Documentation/urls.txt\n> [master] ~/srcs/git[300]$ git ls-files '*urls.txt'\n> Documentation/urls.txt\n> [master] ~/srcs/git[301]$ cd t\n> [master] ~/srcs/git/t[302]$ git locate urls.txt\n> Documentation/urls.txt\n> [master] ~/srcs/git/t[303]$ git ls-files '*urls.txt'\n> [master] ~/srcs/git/t[304]$\n\nYes, aliases with \"!\" are executed from the root of the worktree,\nls-files from the current wd.\n\nMichael\n"},{"id":"132289","messageId":"20100121095137.GB7370@headley","threadId":"22296","inReplyTo":"4B579BA8.8050000@gmail.com","subject":"Re: git locate","fromName":"Štěpán Němec","fromEmail":"stepnem@gmail.com","sentAt":"2010-01-21T09:51:37Z","receivedAt":"2010-01-21T09:51:37Z","isPatch":false,"sender":{"key":"stepnem@gmail.com","avatar":"https://avatars.githubusercontent.com/u/106838?v=4"},"body":"On Thu, Jan 21, 2010 at 09:11:20AM +0900, SungHyun Nam wrote:\n> Hello,\n> \n> Johannes Schindelin wrote:\n> >\n> >On Tue, 19 Jan 2010, Jakub Narebski wrote:\n> >\n> >>Johannes Schindelin<Johannes.Schindelin@gmx.de>  writes:\n> >>\n> >>>On Wed, 20 Jan 2010, John Tapsell wrote:\n> >>>\n> >>>>   Could we add a:  git locate<filename>        or git find<filename>\n> >>>\n> >>>How about \"git ls-files \\*<filename>\"?\n> >>\n> >>Or \"git ls-files '*filename'...\n> >>\n> >>... but how to make an (git) alias for this?\n> >\n> >Add something like this to your $HOME/.gitconfig:\n> >\n> >[alias]\n> >         locate = !sh -c 'git ls-files \"\\\\*$1\"' -\n> \n> The alias 'git locate' and the command 'git ls-files' runs\n> differently if I run them in a subdirectory.\n> Is it expected?\n> \n> [master] ~/srcs/git[299]$ git locate urls.txt\n> Documentation/urls.txt\n> [master] ~/srcs/git[300]$ git ls-files '*urls.txt'\n> Documentation/urls.txt\n> [master] ~/srcs/git[301]$ cd t\n> [master] ~/srcs/git/t[302]$ git locate urls.txt\n> Documentation/urls.txt\n> [master] ~/srcs/git/t[303]$ git ls-files '*urls.txt'\n> [master] ~/srcs/git/t[304]$\n\nYeah, as stated in another part of the Wiki page Dscho referred to\n(namely the \"Serve repo on the spot\" section):\n\n\"It makes use of the fact that (currently, as of git 1.5.6.1) non-git\nalias are executed from the top-level dir of a repo.\"\n\n(\"non-git\" == those starting with \"!\", which is the case here)\n\n\n    Štěpán\n"},{"id":"134639","messageId":"fabb9a1e1002150520v29cf8d59ke27cde3e9697b011@mail.gmail.com","threadId":"22296","inReplyTo":"4B579BA8.8050000@gmail.com","subject":"Re: git locate","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-02-15T13:20:35Z","receivedAt":"2010-02-15T13:20:35Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Thu, Jan 21, 2010 at 01:11, SungHyun Nam <goweol@gmail.com> wrote:\n> The alias 'git locate' and the command 'git ls-files' runs\n> differently if I run them in a subdirectory.\n> Is it expected?\n\nI just ran into this (I wanted to alias 'git find' but to me the 'run\nls-files from cwd' is desirable. Also, I prefer to have a trailing\nglob as well, so I added one :). An easy solution is to drop\n'git-find' in your path somewhere:\n\nsverre@laptop-sverre:~/bin$ cat git-find\n#!/bin/bash\n\ngit ls-files \"*$1*\"\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"142767","messageId":"AANLkTim6cLkr5BFTRTh2nZGwsfVgHZi3M-b9IER8dHf3@mail.gmail.com","threadId":"22296","inReplyTo":"fabb9a1e1002150520v29cf8d59ke27cde3e9697b011@mail.gmail.com","subject":"Re: git locate","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2010-06-02T05:00:27Z","receivedAt":"2010-06-02T05:00:27Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"On 15 February 2010 22:20, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Thu, Jan 21, 2010 at 01:11, SungHyun Nam <goweol@gmail.com> wrote:\n>> The alias 'git locate' and the command 'git ls-files' runs\n>> differently if I run them in a subdirectory.\n>> Is it expected?\n>\n> I just ran into this (I wanted to alias 'git find' but to me the 'run\n> ls-files from cwd' is desirable. Also, I prefer to have a trailing\n> glob as well, so I added one :). An easy solution is to drop\n> 'git-find' in your path somewhere:\n\nI have finally settled on:\n\n[alias]\n    locate = !sh -c 'git ls-files | grep --color=auto \"$1\"' -\n\nThis acts as if there is a leading and trailing wildcard, and also\ncolors the output nicely.\n\nCan we add this as default please?  There didn't seem to be any\nresistance in this thread to making it default, just that nobody did\nit :)\n\nJohn\n"},{"id":"142807","messageId":"AANLkTil38OLw3J6ZPvv2wNu98QuTXJKtNwRZP0NDZPWn@mail.gmail.com","threadId":"22296","inReplyTo":"AANLkTim6cLkr5BFTRTh2nZGwsfVgHZi3M-b9IER8dHf3@mail.gmail.com","subject":"Re: git locate","fromName":"John Tapsell","fromEmail":"johnflux@gmail.com","sentAt":"2010-06-02T10:02:00Z","receivedAt":"2010-06-02T10:02:00Z","isPatch":false,"sender":{"key":"johnflux@gmail.com","avatar":"https://gravatar.com/avatar/25f70d4c0f96396b84a2e34bcd9bdc233462c7b4be29b5fdca8266fc53f30b0c?d=mp&s=160"},"body":"On 2 June 2010 14:00, John Tapsell <johnflux@gmail.com> wrote:\n> On 15 February 2010 22:20, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n>> Heya,\n>>\n>> On Thu, Jan 21, 2010 at 01:11, SungHyun Nam <goweol@gmail.com> wrote:\n>>> The alias 'git locate' and the command 'git ls-files' runs\n>>> differently if I run them in a subdirectory.\n>>> Is it expected?\n>>\n>> I just ran into this (I wanted to alias 'git find' but to me the 'run\n>> ls-files from cwd' is desirable. Also, I prefer to have a trailing\n>> glob as well, so I added one :). An easy solution is to drop\n>> 'git-find' in your path somewhere:\n>\n> I have finally settled on:\n>\n> [alias]\n>    locate = !sh -c 'git ls-files | grep --color=auto \"$1\"' -\n\n\nActually could someone help me with this.. the trouble is that this\nreturns paths relative to the root.\n\nCan I get it to find all the files, but relative to where I am now?\n\nJohn\n"},{"id":"142809","messageId":"80y6ex3f8b.fsf@tiny.isode.net","threadId":"22296","inReplyTo":"AANLkTil38OLw3J6ZPvv2wNu98QuTXJKtNwRZP0NDZPWn@mail.gmail.com","subject":"Re: git locate","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2010-06-02T10:23:32Z","receivedAt":"2010-06-02T10:23:32Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"John Tapsell <johnflux@gmail.com> writes:\n\n[...]\n\n> Actually could someone help me with this.. the trouble is that this\n> returns paths relative to the root.\n>\n> Can I get it to find all the files, but relative to where I am now?\n\nSomething like this is probably part of the answer, which allows an\nalias like this to work:\n\n\tlocate = !cd $GIT_CWD && sh -c 'git ls-files \"*$1*\"' -\n\nThat doesn't give you all the files (just those below where you are).\n\ndiff --git a/git.c b/git.c\nindex 99f0363..81c877b 100644\n--- a/git.c\n+++ b/git.c\n@@ -178,6 +178,10 @@ static int handle_alias(int *argcp, const char ***argv)\n                        }\n                        trace_printf(\"trace: alias to shell cmd: %s => %s\\n\",\n                                     alias_command, alias_string + 1);\n+                       if (!subdir || !*subdir)\n+                         setenv(\"GIT_CWD\", \"./\", 1);\n+                       else\n+                         setenv(\"GIT_CWD\", subdir, 1);\n                        ret = system(alias_string + 1);\n                        if (ret >= 0 && WIFEXITED(ret) &&\n                            WEXITSTATUS(ret) != 127)\n"},{"id":"142811","messageId":"vpqwruhwu6f.fsf@bauges.imag.fr","threadId":"22296","inReplyTo":"80y6ex3f8b.fsf@tiny.isode.net","subject":"Re: git locate","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-02T11:27:52Z","receivedAt":"2010-06-02T11:27:52Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Bruce Stephens <bruce.stephens@isode.com> writes:\n\n> John Tapsell <johnflux@gmail.com> writes:\n>\n> [...]\n>\n>> Actually could someone help me with this.. the trouble is that this\n>> returns paths relative to the root.\n>>\n>> Can I get it to find all the files, but relative to where I am now?\n>\n> Something like this is probably part of the answer, which allows an\n> alias like this to work:\n>\n> \tlocate = !cd $GIT_CWD && sh -c 'git ls-files \"*$1*\"' -\n\nThere's a patch pending to do more or less the same thing:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/146360/focus=146450\n\nRead Junio's reply there:\n\n  http://thread.gmane.org/gmane.comp.version-control.git/146360/focus=146450\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"142812","messageId":"AANLkTinBwk_l-prWXHiAE8UoSMaJMebHm5Y7J8TOScYR@mail.gmail.com","threadId":"22296","inReplyTo":"AANLkTil38OLw3J6ZPvv2wNu98QuTXJKtNwRZP0NDZPWn@mail.gmail.com","subject":"Re: git locate","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-06-02T11:29:19Z","receivedAt":"2010-06-02T11:29:19Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Jun 2, 2010 at 12:02 PM, John Tapsell <johnflux@gmail.com> wrote:\n> On 2 June 2010 14:00, John Tapsell <johnflux@gmail.com> wrote:\n>> On 15 February 2010 22:20, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n>>> Heya,\n>>>\n>>> On Thu, Jan 21, 2010 at 01:11, SungHyun Nam <goweol@gmail.com> wrote:\n>>>> The alias 'git locate' and the command 'git ls-files' runs\n>>>> differently if I run them in a subdirectory.\n>>>> Is it expected?\n>>>\n>>> I just ran into this (I wanted to alias 'git find' but to me the 'run\n>>> ls-files from cwd' is desirable. Also, I prefer to have a trailing\n>>> glob as well, so I added one :). An easy solution is to drop\n>>> 'git-find' in your path somewhere:\n>>\n>> I have finally settled on:\n>>\n>> [alias]\n>>    locate = !sh -c 'git ls-files | grep --color=auto \"$1\"' -\n>\n>\n> Actually could someone help me with this.. the trouble is that this\n> returns paths relative to the root.\n>\n> Can I get it to find all the files, but relative to where I am now?\n\nMake it a git command, not an alias. You'll then be fine. put\ngit-locate somewhere in your $PATH\n\n--<--\n#!/bin/sh\ngit ls-files | grep --color=auto \"$1\"\n--<--\n\nOf course you need to chmod u+x for it.\n-- \nDuy\n"},{"id":"142881","messageId":"20100603133950.GA30826@localhost","threadId":"22296","inReplyTo":"80y6ex3f8b.fsf@tiny.isode.net","subject":"Re: git locate","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-06-03T13:39:50Z","receivedAt":"2010-06-03T13:39:50Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Wed, Jun 02, 2010 at 11:23:32AM +0100, Bruce Stephens wrote:\n\n> Something like this is probably part of the answer, which allows an\n> alias like this to work:\n> \n> \tlocate = !cd $GIT_CWD && sh -c 'git ls-files \"*$1*\"' -\n> \n> That doesn't give you all the files (just those below where you are).\n\nOnce relative path support for ls-files is done (patch pending) you\ncan do git ls-files $(git rev-parse --show-cdup).\n\nClemens\n"}]}