Skip to content

Add --abbrev-commit, --format=oneline and --oneline to the log subcommand#118

Open
SandrineP wants to merge 1 commit intoQuantStack:mainfrom
SandrineP:log_oneline
Open

Add --abbrev-commit, --format=oneline and --oneline to the log subcommand#118
SandrineP wants to merge 1 commit intoQuantStack:mainfrom
SandrineP:log_oneline

Conversation

@SandrineP
Copy link
Collaborator

@SandrineP SandrineP commented Mar 10, 2026

Fix #91
Add --abbrev-commit, format=oneline and --oneline to the log subcommand
Add <rev> to the revparse subcommand
Add -annotate to the tag subcommand
(The last two ones being useful for the tests)

@SandrineP SandrineP added the enhancement New feature or request label Mar 10, 2026
@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 96.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.02%. Comparing base (e0f7ab9) to head (87be596).

Files with missing lines Patch % Lines
src/subcommand/revparse_subcommand.cpp 92.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   86.83%   87.02%   +0.19%     
==========================================
  Files          60       60              
  Lines        2340     2382      +42     
  Branches      275      287      +12     
==========================================
+ Hits         2032     2073      +41     
- Misses        308      309       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@ianthomas23 ianthomas23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one change requested, and a note about future work.

auto *sub = app.add_subcommand("log", "Shows commit logs");

sub->add_flag("--format", m_format_flag, "Pretty-print the contents of the commit logs in a given format, where <format> can be one of full and fuller");
sub->add_option("--format", m_format_flag, "Pretty-print the contents of the commit logs in a given format, where <format> can be one of full and fuller");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should mention oneline as an option.

std::cout << std::boolalpha << repo.is_shallow() << std::endl;
}
}
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git allows the user to specify both flags and revisions in one command, and outputs lines in order. With this return if you specify both in git2cpp you only see the results for the flags. It is OK if this is future work though, as keeping the order of both flags and revision arguments will take effort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! I only thought about the two flags, which is what I tested. I'll update it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: git log --oneline

2 participants