Skip to content

Commit 4bb1bdd

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 ea64b0e commit 4bb1bdd

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
@@ -393,6 +393,10 @@ static inline char *git_find_last_dir_sep(const char *path)
393393
#define query_user_email() NULL
394394
#endif
395395

396+
#ifndef platform_strbuf_realpath
397+
#define platform_strbuf_realpath(resolved, path) NULL
398+
#endif
399+
396400
#ifdef __TANDEM
397401
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
398402
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)