当提交标签失败后,需要删除本地创建的标签
This commit is contained in:
@@ -239,10 +239,28 @@ int HandleCreateTagInteractive()
|
|||||||
if (strPushResult.Left(6).CompareNoCase(_T("fatal:")) == 0 || strPushResult.Left(5).CompareNoCase(_T("error")) == 0)
|
if (strPushResult.Left(6).CompareNoCase(_T("fatal:")) == 0 || strPushResult.Left(5).CompareNoCase(_T("error")) == 0)
|
||||||
{
|
{
|
||||||
_tprintf(_T("警告: 推送标签到远程失败: %s\n"), strPushResult.GetString());
|
_tprintf(_T("警告: 推送标签到远程失败: %s\n"), strPushResult.GetString());
|
||||||
// 这里可选择返回非零表示失败,或只是告警后继续返回成功
|
|
||||||
|
// 推送失败:尝试删除本地标签,避免残留
|
||||||
|
CString strDeleteCmd;
|
||||||
|
strDeleteCmd.Format(_T("cmd /c git tag -d %s"), QuoteCmdArg(strNewTag).GetString());
|
||||||
|
CString strDeleteResult = StartProcess(NULL, strDeleteCmd.GetBuffer(), lpRepoPath);
|
||||||
|
strDeleteCmd.ReleaseBuffer();
|
||||||
|
strDeleteResult.Trim();
|
||||||
|
|
||||||
|
if (strDeleteResult.Left(6).CompareNoCase(_T("fatal:")) == 0 || strDeleteResult.Left(5).CompareNoCase(_T("error")) == 0)
|
||||||
|
{
|
||||||
|
_tprintf(_T("错误: 推送失败,且删除本地标签失败: %s\n"), strDeleteResult.GetString());
|
||||||
|
// 返回错误码 36 表示推送失败(删除也失败)
|
||||||
return 36;
|
return 36;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
_tprintf(_T("已删除本地标签: %s\n"), strNewTag.GetString());
|
||||||
|
// 返回错误码 36 表示推送失败,但本地标签已清理
|
||||||
|
return 36;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_tprintf(_T("成功: 推送标签到远程 origin: %s\n"), strNewTag.GetString());
|
_tprintf(_T("成功: 推送标签到远程 origin: %s\n"), strNewTag.GetString());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user