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

Re: [PATCH v4 1/2] abspath: add a function to resolve paths with missing components

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Dec 8, 2020, 02:51 UTC
Message-ID
<X87qNTiQDlnzm6e2@camp.crustytoothpaste.net>
In-Reply-To
<c1d1fe44-6a7d-3578-cd89-9aea59c4637a@web.de>
On 2020-12-07 at 17:19:32, René Scharfe wrote:
> I find the concept of a "real" path with imaginary components strangely
> amusing.  But perhaps a name like strbuf_resolve_path() would fit better?

I think I'm going to take the strbuf_realpath_forgiving solution from Eric Sunshine because I think having similar names for similar functions helps discoverability.

Show 10 quoted lines
> So the original code errors out if there is a real error
> (errno != ENOENT).  It also errors out if any component except the last
> one is missing (errno == ENOENT && remaining.len); that's what the
> comment is about.  This patch adds the ability to ignore ENOENT for all
> components.
> 
> Perhaps convert many_missing and die_on_error into a single flags
> parameter and implement the flags DIE_ON_ERR and REQUIRE_BASENAME or
> similar?  Callers would be easier to read because such an interface is
> self-documenting -- provided we find good flag names.

As discussed elsewhere in the thread, this will be moving to an internal function, but I can make that function take two flag parameters.

-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: René ScharfeNext: brian m. carlson
Message 6 of 9 in “rev-parse options for absolute or relative paths”
  1. 0/2 rev-parse options for absolute or relative pathsbrian m. carlson, Dec 6, 2020
  2. 1/2 abspath: add a function to resolve paths with missing componentsbrian m. carlson, Dec 6, 2020
  3. Eric SunshineDec 7, 2020
  4. brian m. carlsonDec 7, 2020
  5. René ScharfeDec 7, 2020
  6. brian m. carlsonDec 8, 2020
  7. 2/2 rev-parse: add option for absolute or relative path formattingbrian m. carlson, Dec 6, 2020
  8. Eric SunshineDec 7, 2020
  9. brian m. carlsonDec 7, 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.