1、无参数时,需要暂停不直接退出。
2、创建标签后,需要上传到远程仓库中。
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user