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

[feature] how to output absolute paths in git diff? => --show-abs-path

From
TCTimothee Cour <thelastmammoth@gmail.com>
Date
Aug 23, 2018, 09:15 UTC
Message-ID
<CANri+EzXBxEf7XtjnJONAYD4h_woqw06-4mcWCH6xODNMMp26w@mail.gmail.com>

This has all the context: https://stackoverflow.com/questions/22698505/how-to-show-full-paths-in-git-diff

I'd like `--show-abs-path` to show absolute paths in: git diff --show-abs-path args...

eg: git diff --no-index `get_file1` `get_file2` could show:

--- a/Users/timothee/temp/ripgrep/help0.txt
+++ b/help1.txt

* passing '--dst-prefix=$PWD' and '--src-prefix=$PWD' doesn't help
because path arguments could be absolute, so it'll create
$PWD/Users/timothee/temp/ripgrep/help0.txt (wrong)

* passing '--dst-prefix=.' will behave weirdly, replacing leading `/`
by `.` (seems wrong)
diff --git .Users/timothee/temp/ripgrep/help0.txt b/help1.txt

NOTE: I'm invoking the `git diff` command via a more complicated case
(with multiple arguments including git diff flags and git diff files),
so it's awkward for me to parse which arguments correspond to a file
vs a flag (ie prevents easily converting input file arguments to
absolute paths), but `git` could do it easily via a flag, eg
`--show-abs-path`
Next: Ævar Arnfjörð Bjarmason
Message 1 of 3 in “[feature] how to output absolute paths in git diff? => --show-abs-path”
  1. Timothee CourAug 23, 2018
  2. Ævar Arnfjörð BjarmasonAug 23, 2018
  3. Timothee CourAug 23, 2018

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.