@@ -73,24 +73,22 @@ IEnumerator IEnumerable.GetEnumerator()
73
73
/// Creates an annotated tag with the specified name.
74
74
/// </summary>
75
75
/// <param name = "name">The name.</param>
76
- /// <param name = "objectish">Revparse spec of the target object.</param>
76
+ /// <param name = "targetId">Id of the target object.</param>
77
77
/// <param name = "tagger">The tagger.</param>
78
78
/// <param name = "message">The message.</param>
79
79
/// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
80
80
/// <returns></returns>
81
- public virtual Tag Add ( string name , string objectish , Signature tagger , string message , bool allowOverwrite = false )
81
+ public virtual Tag Add ( string name , ObjectId targetId , Signature tagger , string message , bool allowOverwrite = false )
82
82
{
83
83
Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
84
- Ensure . ArgumentNotNullOrEmptyString ( objectish , "objectish " ) ;
84
+ Ensure . ArgumentNotNull ( targetId , "targetId " ) ;
85
85
Ensure . ArgumentNotNull ( tagger , "tagger" ) ;
86
86
Ensure . ArgumentNotNull ( message , "message" ) ;
87
87
88
- GitObject objectToTag = repo . Lookup ( objectish , GitObjectType . Any , LookUpOptions . ThrowWhenNoGitObjectHasBeenFound ) ;
89
-
90
88
string prettifiedMessage = ObjectDatabase . PrettifyMessage ( message ) ;
91
89
92
90
int res ;
93
- using ( var objectPtr = new ObjectSafeWrapper ( objectToTag . Id , repo ) )
91
+ using ( var objectPtr = new ObjectSafeWrapper ( targetId , repo ) )
94
92
using ( SignatureSafeHandle taggerHandle = tagger . BuildHandle ( ) )
95
93
{
96
94
GitOid oid ;
@@ -102,6 +100,24 @@ public virtual Tag Add(string name, string objectish, Signature tagger, string m
102
100
return this [ name ] ;
103
101
}
104
102
103
+ /// <summary>
104
+ /// Creates an annotated tag with the specified name.
105
+ /// </summary>
106
+ /// <param name = "name">The name.</param>
107
+ /// <param name = "objectish">Revparse spec for the target object.</param>
108
+ /// <param name = "tagger">The tagger.</param>
109
+ /// <param name = "message">The message.</param>
110
+ /// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
111
+ /// <returns></returns>
112
+ public virtual Tag Add ( string name , string objectish , Signature tagger , string message , bool allowOverwrite = false )
113
+ {
114
+ Ensure . ArgumentNotNullOrEmptyString ( objectish , "target" ) ;
115
+
116
+ GitObject objectToTag = repo . Lookup ( objectish , GitObjectType . Any , LookUpOptions . ThrowWhenNoGitObjectHasBeenFound ) ;
117
+
118
+ return Add ( name , objectToTag . Id , tagger , message , allowOverwrite ) ;
119
+ }
120
+
105
121
internal static string PrettifyMessage ( string message )
106
122
{
107
123
var buffer = new byte [ NativeMethods . GIT_PATH_MAX ] ;
@@ -130,18 +146,16 @@ public virtual Tag Create(string name, string target, Signature tagger, string m
130
146
/// Creates a lightweight tag with the specified name.
131
147
/// </summary>
132
148
/// <param name = "name">The name.</param>
133
- /// <param name = "objectish">Revparse spec of the target object.</param>
149
+ /// <param name = "targetId">Id of the target object.</param>
134
150
/// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
135
151
/// <returns></returns>
136
- public virtual Tag Add ( string name , string objectish , bool allowOverwrite = false )
152
+ public virtual Tag Add ( string name , ObjectId targetId , bool allowOverwrite = false )
137
153
{
138
154
Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
139
- Ensure . ArgumentNotNullOrEmptyString ( objectish , "objectish" ) ;
140
-
141
- GitObject objectToTag = repo . Lookup ( objectish , GitObjectType . Any , LookUpOptions . ThrowWhenNoGitObjectHasBeenFound ) ;
155
+ Ensure . ArgumentNotNull ( targetId , "targetId" ) ;
142
156
143
157
int res ;
144
- using ( var objectPtr = new ObjectSafeWrapper ( objectToTag . Id , repo ) )
158
+ using ( var objectPtr = new ObjectSafeWrapper ( targetId , repo ) )
145
159
{
146
160
GitOid oid ;
147
161
res = NativeMethods . git_tag_create_lightweight ( out oid , repo . Handle , name , objectPtr . ObjectPtr , allowOverwrite ) ;
@@ -152,6 +166,22 @@ public virtual Tag Add(string name, string objectish, bool allowOverwrite = fals
152
166
return this [ name ] ;
153
167
}
154
168
169
+ /// <summary>
170
+ /// Creates a lightweight tag with the specified name.
171
+ /// </summary>
172
+ /// <param name = "name">The name.</param>
173
+ /// <param name = "objectish">Revparse spec for the target object.</param>
174
+ /// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing tag, false otherwise.</param>
175
+ /// <returns></returns>
176
+ public virtual Tag Add ( string name , string objectish , bool allowOverwrite = false )
177
+ {
178
+ Ensure . ArgumentNotNullOrEmptyString ( objectish , "objectish" ) ;
179
+
180
+ GitObject objectToTag = repo . Lookup ( objectish , GitObjectType . Any , LookUpOptions . ThrowWhenNoGitObjectHasBeenFound ) ;
181
+
182
+ return Add ( name , objectToTag . Id , allowOverwrite ) ;
183
+ }
184
+
155
185
/// <summary>
156
186
/// Creates a lightweight tag with the specified name.
157
187
/// </summary>
0 commit comments