From: Johannes Schindelin Date: Mon, 26 Dec 2005 23:54:05 GMT Subject: [PATCH] Do not allow git-init-db to be called twice in the same directory Message-ID: t5300 is also adapted, since it relies heavily on init-db not complaining when $GIT_DIR already exists. Signed-off-by: Johannes Schindelin --- init-db.c | 3 ++- t/t5300-pack-object.sh | 16 ++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) 199557e282c6b7600fdb9f7ce8b203b1d634de8f diff --git a/init-db.c b/init-db.c index ff29496..1cb015e 100644 --- a/init-db.c +++ b/init-db.c @@ -259,7 +259,8 @@ int main(int argc, char **argv) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT; fprintf(stderr, "defaulting to local storage area\n"); } - safe_create_dir(git_dir, 0); + if (mkdir(git_dir, 0777) < 0) + die("Cannot initialize repository twice!"); /* Check to see if the repository version is right. * Note that a newly created repository does not have diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 7dfb1ab..df6549c 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -38,13 +38,12 @@ test_expect_success \ 'packname_1=$(git-pack-objects --window=0 test-1 current && diff expect current' - test_expect_success \ 'use packed deltified objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && -- 1.0.GIT