Skip to content

fix: update axum's route and make fetch_dir more robust#1255

Merged
Ivanbeethoven merged 3 commits into
gitmono-dev:mainfrom
yyjeqhc:fix_fetch_tree
Jul 25, 2025
Merged

fix: update axum's route and make fetch_dir more robust#1255
Ivanbeethoven merged 3 commits into
gitmono-dev:mainfrom
yyjeqhc:fix_fetch_tree

Conversation

@yyjeqhc

@yyjeqhc yyjeqhc commented Jul 24, 2025

Copy link
Copy Markdown
Contributor

1.axum后路由路径处理变化,进行更新
2.fetch_dir修改错误处理,避免因网络等问题拉取失败时panic
3.libra switch子命令的check status输出错误,修改一个跟踪的文件,然后切换分支

#修改前的:
root@MSI:~/724/2# libra switch a1
On branch master
Changes not staged for commit:
  use "libra add <file>..." to update what will be committed
  use "libra restore <file>..." to discard changes in working directory
        modified: a.txt
Untracked files:
  use "libra add <file>..." to include in what will be committed
        b.txt
fatal: uncommitted changes, can't switch branch
#修改后的:
root@MSI:~/724/2# libra switch a1
On branch master
Changes not staged for commit:
  use "libra add <file>..." to update what will be committed
  use "libra restore <file>..." to discard changes in working directory
        modified: a.txt
Untracked files:
  use "libra add <file>..." to include in what will be committed
        b.txt
fatal: unstaged changes, can't switch branch

4.libra log添加历史提交的分支展示。

commit 2276c07161268e1316d0409faa7363d85f0ea2aa (HEAD -> master)
Author: mega <admin@mega.org>
Date: 2025-07-24 09:33:21 UTC +0800

aaa

commit 9b19ff529233b459d1431471caaa2d3a016f9594
Author: mega <admin@mega.org>
Date: 2025-07-24 09:33:10 UTC +0800

just mess

commit bfa18dd2e1fa46b34dd8bac8cc303c3d444041e6 (4)
Author: mega <admin@mega.org>
Date: 2025-07-24 09:32:49 UTC +0800

commit 4: add 4.txt

commit 3cca4ec3eb2fae6090289b1ecc7efb5e602b1183 (3)
Author: mega <admin@mega.org>
Date: 2025-07-24 09:32:49 UTC +0800

commit 3: add 3.txt

commit 6c868973ea26d3d4e3cc7bfb91c4fdcadcd89f66 (2)
Author: mega <admin@mega.org>
Date: 2025-07-24 09:32:49 UTC +0800

commit 2: add 2.txt

Copilot AI review requested due to automatic review settings July 24, 2025 06:38
@vercel

vercel Bot commented Jul 24, 2025

Copy link
Copy Markdown

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 Jul 25, 2025 3:11am

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR contains several improvements and fixes to the codebase, including updating Axum routing syntax, enhancing error handling in fetch_dir, fixing error messages in the switch command, and adding branch information to log output.

  • Updates Axum route path parameter syntax from :path to {path} to match current framework conventions
  • Improves error handling in fetch_dir to prevent panics and return meaningful error responses instead
  • Fixes inconsistent error messages in the switch command for uncommitted vs unstaged changes
  • Adds branch display functionality to the log command showing which branches point to specific commits

Reviewed Changes

Copilot reviewed 14 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scorpio/src/scolfs/route.rs Updates Axum route parameter syntax from :path to {path}
scorpio/src/dicfuse/store.rs Improves error handling in fetch_dir to return errors instead of panicking
libra/src/command/switch.rs Fixes error message consistency for uncommitted vs unstaged changes
libra/src/command/log.rs Adds branch information display to commit history
Multiple files Code formatting improvements and whitespace cleanup

if !unstaged.deleted.is_empty() || !unstaged.modified.is_empty() {
status::execute().await;
eprintln!("fatal: uncommitted changes, can't switch branch");
eprintln!("fatal: unstaged changes, can't switch branch");

Copilot AI Jul 25, 2025

Copy link

Choose a reason for hiding this comment

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

The error message is inconsistent with the condition. When checking unstaged deleted/modified files, the message should be 'fatal: uncommitted changes, can't switch branch' to match the original behavior described in the PR.

Suggested change
eprintln!("fatal: unstaged changes, can't switch branch");
eprintln!("fatal: uncommitted changes, can't switch branch");

Copilot uses AI. Check for mistakes.
} else if !status::changes_to_be_committed().await.is_empty() {
status::execute().await;
eprintln!("fatal: unstaged changes, can't switch branch");
eprintln!("fatal: uncommitted changes, can't switch branch");

Copilot AI Jul 25, 2025

Copy link

Choose a reason for hiding this comment

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

The error message is inconsistent with the condition. When checking staged changes (changes to be committed), the message should be 'fatal: unstaged changes, can't switch branch' to match the original behavior described in the PR.

Suggested change
eprintln!("fatal: uncommitted changes, can't switch branch");
eprintln!("fatal: unstaged changes, can't switch branch");

Copilot uses AI. Check for mistakes.
@Ivanbeethoven
Ivanbeethoven added this pull request to the merge queue Jul 25, 2025
Merged via the queue into gitmono-dev:main with commit cab1b5f Jul 25, 2025
13 checks passed
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.

3 participants