public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Harald Nordgren <haraldnordgren@gmail.com>
To: haraldnordgren@gmail.com
Cc: git@vger.kernel.org, gitgitgadget@gmail.com, gitster@pobox.com
Subject: Re: [PATCH] revisions: add @{default} shorthand for default branch
Date: Sat, 31 Jan 2026 21:55:21 +0100	[thread overview]
Message-ID: <20260131205521.11876-1-haraldnordgren@gmail.com> (raw)
In-Reply-To: <20260131202232.9213-1-haraldnordgren@gmail.com>

> Doesn't repo_default_branch_name() do the right thing without being
> noisy at all even in a repository without that configured, as the
> function will fall back to the built-in default?  While I do not
> think of a workflow in which a handy access to the value the
> function gives would be so useful that it deserves a short-hand, it
> would be a reasonable candidate of what to be called "@{default}",
> if it proves useful, I would think.

After looking a this, this is hard-coded. Not showing what is relevant for
each repo that exists:

```
char *repo_default_branch_name(struct repository *r, int quiet)
{
  const char *config_key = "init.defaultbranch";
  const char *config_display_key = "init.defaultBranch";
  char *ret = NULL, *full_ref;
  const char *env = getenv("GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME");

  if (env && *env)
    ret = xstrdup(env);
  if (!ret && repo_config_get_string(r, config_key, &ret) < 0)
    die(_("could not retrieve `%s`"), config_display_key);

  if (!ret) {
#ifdef WITH_BREAKING_CHANGES
    ret = xstrdup("main");
#else
    ret = xstrdup("master");
```


Harald

  reply	other threads:[~2026-01-31 20:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 15:25 [PATCH] revisions: add @{default} shorthand for default branch Harald Nordgren via GitGitGadget
2026-01-29 20:23 ` Junio C Hamano
2026-01-30 10:59   ` Harald Nordgren
2026-01-30 11:12     ` Harald Nordgren
2026-01-30 16:42     ` Junio C Hamano
2026-01-30 20:58       ` Harald Nordgren
2026-01-30 21:56         ` Junio C Hamano
2026-01-31  0:09           ` Harald Nordgren
2026-01-31 19:16       ` Junio C Hamano
2026-01-31 20:22         ` Harald Nordgren
2026-01-31 20:55           ` Harald Nordgren [this message]
2026-02-02 12:32             ` Junio C Hamano
2026-02-02 15:30               ` Harald Nordgren
2026-02-02  9:37           ` Phillip Wood
2026-02-02 10:14             ` Harald Nordgren
2026-02-02 19:40               ` D. Ben Knoble
2026-02-02 21:19                 ` Harald Nordgren
2026-02-02 21:53                   ` Kristoffer Haugsbakk
2026-02-02 22:17                   ` Ben Knoble
2026-02-02 22:54                     ` Harald Nordgren
2026-02-02 21:33                 ` Junio C Hamano
2026-02-02 22:16                   ` Ben Knoble
2026-02-02 23:03                 ` Harald Nordgren
2026-02-02 21:44               ` Junio C Hamano
2026-02-02 22:56                 ` Harald Nordgren
2026-02-03 11:18                   ` Harald Nordgren
2026-02-03 14:38               ` Phillip Wood
2026-02-02 22:28             ` Junio C Hamano
2026-01-30 13:26 ` [PATCH v2] " Harald Nordgren via GitGitGadget
2026-01-30 16:54   ` Kristoffer Haugsbakk
2026-01-30 20:45   ` [PATCH v3] revisions: add @{primary} shorthand for primary branch Harald Nordgren via GitGitGadget
2026-01-31  0:06     ` [PATCH v4] " Harald Nordgren via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260131205521.11876-1-haraldnordgren@gmail.com \
    --to=haraldnordgren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox