@@ -66,6 +66,18 @@ IEnumerator IEnumerable.GetEnumerator()
6666
6767 #endregion
6868
69+ /// <summary>
70+ /// Creates a direct reference with the specified name and target
71+ /// </summary>
72+ /// <param name="name">The canonical name of the reference to create.</param>
73+ /// <param name="targetId">Id of the target object.</param>
74+ /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="DirectReference"/></param>
75+ /// <returns>A new <see cref="Reference"/>.</returns>
76+ public virtual DirectReference Add ( string name , ObjectId targetId , string logMessage )
77+ {
78+ return Add ( name , targetId , logMessage , false ) ;
79+ }
80+
6981 /// <summary>
7082 /// Creates a direct reference with the specified name and target
7183 /// </summary>
@@ -74,7 +86,7 @@ IEnumerator IEnumerable.GetEnumerator()
7486 /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="DirectReference"/></param>
7587 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
7688 /// <returns>A new <see cref="Reference"/>.</returns>
77- public virtual DirectReference Add ( string name , ObjectId targetId , string logMessage , bool allowOverwrite = false )
89+ public virtual DirectReference Add ( string name , ObjectId targetId , string logMessage , bool allowOverwrite )
7890 {
7991 Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
8092 Ensure . ArgumentNotNull ( targetId , "targetId" ) ;
@@ -85,18 +97,41 @@ public virtual DirectReference Add(string name, ObjectId targetId, string logMes
8597 }
8698 }
8799
100+ /// <summary>
101+ /// Creates a direct reference with the specified name and target
102+ /// </summary>
103+ /// <param name="name">The canonical name of the reference to create.</param>
104+ /// <param name="targetId">Id of the target object.</param>
105+ /// <returns>A new <see cref="Reference"/>.</returns>
106+ public virtual DirectReference Add ( string name , ObjectId targetId )
107+ {
108+ return Add ( name , targetId , null , false ) ;
109+ }
110+
88111 /// <summary>
89112 /// Creates a direct reference with the specified name and target
90113 /// </summary>
91114 /// <param name="name">The canonical name of the reference to create.</param>
92115 /// <param name="targetId">Id of the target object.</param>
93116 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
94117 /// <returns>A new <see cref="Reference"/>.</returns>
95- public virtual DirectReference Add ( string name , ObjectId targetId , bool allowOverwrite = false )
118+ public virtual DirectReference Add ( string name , ObjectId targetId , bool allowOverwrite )
96119 {
97120 return Add ( name , targetId , null , allowOverwrite ) ;
98121 }
99122
123+ /// <summary>
124+ /// Creates a symbolic reference with the specified name and target
125+ /// </summary>
126+ /// <param name="name">The canonical name of the reference to create.</param>
127+ /// <param name="targetRef">The target reference.</param>
128+ /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="SymbolicReference"/></param>
129+ /// <returns>A new <see cref="Reference"/>.</returns>
130+ public virtual SymbolicReference Add ( string name , Reference targetRef , string logMessage )
131+ {
132+ return Add ( name , targetRef , logMessage , false ) ;
133+ }
134+
100135 /// <summary>
101136 /// Creates a symbolic reference with the specified name and target
102137 /// </summary>
@@ -105,7 +140,7 @@ public virtual DirectReference Add(string name, ObjectId targetId, bool allowOve
105140 /// <param name="logMessage">The optional message to log in the <see cref="ReflogCollection"/> when adding the <see cref="SymbolicReference"/></param>
106141 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
107142 /// <returns>A new <see cref="Reference"/>.</returns>
108- public virtual SymbolicReference Add ( string name , Reference targetRef , string logMessage , bool allowOverwrite = false )
143+ public virtual SymbolicReference Add ( string name , Reference targetRef , string logMessage , bool allowOverwrite )
109144 {
110145 Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
111146 Ensure . ArgumentNotNull ( targetRef , "targetRef" ) ;
@@ -117,14 +152,25 @@ public virtual SymbolicReference Add(string name, Reference targetRef, string lo
117152 }
118153 }
119154
155+ /// <summary>
156+ /// Creates a symbolic reference with the specified name and target
157+ /// </summary>
158+ /// <param name="name">The canonical name of the reference to create.</param>
159+ /// <param name="targetRef">The target reference.</param>
160+ /// <returns>A new <see cref="Reference"/>.</returns>
161+ public virtual SymbolicReference Add ( string name , Reference targetRef )
162+ {
163+ return Add ( name , targetRef , null , false ) ;
164+ }
165+
120166 /// <summary>
121167 /// Creates a symbolic reference with the specified name and target
122168 /// </summary>
123169 /// <param name="name">The canonical name of the reference to create.</param>
124170 /// <param name="targetRef">The target reference.</param>
125171 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
126172 /// <returns>A new <see cref="Reference"/>.</returns>
127- public virtual SymbolicReference Add ( string name , Reference targetRef , bool allowOverwrite = false )
173+ public virtual SymbolicReference Add ( string name , Reference targetRef , bool allowOverwrite )
128174 {
129175 return Add ( name , targetRef , null , allowOverwrite ) ;
130176 }
@@ -140,6 +186,18 @@ public virtual void Remove(Reference reference)
140186 Proxy . git_reference_remove ( repo . Handle , reference . CanonicalName ) ;
141187 }
142188
189+ /// <summary>
190+ /// Rename an existing reference with a new name, and update the reflog
191+ /// </summary>
192+ /// <param name="reference">The reference to rename.</param>
193+ /// <param name="newName">The new canonical name.</param>
194+ /// <param name="logMessage">Message added to the reflog.</param>
195+ /// <returns>A new <see cref="Reference"/>.</returns>
196+ public virtual Reference Rename ( Reference reference , string newName , string logMessage )
197+ {
198+ return Rename ( reference , newName , logMessage , false ) ;
199+ }
200+
143201 /// <summary>
144202 /// Rename an existing reference with a new name, and update the reflog
145203 /// </summary>
@@ -148,7 +206,7 @@ public virtual void Remove(Reference reference)
148206 /// <param name="logMessage">Message added to the reflog.</param>
149207 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
150208 /// <returns>A new <see cref="Reference"/>.</returns>
151- public virtual Reference Rename ( Reference reference , string newName , string logMessage = null , bool allowOverwrite = false )
209+ public virtual Reference Rename ( Reference reference , string newName , string logMessage , bool allowOverwrite )
152210 {
153211 Ensure . ArgumentNotNull ( reference , "reference" ) ;
154212 Ensure . ArgumentNotNullOrEmptyString ( newName , "newName" ) ;
@@ -166,14 +224,25 @@ public virtual Reference Rename(Reference reference, string newName, string logM
166224 }
167225 }
168226
227+ /// <summary>
228+ /// Rename an existing reference with a new name
229+ /// </summary>
230+ /// <param name="reference">The reference to rename.</param>
231+ /// <param name="newName">The new canonical name.</param>
232+ /// <returns>A new <see cref="Reference"/>.</returns>
233+ public virtual Reference Rename ( Reference reference , string newName )
234+ {
235+ return Rename ( reference , newName , null , false ) ;
236+ }
237+
169238 /// <summary>
170239 /// Rename an existing reference with a new name
171240 /// </summary>
172241 /// <param name="reference">The reference to rename.</param>
173242 /// <param name="newName">The new canonical name.</param>
174243 /// <param name="allowOverwrite">True to allow silent overwriting a potentially existing reference, false otherwise.</param>
175244 /// <returns>A new <see cref="Reference"/>.</returns>
176- public virtual Reference Rename ( Reference reference , string newName , bool allowOverwrite = false )
245+ public virtual Reference Rename ( Reference reference , string newName , bool allowOverwrite )
177246 {
178247 return Rename ( reference , newName , null , allowOverwrite ) ;
179248 }
0 commit comments