diff options
author | brian m. carlson <sandals@crustytoothpaste.net> | 2020-12-13 00:25:28 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-12-12 23:35:47 -0800 |
commit | be6e0daee700b2ee28846b54ddfefe08cd4ec506 (patch) | |
tree | 8a1e2f49bf04b541f314fe2aec632de921475d53 /commit.c | |
parent | Eleventh batch (diff) | |
download | tgif-be6e0daee700b2ee28846b54ddfefe08cd4ec506.tar.xz |
abspath: add a function to resolve paths with missing components
Currently, we have a function to resolve paths, strbuf_realpath. This
function canonicalizes paths like realpath(3), but permits a trailing
component to be absent from the file system. In other words, this is
the behavior of the GNU realpath(1) without any arguments.
In the future, we'll need this same behavior, except that we want to
allow for any number of missing trailing components, which is the
behavior of GNU realpath(1) with the -m option. This is useful because
we'll want to canonicalize a path that may point to a not yet present
path under the .git directory. For example, a user may want to know
where an arbitrary ref would be stored if it existed in the file system.
Let's refactor strbuf_realpath to move most of the code to an internal
function and then pass it two flags to control its behavior. We'll add
a strbuf_realpath_forgiving function that has our new behavior, and
leave strbuf_realpath with the older, stricter behavior.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions