Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  handle "git --bare init <dir>" properly
  • Loading branch information
Junio C Hamano committed May 11, 2010
2 parents 73d4195 + 87a074d commit d92f844
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/init-db.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
static char git_dir[PATH_MAX+1];

setenv(GIT_DIR_ENVIRONMENT,
getcwd(git_dir, sizeof(git_dir)), 0);
getcwd(git_dir, sizeof(git_dir)), argc > 0);
}

if (init_shared_repository != -1)
Expand Down
14 changes: 14 additions & 0 deletions t/t0001-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,18 @@ test_expect_success POSIXPERM 'init notices EPERM' '
)
'

test_expect_success 'init creates a new bare directory with global --bare' '
rm -rf newdir &&
git --bare init newdir &&
test -d newdir/refs
'

test_expect_success 'init prefers command line to GIT_DIR' '
rm -rf newdir &&
mkdir otherdir &&
GIT_DIR=otherdir git --bare init newdir &&
test -d newdir/refs &&
! test -d otherdir/refs
'

test_done

0 comments on commit d92f844

Please sign in to comment.