Skip to content

Commit 00c42ca

Browse files
committed
Use all tags by default, instead of requiring annotated tags (#298)
This is a bit more user friendly, most projects don't use annotated tags. This makes sense for linux though, where lighweight tags might just be markers.
1 parent d5b8fd5 commit 00c42ca

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Diff for: git-repository/src/id.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'repo> Id<'repo> {
4949

5050
fn calculate_auto_hex_len(num_packed_objects: u64) -> usize {
5151
let mut len = 64 - num_packed_objects.leading_zeros();
52-
len = (len + 2 - 1) / 2;
52+
len = (len + 1) / 2;
5353
len.max(7) as usize
5454
}
5555

Diff for: src/plumbing/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub fn main() -> Result<()> {
159159
Subcommands::Repository(repo::Platform { repository, cmd }) => match cmd {
160160
repo::Subcommands::Commit { cmd } => match cmd {
161161
repo::commit::Subcommands::Describe {
162-
all_tags,
162+
annotated_tags,
163163
all_refs,
164164
first_parent,
165165
always,
@@ -180,7 +180,7 @@ pub fn main() -> Result<()> {
180180
out,
181181
err,
182182
core::repository::commit::describe::Options {
183-
all_tags,
183+
all_tags: !annotated_tags,
184184
all_refs,
185185
long_format: long,
186186
first_parent,

Diff for: src/plumbing/options.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,12 @@ pub mod repo {
395395
pub enum Subcommands {
396396
/// Describe the current commit or the given one using the name of the closest annotated tag in its ancestry.
397397
Describe {
398-
/// Use all tag references for naming, not only annotated tags.
398+
/// Use annotated tag references only, not all tags.
399399
#[clap(long, short = 't', conflicts_with("all-refs"))]
400-
all_tags: bool,
400+
annotated_tags: bool,
401401

402402
/// Use all references under the `ref/` namespaces, which includes tag references, local and remote branches.
403-
#[clap(long, short = 'a', conflicts_with("all-tags"))]
403+
#[clap(long, short = 'a', conflicts_with("annotated-tags"))]
404404
all_refs: bool,
405405

406406
/// Only follow the first parent when traversing the commit graph.

0 commit comments

Comments
 (0)