File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,23 @@ Branch_branch_name__get__(Branch *self)
149
149
return Error_set (err );
150
150
}
151
151
152
+ PyDoc_STRVAR (Branch_raw_branch_name__doc__ ,
153
+ "The name of the local or remote branch (bytes)." );
154
+
155
+ PyObject *
156
+ Branch_raw_branch_name__get__ (Branch * self )
157
+ {
158
+ int err ;
159
+ const char * c_name ;
160
+
161
+ CHECK_REFERENCE (self );
162
+
163
+ err = git_branch_name (& c_name , self -> reference );
164
+ if (err == GIT_OK )
165
+ return PyBytes_FromString (c_name );
166
+ else
167
+ return Error_set (err );
168
+ }
152
169
153
170
PyDoc_STRVAR (Branch_remote_name__doc__ ,
154
171
"The name of the remote set to be the upstream of this branch." );
@@ -263,6 +280,7 @@ PyMethodDef Branch_methods[] = {
263
280
264
281
PyGetSetDef Branch_getseters [] = {
265
282
GETTER (Branch , branch_name ),
283
+ GETTER (Branch , raw_branch_name ),
266
284
GETTER (Branch , remote_name ),
267
285
GETSET (Branch , upstream ),
268
286
GETTER (Branch , upstream_name ),
Original file line number Diff line number Diff line change @@ -111,10 +111,12 @@ def test_branch_name(self):
111
111
branch = self .repo .branches .get ('master' )
112
112
assert branch .branch_name == 'master'
113
113
assert branch .name == 'refs/heads/master'
114
+ assert branch .raw_branch_name == branch .branch_name .encode ('utf-8' )
114
115
115
116
branch = self .repo .branches .get ('i18n' )
116
117
assert branch .branch_name == 'i18n'
117
118
assert branch .name == 'refs/heads/i18n'
119
+ assert branch .raw_branch_name == branch .branch_name .encode ('utf-8' )
118
120
119
121
def test_with_commit (self ):
120
122
branches = self .repo .branches .with_commit (EXCLUSIVE_MASTER_COMMIT )
You can’t perform that action at this time.
0 commit comments