Avoid segfault with 'git branch' when the HEAD is detached
A recent addition to the ref_item struct was not taken care of, leading to a segmentation fault when accessing the (uninitialized) "dest" member. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									209d336ae3
								
							
						
					
					
						commit
						45e2b61401
					
				|  | @ -432,7 +432,9 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str | |||
| 	    is_descendant_of(head_commit, with_commit)) { | ||||
| 		struct ref_item item; | ||||
| 		item.name = xstrdup("(no branch)"); | ||||
| 		item.len = strlen(item.name); | ||||
| 		item.kind = REF_LOCAL_BRANCH; | ||||
| 		item.dest = NULL; | ||||
| 		item.commit = head_commit; | ||||
| 		if (strlen(item.name) > ref_list.maxwidth) | ||||
| 			ref_list.maxwidth = strlen(item.name); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Johannes Schindelin
						Johannes Schindelin