From dce99cf1f83bfc54a4130c4fe2b1c1d0a81a980c Mon Sep 17 00:00:00 2001 From: Aleksey Kuznetsov Date: Sat, 10 Feb 2024 22:01:20 +0500 Subject: [PATCH] cli: add short `-b` option for `--branch` in `jj git fetch` --- CHANGELOG.md | 3 +++ cli/src/commands/git.rs | 2 +- cli/tests/cli-reference@.md.snap | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2555c9883..003b3ccccf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * `jj show` now accepts `-T`/`--template` option to render its output using template +* `jj git fetch` now accepts `-b` as a shorthand for `--branch`, making it more + consistent with other commands that accept a branch + ### Fixed bugs * On Windows, symlinks in the repo are now materialized as regular files in the diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 9217940fdb..8831721512 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -156,7 +156,7 @@ pub struct GitFetchArgs { /// /// By default, the specified name matches exactly. Use `glob:` prefix to /// expand `*` as a glob. The other wildcard characters aren't supported. - #[arg(long, default_value = "glob:*", value_parser = parse_string_pattern)] + #[arg(long, short, default_value = "glob:*", value_parser = parse_string_pattern)] branch: Vec, /// The remote to fetch from (only named remotes are supported, can be /// repeated) diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index afe065422e..c78cb8916e 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -849,7 +849,7 @@ Fetch from a Git remote ###### **Options:** -* `--branch ` — Fetch only some of the branches +* `-b`, `--branch ` — Fetch only some of the branches Default value: `glob:*` * `--remote ` — The remote to fetch from (only named remotes are supported, can be repeated)