zen-gitsync 2.7.10 → 2.7.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zen-gitsync",
3
- "version": "2.7.10",
3
+ "version": "2.7.12",
4
4
  "description": "一个 git 提交的工具",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/gitCommit.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- coloredLog, errorLog, execGitCommand, execSyncGitCommand, showHelp,
3
+ coloredLog, errorLog, execGitCommand, showHelp,
4
4
  getCwd, judgePlatform, judgeLog, judgeHelp, exec_exit, judgeUnmerged, formatDuration,
5
5
  exec_push, execPull, judgeRemote, execDiff, execAddAndCommit, delay, addScriptToPackageJson, addResetScriptToPackageJson
6
6
  } from './utils/index.js';
@@ -87,7 +87,8 @@ async function createGitCommit(options) {
87
87
  if (hasLocalChanges) {
88
88
  // 检查是否有 --no-diff 参数
89
89
  await execDiff()
90
- await execAddAndCommit({statusOutput, commitMessage, exit})
90
+ // 获取实际使用的提交信息(可能是用户交互输入的)
91
+ commitMessage = await execAddAndCommit({statusOutput, commitMessage, exit})
91
92
  statusOutput.includes('use "git pull') && await execPull()
92
93
 
93
94
  // 检查是否有远程更新
@@ -96,7 +97,10 @@ async function createGitCommit(options) {
96
97
  await exec_push({exit, commitMessage})
97
98
  } else {
98
99
  if (statusOutput.includes('use "git push')) {
99
- await exec_push({exit, commitMessage})
100
+ // 获取最近一次提交的实际信息
101
+ const lastCommitResult = await execGitCommand('git log -1 --pretty=%B', {log: false});
102
+ const actualCommitMessage = lastCommitResult.stdout.trim();
103
+ await exec_push({exit, commitMessage: actualCommitMessage || commitMessage})
100
104
  } else if (statusOutput.includes('use "git pull')) {
101
105
  await execPull()
102
106
  } else {