git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] init-db: change --template type to OPTION_FILENAME

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Feb 14, 2018, 10:51 UTC
Message-ID
<20180214105149.28896-2-pclouds@gmail.com>
In-Reply-To
<20180214105149.28896-1-pclouds@gmail.com>

OPTION_FILENAME has some magic behind the scene, like prefixing which is useless for init-db. The $HOME expansion though does come handy and makes --template more consistent with the rest (both env and config var get $HOME expansion).

Noticed-by: Doron Behar <doron.behar@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/init-db.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 68ff4ad75a..d6bd9f19cb 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -473,8 +473,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	const char *template_dir = NULL;
 	unsigned int flags = 0;
 	const struct option init_db_options[] = {
-		OPT_STRING(0, "template", &template_dir, N_("template-directory"),
-				N_("directory from which templates will be used")),
+		{ OPTION_FILENAME, 0, "template", &template_dir,
+			N_("template-directory"),
+			N_("directory from which templates will be used")},
 		OPT_SET_INT(0, "bare", &is_bare_repository_cfg,
 				N_("create a bare repository"), 1),
 		{ OPTION_CALLBACK, 0, "shared", &init_shared_repository,
-- 
2.16.1.435.g8f24da2e1a
Previous: Nguyễn Thái Ngọc DuyNext: Jeff King
Message 3 of 11 in “[BUG] git init doesn't respect `--template` like configuration variable init.templateDir and $GIT_TEMPLATE_DIR”
  1. Doron BeharFeb 14, 2018
  2. 1/2 parse-options: expand $HOME on filename optionsNguyễn Thái Ngọc Duy, Feb 14, 2018
  3. 2/2 init-db: change --template type to OPTION_FILENAMENguyễn Thái Ngọc Duy, Feb 14, 2018
  4. Jeff KingFeb 14, 2018
  5. Jeff KingFeb 14, 2018
  6. Junio C HamanoFeb 14, 2018
  7. Ævar Arnfjörð BjarmasonFeb 14, 2018
  8. Junio C HamanoFeb 15, 2018
  9. Duy NguyenFeb 22, 2018
  10. Ævar Arnfjörð BjarmasonFeb 22, 2018
  11. Duy NguyenFeb 23, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.