Skip to content

Commit 6c91598

Browse files
committed
strbuf_realpath(): use platform-dependent API if available
Some platforms (e.g. Windows) provide API functions to resolve paths much quicker. Let's offer a way to short-cut `strbuf_realpath()` on those platforms. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent bf75da6 commit 6c91598

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

abspath.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ static char *strbuf_realpath_1(struct strbuf *resolved, const char *path,
9393
goto error_out;
9494
}
9595

96+
if (platform_strbuf_realpath(resolved, path))
97+
return resolved->buf;
98+
9699
strbuf_addstr(&remaining, path);
97100
get_root_part(resolved, &remaining);
98101

git-compat-util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ static inline int git_has_dir_sep(const char *path)
630630
#define query_user_email() NULL
631631
#endif
632632

633+
#ifndef platform_strbuf_realpath
634+
#define platform_strbuf_realpath(resolved, path) NULL
635+
#endif
636+
633637
#ifdef __TANDEM
634638
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
635639
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)