zen-gitsync 2.11.11 → 2.11.14

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.
@@ -937,6 +937,23 @@ export function registerGitOpsRoutes({
937
937
  }
938
938
  });
939
939
 
940
+ // 获取提交完整 diff(用于复制提交内容)
941
+ app.get('/api/commit-diff-full', async (req, res) => {
942
+ try {
943
+ const hash = req.query.hash;
944
+ if (!hash) {
945
+ return res.status(400).json({ success: false, error: '缺少提交哈希参数' });
946
+ }
947
+ const { stdout } = await execGitCommand(`git show ${hash}`);
948
+ // 限制最大 200KB 防止内容过大
949
+ const MAX = 200 * 1024;
950
+ const content = stdout.length > MAX ? stdout.slice(0, MAX) + '\n\n[内容过大,已截断]' : stdout;
951
+ res.json({ success: true, content });
952
+ } catch (error) {
953
+ res.status(500).json({ success: false, error: `获取提交内容失败: ${error.message}` });
954
+ }
955
+ });
956
+
940
957
  // 添加清理Git锁定文件的接口
941
958
  app.post('/api/remove-lock', async (req, res) => {
942
959
  try {