diff --git a/GitVer/GitVer.cpp b/GitVer/GitVer.cpp index 6ee4f12..10dd7be 100644 --- a/GitVer/GitVer.cpp +++ b/GitVer/GitVer.cpp @@ -818,6 +818,8 @@ int main(int argc, TCHAR* argv[], TCHAR* envp[]) int nCmdRet = HandleCreateTagInteractive(); LogCommandEnd(_T("interactive"), dwStartTick, nCmdRet); PrintCommandFailedWithCode(_T("interactive"), nCmdRet); + // 暂停,便于查看输出日志(Windows 控制台) + system("pause"); return nCmdRet; } diff --git a/GitVer/GitVer_tag.cpp b/GitVer/GitVer_tag.cpp index 45f9db5..dc57b2d 100644 --- a/GitVer/GitVer_tag.cpp +++ b/GitVer/GitVer_tag.cpp @@ -230,6 +230,24 @@ int HandleCreateTagInteractive() return 34; } + // ֤شɹ󣬳͵Զ origin + CString strPushCmd; + strPushCmd.Format(_T("cmd /c git push origin %s"), QuoteCmdArg(strNewTag).GetString()); + CString strPushResult = StartProcess(NULL, strPushCmd.GetBuffer(), lpRepoPath); + strPushCmd.ReleaseBuffer(); + strPushResult.Trim(); + if (strPushResult.Left(6).CompareNoCase(_T("fatal:")) == 0 || strPushResult.Left(5).CompareNoCase(_T("error")) == 0) + { + _tprintf(_T(": ͱǩԶʧ: %s\n"), strPushResult.GetString()); + // ѡ񷵻طʾʧܣֻǸ澯سɹ + return 36; + } + else + { + _tprintf(_T("ɹ: ͱǩԶ origin: %s\n"), strNewTag.GetString()); + } + _tprintf(_T("ɹ: ǩ %s\n"), strNewTag.GetString()); + return 0; } \ No newline at end of file