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

Re: [PATCH v3 0/2] rev-parse options for absolute or relative paths

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Dec 2, 2020, 13:12 UTC
Message-ID
<nycvar.QRO.7.76.6.2012021410560.25979@tvgsbejvaqbjf.bet>
In-Reply-To
<20201127231916.609852-1-sandals@crustytoothpaste.net>
Hi brian,
On Fri, 27 Nov 2020, brian m. carlson wrote:
Show 15 quoted lines
> There are a bunch of different situations in which one would like to
> have an absolute and canonical or a relative path from Git.  In many of
> these cases, these values are already available from git rev-parse, but
> some values only come in one form or another.
>
> Many operating systems, such as macOS, lack a built-in realpath command
> that can canonicalize paths properly, and additionally some programming
> languages, like Go, currently do as well.  It's therefore helpful for us
> to provide a generic way to request that a path is fully canonicalized
> before using it.  Since users may wish for a relative path, we can
> provide one of those as well.
>
> The primary impetus for this was Git LFS, which needs paths to be
> canonicalized in the same way as Git in order to function correctly.
> See https://github.com/git-lfs/git-lfs/issues/4012 for more details.
Sounds good!

I offered a step back that would allow us to do without `count_dir_separators()` (or `count_components()`) altogether.

Otherwise, this patch series still looks good to me.

Thanks, Dscho

Show 29 quoted lines
>
> Changes from v2:
>
> * Incorporate multiple missing segment support into the strbuf_realpath
>   code.
> * Switch some invocations to use DEFAULT_UNMODIFIED, which should not
>   result in a change in behavior.
> * Rebase, resolving some conflicts.
>
> Changes from v1:
>
> * Add a function to handle missing trailing components when
>   canonicalizing paths and use it.
> * Improve commit messages.
> * Fix broken && chain.
> * Fix situation where relative paths are not relative.
>
> brian m. carlson (2):
>   abspath: add a function to resolve paths with missing components
>   rev-parse: add option for absolute or relative path formatting
>
>  Documentation/git-rev-parse.txt |  71 +++++++++++++---------
>  abspath.c                       |  33 +++++++++-
>  builtin/rev-parse.c             | 104 ++++++++++++++++++++++++++++----
>  cache.h                         |   2 +
>  t/t1500-rev-parse.sh            |  57 ++++++++++++++++-
>  5 files changed, 223 insertions(+), 44 deletions(-)
>
>
Previous: brian m. carlson
Message 8 of 8 in “rev-parse options for absolute or relative paths”
  1. 0/2 rev-parse options for absolute or relative pathsbrian m. carlson, Nov 27, 2020
  2. 2/2 rev-parse: add option for absolute or relative path formattingbrian m. carlson, Nov 27, 2020
  3. 1/2 abspath: add a function to resolve paths with missing componentsbrian m. carlson, Nov 27, 2020
  4. René ScharfeNov 28, 2020
  5. brian m. carlsonNov 28, 2020
  6. Johannes SchindelinDec 2, 2020
  7. brian m. carlsonDec 2, 2020
  8. Johannes SchindelinDec 2, 2020

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.