diff options
| author | Junio C Hamano <gitster@pobox.com> | 2021-12-10 14:35:07 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2021-12-10 14:35:07 -0800 |
| commit | 03194a1afa0d8dbcf3e556aa51cf9118f38efb2e (patch) | |
| tree | ca5a1235d16a23c0ee06cca09845ff4abe2acf6d /builtin | |
| parent | 1c39c822a9a57efc811793ca0ffe9d872eabc12c (diff) | |
| parent | e06c9e1df28e04bbf013840c6c50ce1be41b9583 (diff) | |
| download | git-03194a1afa0d8dbcf3e556aa51cf9118f38efb2e.tar.xz | |
Merge branch 'tw/var-default-branch'
"git var GIT_DEFAULT_BRANCH" is a way to see what name is used for
the newly created branch if "git init" is run.
* tw/var-default-branch:
var: add GIT_DEFAULT_BRANCH variable
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/var.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/var.c b/builtin/var.c index 6c6f46b4ae..491db27429 100644 --- a/builtin/var.c +++ b/builtin/var.c @@ -5,6 +5,7 @@ */ #include "builtin.h" #include "config.h" +#include "refs.h" static const char var_usage[] = "git var (-l | <variable>)"; @@ -27,6 +28,11 @@ static const char *pager(int flag) return pgm; } +static const char *default_branch(int flag) +{ + return git_default_branch_name(1); +} + struct git_var { const char *name; const char *(*read)(int); @@ -36,6 +42,7 @@ static struct git_var git_vars[] = { { "GIT_AUTHOR_IDENT", git_author_info }, { "GIT_EDITOR", editor }, { "GIT_PAGER", pager }, + { "GIT_DEFAULT_BRANCH", default_branch }, { "", NULL }, }; |
