Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add libra tag #775

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

xsrkt26
Copy link
Contributor

@xsrkt26 xsrkt26 commented Dec 22, 2024

New features or issues fixed: Added the tag command to Libra.
Purpose of the changes: Improve the implementation of Libra.
Supported functionality: libra tag [OPTIONS] [TAG_NAME] [COMMIT_HASH]

Copy link

vercel bot commented Dec 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mega ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 30, 2024 7:18am

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (5)

libra/src/internal/tag.rs:42

  • Using unwrap() can cause a panic if the result is None. Consider handling the None case more gracefully.
unwrap()

libra/src/internal/tag.rs:75

  • Using unwrap() can cause a panic if the result is None. Consider handling the None case more gracefully.
unwrap()

libra/src/internal/tag.rs:86

  • Using unwrap() can cause a panic if the result is None. Consider handling the None case more gracefully.
unwrap()

libra/src/command/tag.rs:90

  • Avoid panicking; handle the error more gracefully.
let _ = load_object::<Commit>(&commit_id).unwrap_or_else(|_| panic!("fatal: not a valid object name: '{}'", commit_id));

libra/src/command/tag.rs:128

  • Avoid panicking; handle the error more gracefully.
let _ = TagInfo::find_tag(&tag_name).await.unwrap_or_else(|| panic!("fatal: tag '{}' not found", tag_name));

.filter(reference::Column::Kind.eq(reference::ConfigKind::Tag))
.one(db_conn)
.await
.unwrap()
Copy link
Preview

Copilot AI Dec 22, 2024

Choose a reason for hiding this comment

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

Using unwrap() can cause a panic if the result is None. Consider handling the None case more gracefully.

Suggested change
.unwrap()
.await.ok()?

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
match tag {
Some(tag) => Some(TagInfo {
name: tag.name.as_ref().unwrap().clone(),
commit: SHA1::from_str(tag.commit.as_ref().unwrap()).unwrap(),
Copy link
Preview

Copilot AI Dec 22, 2024

Choose a reason for hiding this comment

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

Using unwrap() can cause a panic if the result is None. Consider handling the None case more gracefully.

Suggested change
commit: SHA1::from_str(tag.commit.as_ref().unwrap()).unwrap(),
commit: tag.commit.as_ref().and_then(|c| SHA1::from_str(c).ok()),

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
// default behavior
list_tags().await;
} else {
panic!("should not reach here")
Copy link
Preview

Copilot AI Dec 22, 2024

Choose a reason for hiding this comment

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

Unexpected cases should be handled more gracefully instead of panicking.

Suggested change
panic!("should not reach here")
eprintln!("Error: unexpected case encountered");

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
tracing::debug!("create tag: {} from {:?}", tag_name, commit_hash);

if !is_valid_git_tag_name(&tag_name) {
eprintln!("fatal: invalid tag name: {}", tag_name);
Copy link
Preview

Copilot AI Dec 22, 2024

Choose a reason for hiding this comment

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

Returning an error would be more appropriate than just printing and returning.

Suggested change
eprintln!("fatal: invalid tag name: {}", tag_name);
return Err(format!("fatal: invalid tag name: {}", tag_name));

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member

@genedna genedna left a comment

Choose a reason for hiding this comment

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

@xsrkt26

Please add the docs for the tag and config commands. They will be displayed at https://gitmega.dev/docs/libra/command/tag and https://gitmega.dev/docs/libra/command/config. The docs file is located in aria/contents/docs/libra/command/tag/index.mdx and aria/contents/docs/libra/command/config/index.mdx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants