改进 Git 分支检测和处理逻辑 - #110
Merged
HeiSir2014 merged 1 commit intoSep 28, 2025
Merged
Conversation
📊 Performance Impact Analysis
Analysis
|
HeiSir2014
deleted the
heisir/feat-improve-git-branch-detection-6e9b47
branch
September 28, 2025 14:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更内容
BaseAiflowApp类中添加了对当前分支检测失败的处理逻辑,当无法检测到当前分支或处于分离 HEAD 状态时会输出错误信息并终止执行GitService类中重构了checkout方法及其相关私有方法,使其返回布尔值以表示操作是否成功GitService中的 stash 处理逻辑,分别检查未暂存和已暂存的更改,并在需要时进行 stash 操作GitService中的错误处理机制,在获取 git 用户名、diff 输出和更改文件列表时添加了 try-catch 块GitService中的分支检测逻辑,当处于分离 HEAD 状态时返回空字符串而不是 'detached' 或 'unknown'Shell类中新增了runWithExitCode方法,用于执行 shell 命令并返回详细的执行结果(包括退出码)UpdateChecker类中改进了 npm 命令的执行方式,使用新添加的runWithExitCode方法进行更新操作,并根据退出码判断操作是否成功变更原因
测试方法