aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-03-03 19:34:51 +0700
committerJunio C Hamano <gitster@pobox.com>2011-03-03 15:45:10 -0800
commitb31d20227a4e3c71cf545d2142996e27cacadcec (patch)
tree876ce19ac188c7b2a57ee698b645f05fed754839 /builtin
parentec48d4bb7f3ca1429809500eae2867fdbcda3338 (diff)
downloadgit-b31d20227a4e3c71cf545d2142996e27cacadcec.tar.gz
git-b31d20227a4e3c71cf545d2142996e27cacadcec.tar.xz
init: remove unnecessary check
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/init-db.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 4f5348eec..fbeb380ee 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -498,13 +498,11 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
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);