-
Notifications
You must be signed in to change notification settings - Fork 37
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this 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() |
There was a problem hiding this comment.
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.
.unwrap() | |
.await.ok()? |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
match tag { | ||
Some(tag) => Some(TagInfo { | ||
name: tag.name.as_ref().unwrap().clone(), | ||
commit: SHA1::from_str(tag.commit.as_ref().unwrap()).unwrap(), |
There was a problem hiding this comment.
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.
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.
// default behavior | ||
list_tags().await; | ||
} else { | ||
panic!("should not reach here") |
There was a problem hiding this comment.
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.
panic!("should not reach here") | |
eprintln!("Error: unexpected case encountered"); |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
tracing::debug!("create tag: {} from {:?}", tag_name, commit_hash); | ||
|
||
if !is_valid_git_tag_name(&tag_name) { | ||
eprintln!("fatal: invalid tag name: {}", tag_name); |
There was a problem hiding this comment.
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
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]