summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec48d4b)
raw | patch | inline | side by side (parent: ec48d4b)
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | |
Thu, 3 Mar 2011 12:34:51 +0000 (19:34 +0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 3 Mar 2011 23:45:10 +0000 (15:45 -0800) |
git_dir must always be non-NULL so "if (git_dir)" is unnecessary.
Before this code, if git_dir == NULL, it will default to
DEFAULT_GIT_DIR_ENVIRONMENT.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Before this code, if git_dir == NULL, it will default to
DEFAULT_GIT_DIR_ENVIRONMENT.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/init-db.c | patch | blob | history |
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 4f5348eec670faaa62b24fff30b477ddd42acbc6..fbeb380ee2af2b21478e5766a3dd956b8fe06104 100644 (file)
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
is_bare_repository_cfg = guess_repository_type(git_dir);
if (!is_bare_repository_cfg) {
- if (git_dir) {
- const char *git_dir_parent = strrchr(git_dir, '/');
- if (git_dir_parent) {
- char *rel = xstrndup(git_dir, git_dir_parent - git_dir);
- git_work_tree_cfg = xstrdup(make_absolute_path(rel));
- free(rel);
- }
+ const char *git_dir_parent = strrchr(git_dir, '/');
+ if (git_dir_parent) {
+ char *rel = xstrndup(git_dir, git_dir_parent - git_dir);
+ git_work_tree_cfg = xstrdup(make_absolute_path(rel));
+ free(rel);
}
if (!git_work_tree_cfg) {
git_work_tree_cfg = xcalloc(PATH_MAX, 1);