Remove unnecessary use of non-portable 'mkdir()'
Linus Torvalds
torvalds at linux-foundation.org
Sun Feb 15 11:55:52 PST 2015
This fixes the problem with Windows being the usual non-POSIX PoS that it is..
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
On Sun, Feb 15, 2015 at 11:05 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> So I think the rigth thing to do is to just remove "system_git_dir()"
> entirely, and replace its use with "system_default_directory()"
> instead.
Actual tested (now that I got it to build) patch attached.
-------------- next part --------------
git-access.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/git-access.c b/git-access.c
index 8dbb7ff5850b..536e952da39e 100644
--- a/git-access.c
+++ b/git-access.c
@@ -23,18 +23,6 @@
#define git_remote_fetch(remote, refspecs, signature, reflog) git_remote_fetch(remote, signature, reflog)
#endif
-static const char *system_git_dir(void)
-{
- static char pathname[PATH_MAX];
-
- if (!*pathname) {
- // This doesn't work on Windows, crap that it is. Somebody needs to fix it.
- snprintf(pathname, PATH_MAX, "%s/git-caches", system_default_directory());
- mkdir(pathname, 0777);
- }
- return pathname;
-}
-
static char *get_local_dir(const char *remote, const char *branch)
{
SHA_CTX ctx;
@@ -49,7 +37,7 @@ static char *get_local_dir(const char *remote, const char *branch)
SHA1_Final(hash, &ctx);
return format_string("%s/%02x%02x%02x%02x%02x%02x%02x%02x",
- system_git_dir(),
+ system_default_directory(),
hash[0], hash[1], hash[2], hash[3],
hash[4], hash[5], hash[6], hash[7]);
}
More information about the subsurface
mailing list