From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nguyen Thai Ngoc Duy Subject: Re: git locate Date: Wed, 2 Jun 2010 13:29:19 +0200 Message-ID: References: <43d8ce651001191717l58d10919j691f4e5b056fe9b5@mail.gmail.com> <4B579BA8.8050000@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: Git List To: John Tapsell X-From: git-owner@vger.kernel.org Wed Jun 02 13:29:46 2010 connect(): No such file or directory Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OJm8o-0004lI-IQ for gcvg-git-2@lo.gmane.org; Wed, 02 Jun 2010 13:29:46 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757879Ab0FBL3m (ORCPT ); Wed, 2 Jun 2010 07:29:42 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:36198 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757854Ab0FBL3k (ORCPT ); Wed, 2 Jun 2010 07:29:40 -0400 Received: by bwz11 with SMTP id 11so382833bwz.19 for ; Wed, 02 Jun 2010 04:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=5JVuVzIZ6UxhnlW/e/K+wzVDbeuFoP8ER64sq/zEL9A=; b=cXS7VNgZqGPPzQ9rYpYxNjNkSJVN+g6ARGwh7Br5fx0UzgAHm78ha+DvLJ/HRjB6dw yoFJJPiIHdBHHqw/DdYHUsOtFYIBPH2lEVWP1870yYrl7UOuI8JUGLaqQCy6ePJihpvW CkbcBgO1bW/8rbNtE40v+88o7E1KCF7w3XGto= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=nA2SvOwXENxVipUR9lFr6SW/PbaQrARltVV2voln7F+TeKxJ1DMO+KbK7UsRrTfkXm xQaFwPM/D3j03JULLLvRlm1AR87Jd19Gr4Nu0lwAF3X9tiwa5jfEOdQ6nNFiXPssh1Zx faSPvfPd1f3qa/OgLpG98qMFOuceS1pH4IcoI= Received: by 10.204.81.85 with SMTP id w21mr1676323bkk.92.1275478179182; Wed, 02 Jun 2010 04:29:39 -0700 (PDT) Received: by 10.204.70.79 with HTTP; Wed, 2 Jun 2010 04:29:19 -0700 (PDT) In-Reply-To: Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: On Wed, Jun 2, 2010 at 12:02 PM, John Tapsell wrote: > On 2 June 2010 14:00, John Tapsell wrote: >> On 15 February 2010 22:20, Sverre Rabbelier wrote: >>> Heya, >>> >>> On Thu, Jan 21, 2010 at 01:11, SungHyun Nam wrote: >>>> The alias 'git locate' and the command 'git ls-files' runs >>>> differently if I run them in a subdirectory. >>>> Is it expected? >>> >>> I just ran into this (I wanted to alias 'git find' but to me the 'run >>> ls-files from cwd' is desirable. Also, I prefer to have a trailing >>> glob as well, so I added one :). An easy solution is to drop >>> 'git-find' in your path somewhere: >> >> I have finally settled on: >> >> [alias] >> locate = !sh -c 'git ls-files | grep --color=auto "$1"' - > > > Actually could someone help me with this.. the trouble is that this > returns paths relative to the root. > > Can I get it to find all the files, but relative to where I am now? Make it a git command, not an alias. You'll then be fine. put git-locate somewhere in your $PATH --<-- #!/bin/sh git ls-files | grep --color=auto "$1" --<-- Of course you need to chmod u+x for it. -- Duy