git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Getting path to a file from arbitrary project directory

From
KKKonstantin Kharlamov <hi-angel@yandex.ru>
Date
Jun 23, 2023, 10:02 UTC
Message-ID
<d20ac97bbb82256732e15cdc512709db98d1da88.camel@yandex.ru>
In-Reply-To
<xmqqzg4qbj4y.fsf@gitster.g>
Thank you, it works!
On Fri, 2023-06-23 at 02:52 -0700, Junio C Hamano wrote:
Show 21 quoted lines
> Konstantin Kharlamov <hi-angel@yandex.ru> writes:
> 
> > 1: the usecase is I have a Emacs helper function to pick up a an
> > aribtrarily mangled path to a file in the project from the primary
> > clipboard and open that file. It's often "mangled", because gdb
> > prints it with `../`, then logs print no path whatsoever, just a
> > filename… So it's generally useful to have.
> 
> Sounds like you are looking for the top (and possibly glob) magic
> pathspec, e.g. in the source tree of Git itself, I can go a few
> levels down into a random directory and get exactly the same listing
> of two files whose name is "rerere.c" located in two directories:
> 
>     $ cd t/helper
>     $ git ls-files --full-name ':(top,glob)**/rerere.c'
>     builtin/rerere.c
>     rerere.c
> 
> Look for magic pathspec in "git help glossary" to learn more.
> 
> 
Previous: Junio C Hamano
Message 5 of 5 in “Getting path to a file from arbitrary project directory”
  1. Konstantin KharlamovJun 23, 2023
  2. SZEDER GáborJun 23, 2023
  3. Konstantin KharlamovJun 23, 2023
  4. Junio C HamanoJun 23, 2023
  5. Konstantin KharlamovJun 23, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.