Skip to content

Commit 423532f

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 ed96085 commit 423532f

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
@@ -408,6 +408,10 @@ static inline int git_create_symlink(struct index_state *index, const char *targ
408408
#define query_user_email() NULL
409409
#endif
410410

411+
#ifndef platform_strbuf_realpath
412+
#define platform_strbuf_realpath(resolved, path) NULL
413+
#endif
414+
411415
#ifdef __TANDEM
412416
#include <floss.h(floss_execl,floss_execlp,floss_execv,floss_execvp)>
413417
#include <floss.h(floss_getpwuid)>

0 commit comments

Comments
 (0)