From 8747ebb7cde9e90d20794c06e6806f75cd540142 Mon Sep 17 00:00:00 2001 From: Don Goodman-Wilson Date: Wed, 24 Jun 2020 14:46:33 +0000 Subject: init: allow setting the default for the initial branch name via the config We just introduced the command-line option `--initial-branch=` to allow initializing a new repository with a different initial branch than the hard-coded one. To allow users to override the initial branch name more permanently (i.e. without having to specify the name manually for each and every `git init` invocation), let's introduce the `init.defaultBranch` config setting. Helped-by: Johannes Schindelin Helped-by: Derrick Stolee Signed-off-by: Don Goodman-Wilson Signed-off-by: Junio C Hamano --- refs.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'refs.h') diff --git a/refs.h b/refs.h index a92d2c74c8..2e5146fd45 100644 --- a/refs.h +++ b/refs.h @@ -154,6 +154,15 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_ int dwim_ref(const char *str, int len, struct object_id *oid, char **ref); int dwim_log(const char *str, int len, struct object_id *oid, char **ref); +/* + * Retrieves the default branch name for newly-initialized repositories. + * + * The return value of `repo_default_branch_name()` is an allocated string. The + * return value of `git_default_branch_name()` is a singleton. + */ +const char *git_default_branch_name(void); +char *repo_default_branch_name(struct repository *r); + /* * A ref_transaction represents a collection of reference updates that * should succeed or fail together. -- cgit v1.2.3