Skip to content

Commit 5ee841f

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 721d299 commit 5ee841f

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
@@ -95,6 +95,9 @@ char *strbuf_realpath(struct strbuf *resolved, const char *path,
9595
goto error_out;
9696
}
9797

98+
if (platform_strbuf_realpath(resolved, path))
99+
return resolved->buf;
100+
98101
strbuf_addstr(&remaining, path);
99102
get_root_part(resolved, &remaining);
100103

git-compat-util.h

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

408+
#ifndef platform_strbuf_realpath
409+
#define platform_strbuf_realpath(resolved, path) NULL
410+
#endif
411+
408412
#ifdef __TANDEM
409413
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
410414
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)