zen-gitsync 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -94,33 +94,3 @@ $ g log --n=5
94
94
  ```shell
95
95
  $ g ui
96
96
  ```
97
-
98
- # Zen GitSync 功能说明
99
-
100
- ## 自动文件监控与状态更新
101
-
102
- Zen GitSync现在支持自动文件监控和状态更新功能:
103
-
104
- - 当Git仓库内的文件发生变动时,系统会自动检测并更新Git状态
105
- - 采用防抖(debounce)技术,避免频繁变动导致的性能问题
106
- - 用户可以通过界面上的开关随时启用或禁用自动更新功能
107
- - 设置会自动保存,下次打开应用时仍然生效
108
-
109
- ### 使用方法
110
-
111
- 1. 在Git状态面板的顶部有一个开关按钮,用于切换自动更新状态
112
- 2. 绿色表示自动更新已启用,灰色表示已禁用
113
- 3. 即使禁用了自动更新,用户仍然可以通过刷新按钮手动更新状态
114
-
115
- ### 技术说明
116
-
117
- 该功能使用以下技术实现:
118
- - 服务端使用chokidar监控文件系统变化
119
- - 使用Socket.IO实现服务器与客户端的实时通信
120
- - 采用1000ms防抖延迟,优化性能并避免重复更新
121
-
122
- ### 注意事项
123
-
124
- - 自动监控只会监控Git工作目录下的文件变动
125
- - 监控器会自动过滤.git目录、node_modules目录和隐藏文件
126
- - 在大型仓库中可能会增加服务器资源消耗
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "一个 git 自动查看差异并提交的工具",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -731,49 +731,29 @@ function extractAuthorsFromLogs() {
731
731
  console.log(`从现有日志中提取了${availableAuthors.value.length}位作者`)
732
732
  }
733
733
 
734
- // 添加获取所有分支的函数
735
- async function fetchAllBranches() {
736
- try {
737
- console.log('获取所有可用分支...')
734
+ // // 添加获取所有分支的函数
735
+ // async function fetchAllBranches() {
736
+ // try {
737
+ // console.log('获取所有可用分支...')
738
738
 
739
- // 直接调用 gitStore 中的方法获取分支列表
740
- await gitStore.getAllBranches()
739
+ // // 直接调用 gitStore 中的方法获取分支列表
740
+ // await gitStore.getAllBranches()
741
741
 
742
- // 从 gitStore 中获取分支列表
743
- if (gitStore.allBranches.length > 0) {
744
- // 更新可用分支列表
745
- availableBranches.value = [...gitStore.allBranches].sort()
746
- console.log(`获取到${availableBranches.value.length}个分支`)
747
- } else {
748
- console.warn('gitStore中没有分支数据')
749
- }
750
- } catch (error) {
751
- console.error('获取分支列表失败:', error)
752
- extractBranchesFromLogs()
753
- }
754
- }
742
+ // // 从 gitStore 中获取分支列表
743
+ // if (gitStore.allBranches.length > 0) {
744
+ // // 更新可用分支列表
745
+ // availableBranches.value = [...gitStore.allBranches].sort()
746
+ // console.log(`获取到${availableBranches.value.length}个分支`)
747
+ // } else {
748
+ // console.warn('gitStore中没有分支数据')
749
+ // }
750
+ // } catch (error) {
751
+ // console.error('获取分支列表失败:', error)
752
+ // extractBranchesFromLogs()
753
+ // }
754
+ // }
755
+
755
756
 
756
- // 从日志中提取分支
757
- function extractBranchesFromLogs() {
758
- // 从当前加载的日志中提取唯一的分支名称
759
- const branches = new Set<string>()
760
-
761
- logs.value.forEach(log => {
762
- if (log.branch) {
763
- // 分支可能是逗号分隔的多个引用
764
- const refs = log.branch.split(',')
765
- refs.forEach(ref => {
766
- const branch = formatBranchName(ref.trim())
767
- if (branch) {
768
- branches.add(branch)
769
- }
770
- })
771
- }
772
- })
773
-
774
- availableBranches.value = Array.from(branches).sort()
775
- console.log(`从日志中提取了${availableBranches.value.length}个分支`)
776
- }
777
757
 
778
758
  // 处理右键菜单事件
779
759
  function handleContextMenu(row: LogItem, column: any, event: MouseEvent) {
@@ -96,15 +96,6 @@ export const useGitLogStore = defineStore('gitLog', () => {
96
96
  if (data.porcelain !== undefined) {
97
97
  parseStatusPorcelain(data.porcelain)
98
98
  }
99
-
100
- // 根据文件列表判断是否需要更新日志
101
- const hasChanges = fileList.value.length > 0
102
-
103
- // 如果有变化,更新状态
104
- if (hasChanges) {
105
- // 自动刷新日志,但不要显示消息通知
106
- fetchLog(false)
107
- }
108
99
  })
109
100
 
110
101
  // 监听监控状态
@@ -46,7 +46,7 @@ export const useGitStore = defineStore('git', () => {
46
46
  }
47
47
 
48
48
  // 获取分支状态(领先/落后远程)
49
- async function getBranchStatus(force = false) {
49
+ async function getBranchStatus() {
50
50
  if (!isGitRepo.value) return;
51
51
 
52
52
  // 移除时间戳缓存判断,简化逻辑
@@ -102,7 +102,7 @@ export const useGitStore = defineStore('git', () => {
102
102
  }
103
103
 
104
104
  // 获取当前分支
105
- async function getCurrentBranch(skipBranchStatus = false) {
105
+ async function getCurrentBranch() {
106
106
  try {
107
107
  const response = await fetch('/api/branch')
108
108
  const data = await response.json()
@@ -116,7 +116,7 @@ export const useGitStore = defineStore('git', () => {
116
116
  }
117
117
 
118
118
  // 获取所有分支
119
- async function getAllBranches(force = false) {
119
+ async function getAllBranches() {
120
120
  if (!isGitRepo.value) return;
121
121
 
122
122
  // 移除时间戳缓存判断,简化逻辑