From: Bruce Stephens <bruce.stephens@isode.com>
To: John Tapsell <johnflux@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: git locate
Date: Wed, 02 Jun 2010 11:23:32 +0100 [thread overview]
Message-ID: <80y6ex3f8b.fsf@tiny.isode.net> (raw)
In-Reply-To: <AANLkTil38OLw3J6ZPvv2wNu98QuTXJKtNwRZP0NDZPWn@mail.gmail.com> (John Tapsell's message of "Wed, 2 Jun 2010 19:02:00 +0900")
John Tapsell <johnflux@gmail.com> writes:
[...]
> 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?
Something like this is probably part of the answer, which allows an
alias like this to work:
locate = !cd $GIT_CWD && sh -c 'git ls-files "*$1*"' -
That doesn't give you all the files (just those below where you are).
diff --git a/git.c b/git.c
index 99f0363..81c877b 100644
--- a/git.c
+++ b/git.c
@@ -178,6 +178,10 @@ static int handle_alias(int *argcp, const char ***argv)
}
trace_printf("trace: alias to shell cmd: %s => %s\n",
alias_command, alias_string + 1);
+ if (!subdir || !*subdir)
+ setenv("GIT_CWD", "./", 1);
+ else
+ setenv("GIT_CWD", subdir, 1);
ret = system(alias_string + 1);
if (ret >= 0 && WIFEXITED(ret) &&
WEXITSTATUS(ret) != 127)
next prev parent reply other threads:[~2010-06-02 10:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-20 1:17 git locate John Tapsell
2010-01-20 1:24 ` Johannes Schindelin
2010-01-20 2:14 ` Jakub Narebski
2010-01-20 9:32 ` Johannes Schindelin
2010-01-20 10:06 ` Jakub Narebski
2010-01-20 11:07 ` John Tapsell
2010-01-20 11:43 ` Johannes Schindelin
2010-01-21 0:11 ` SungHyun Nam
2010-01-21 9:42 ` Michael J Gruber
2010-01-21 9:51 ` Štěpán Němec
2010-02-15 13:20 ` Sverre Rabbelier
2010-06-02 5:00 ` John Tapsell
2010-06-02 10:02 ` John Tapsell
2010-06-02 10:23 ` Bruce Stephens [this message]
2010-06-02 11:27 ` Matthieu Moy
2010-06-03 13:39 ` Clemens Buchacher
2010-06-02 11:29 ` Nguyen Thai Ngoc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80y6ex3f8b.fsf@tiny.isode.net \
--to=bruce.stephens@isode.com \
--cc=git@vger.kernel.org \
--cc=johnflux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).