Skip to content

Commit 6fd1f54

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 5e03ad3 commit 6fd1f54

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
@@ -387,6 +387,10 @@ static inline int git_has_dir_sep(const char *path)
387387
#define query_user_email() NULL
388388
#endif
389389

390+
#ifndef platform_strbuf_realpath
391+
#define platform_strbuf_realpath(resolved, path) NULL
392+
#endif
393+
390394
#ifdef __TANDEM
391395
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
392396
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)