File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -260,14 +260,23 @@ static void parse_treeish_arg(const char **argv,
260
260
/* Remotes are only allowed to fetch actual refs */
261
261
if (remote ) {
262
262
char * ref = NULL ;
263
- if (!dwim_ref (name , strlen (name ), sha1 , & ref ))
264
- die ("no such ref: %s" , name );
263
+ const char * refname , * colon = NULL ;
264
+
265
+ colon = strchr (name , ':' );
266
+ if (colon )
267
+ refname = xstrndup (name , colon - name );
268
+ else
269
+ refname = name ;
270
+
271
+ if (!dwim_ref (refname , strlen (refname ), sha1 , & ref ))
272
+ die ("no such ref: %s" , refname );
273
+ if (refname != name )
274
+ free ((void * )refname );
265
275
free (ref );
266
276
}
267
- else {
268
- if (get_sha1 (name , sha1 ))
269
- die ("Not a valid object name" );
270
- }
277
+
278
+ if (get_sha1 (name , sha1 ))
279
+ die ("Not a valid object name" );
271
280
272
281
commit = lookup_commit_reference_gently (sha1 , 1 );
273
282
if (commit ) {
You can’t perform that action at this time.
0 commit comments