我有CREATE PROCEDURE [dbo].[sp_InsertExceptions]
-- Add the parameters for the stored procedure here
@pXML XML
AS
BEGIN
SET XACT_ABORT ON;
BEGIN TRY
BEGIN TRANSACTION;
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @XML AS XML, @hDoc AS INT
print convert(varchar(max), @pRI)
EXEC sp_xml_preparedocument @hDoc OUTPUT, @pRI
{Put your shredding code here}
EXEC sp_xml_removedocument @hDoc
COMMIT TRANSACTION;
EXECUTE sp_GetErrors --This stored procedure is used to retrieve data
--previously inserted
END TRY
BEGIN CATCH
-- Execute error retrieval routine.
EXECUTE usp_GetErrorInfo; --This stored procedure gets your error
--information and can also store it in the
--database to track errors
-- Test XACT_STATE:
-- If 1, the transaction is committable.
-- If -1, the transaction is uncommittable and should
-- be rolled back.
-- XACT_STATE = 0 means that there is no transaction and
-- a commit or rollback operation would generate an error.
-- Test whether the transaction is uncommittable.
IF (XACT_STATE()) = -1
BEGIN
PRINT
N'The transaction is in an uncommittable state.' +
'Rolling back transaction.'
ROLLBACK TRANSACTION;
END;
-- Test whether the transaction is committable.
IF (XACT_STATE()) = 1
BEGIN
PRINT
N'The transaction is committable.' +
'Committing transaction.'
COMMIT TRANSACTION;
END;
END CATCH;
twoline的别名。
git log
效果很好。
输出#1:
[alias]
l = "log --graph --date=relative --decorate --abbrev-commit --pretty=format:'%h - %aD (%ar)%d%n %s - %an'"
但是,使用$ git l -2
* 714a14e - Fri, 18 Nov 2016 00:04:19 -0800 (3 months ago) (HEAD -> dev, github/dev)
| Adding BitSet implementation. - hippy
* 87dce5f - Sat, 10 Dec 2016 12:50:40 -0800 (9 weeks ago)
| Turning on recommended code analysis rules. - hippy
,我可以在作者姓名后面看到一个管道。
输出#2:
--name-status
如果我要在最后添加$ git l -2 --name-status
* 714a14e - Fri, 18 Nov 2016 00:04:19 -0800 (3 months ago) (HEAD -> dev, github/dev)
| Adding BitSet implementation. - hippy|
| M README.md
| A rm.Extensions/BitSet.cs
| M rm.Extensions/Properties/AssemblyInfo.cs
| M rm.Extensions/rm.Extensions.csproj
| A rm.ExtensionsTest/BitSetTest.cs
| M rm.ExtensionsTest/rm.ExtensionsTest.csproj
* 87dce5f - Sat, 10 Dec 2016 12:50:40 -0800 (9 weeks ago)
| Turning on recommended code analysis rules. - hippy|
| M rm.Extensions/GraphExtension.cs
| M rm.Extensions/Wrapped.cs
| M rm.Extensions/WrappedExtension.cs
| M rm.Extensions/rm.Extensions.csproj
(所以%n
),输出#1 会变为3行而非2行。
我希望...%an%n
最好看起来像这样,但在文件列表之前可以使用额外的换行符:
--name-status
这对我来说似乎是一个错误,因为我在pretty formats man page中找不到任何内容。
$ git l -2 --name-status
* 714a14e - Fri, 18 Nov 2016 00:04:19 -0800 (3 months ago) (HEAD -> dev, github/dev)
| Adding BitSet implementation. - hippy
| M README.md
| A rm.Extensions/BitSet.cs
| M rm.Extensions/Properties/AssemblyInfo.cs
| M rm.Extensions/rm.Extensions.csproj
| A rm.ExtensionsTest/BitSetTest.cs
| M rm.ExtensionsTest/rm.ExtensionsTest.csproj
|
* 87dce5f - Sat, 10 Dec 2016 12:50:40 -0800 (9 weeks ago)
| Turning on recommended code analysis rules. - hippy
| M rm.Extensions/GraphExtension.cs
| M rm.Extensions/Wrapped.cs
| M rm.Extensions/WrappedExtension.cs
| M rm.Extensions/rm.Extensions.csproj
如何解决$ git version
git version 2.11.0.windows.1
?
注意:我在此处提交了一个错误(bug link),并会相应更新故障单。
答案 0 :(得分:0)
这显然是一个错误(垂直条位于错误的位置;请注意--name-status
项下方的间隙)。幸运的是,有一个简单的解决方法:使用tformat
而不是普通format
。不同之处在于,tformat
会根据需要添加换行符,如果不需要则不会。
请注意,--format
(自Git版本1.6.3起可用)基本上是--pretty=tformat:
的同义词,因为大多数面向用户的代码通常应使用tformat
。