Skip to content

Commit 5a93880

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 ad53187 commit 5a93880

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

abspath.c

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ static char *strbuf_realpath_1(struct strbuf *resolved, const char *path,
9191
goto error_out;
9292
}
9393

94+
if (platform_strbuf_realpath(resolved, path))
95+
return resolved->buf;
96+
9497
strbuf_addstr(&remaining, path);
9598
get_root_part(resolved, &remaining);
9699

git-compat-util.h

+4
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,10 @@ static inline int git_has_dir_sep(const char *path)
552552
#define query_user_email() NULL
553553
#endif
554554

555+
#ifndef platform_strbuf_realpath
556+
#define platform_strbuf_realpath(resolved, path) NULL
557+
#endif
558+
555559
#ifdef __TANDEM
556560
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
557561
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)