for-each-ref: skip and warn about broken ref names
Print a warning message for any bad ref names we find in the repo and skip them so callers don't have to deal with parsing them. It might be useful in the future to have a flag where we would not skip these refs for those callers that want to and are prepared (for example by using a --format argument with %0 as a delimiter after the ref name). Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									d0f810f0bc
								
							
						
					
					
						commit
						971c41c717
					
				|  | @ -839,6 +839,11 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f | ||||||
| 	struct refinfo *ref; | 	struct refinfo *ref; | ||||||
| 	int cnt; | 	int cnt; | ||||||
|  |  | ||||||
|  | 	if (flag & REF_BAD_NAME) { | ||||||
|  | 		  warning("ignoring ref with broken name %s", refname); | ||||||
|  | 		  return 0; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	if (*cb->grab_pattern) { | 	if (*cb->grab_pattern) { | ||||||
| 		const char **pattern; | 		const char **pattern; | ||||||
| 		int namelen = strlen(refname); | 		int namelen = strlen(refname); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Ronnie Sahlberg
						Ronnie Sahlberg