diff options
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r-- | builtin/init-db.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c index f6dd1727ec..ab0ea02d25 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -537,10 +537,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) usage(init_db_usage[0]); } if (is_bare_repository_cfg == 1) { - static char git_dir[PATH_MAX+1]; - - setenv(GIT_DIR_ENVIRONMENT, - getcwd(git_dir, sizeof(git_dir)), argc > 0); + char *cwd = xgetcwd(); + setenv(GIT_DIR_ENVIRONMENT, cwd, argc > 0); + free(cwd); } if (init_shared_repository != -1) |