rebase --abort: do not update branch ref
If a non-interactive rebase of a ref fails at commit X and is aborted by the user, the ref will be updated twice. First to point at X (with the reflog message "rebase finished: $head_name onto $onto"), and then back to $orig_head. It should not be updated at all. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									1c7d402b3e
								
							
						
					
					
						commit
						729ec9e23a
					
				|  | @ -274,15 +274,16 @@ do | ||||||
| 			die "No rebase in progress?" | 			die "No rebase in progress?" | ||||||
|  |  | ||||||
| 		git rerere clear | 		git rerere clear | ||||||
| 		if test -d "$dotest" |  | ||||||
| 		then | 		test -d "$dotest" || dotest="$GIT_DIR"/rebase-apply | ||||||
| 			GIT_QUIET=$(cat "$dotest/quiet") |  | ||||||
| 			move_to_original_branch | 		head_name="$(cat "$dotest"/head-name)" && | ||||||
| 		else | 		case "$head_name" in | ||||||
| 			dotest="$GIT_DIR"/rebase-apply | 		refs/*) | ||||||
| 			GIT_QUIET=$(cat "$dotest/quiet") | 			git symbolic-ref HEAD $head_name || | ||||||
| 			move_to_original_branch | 			die "Could not move back to $head_name" | ||||||
| 		fi | 			;; | ||||||
|  | 		esac | ||||||
| 		git reset --hard $(cat "$dotest/orig-head") | 		git reset --hard $(cat "$dotest/orig-head") | ||||||
| 		rm -r "$dotest" | 		rm -r "$dotest" | ||||||
| 		exit | 		exit | ||||||
|  |  | ||||||
|  | @ -72,6 +72,18 @@ testrebase() { | ||||||
| 		test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && | 		test $(git rev-parse to-rebase) = $(git rev-parse pre-rebase) && | ||||||
| 		test ! -d "$dotest" | 		test ! -d "$dotest" | ||||||
| 	' | 	' | ||||||
|  |  | ||||||
|  | 	test_expect_success "rebase$type --abort does not update reflog" ' | ||||||
|  | 		cd "$work_dir" && | ||||||
|  | 		# Clean up the state from the previous one | ||||||
|  | 		git reset --hard pre-rebase && | ||||||
|  | 		git reflog show to-rebase > reflog_before && | ||||||
|  | 		test_must_fail git rebase$type master && | ||||||
|  | 		git rebase --abort && | ||||||
|  | 		git reflog show to-rebase > reflog_after && | ||||||
|  | 		test_cmp reflog_before reflog_after && | ||||||
|  | 		rm reflog_before reflog_after | ||||||
|  | 	' | ||||||
| } | } | ||||||
|  |  | ||||||
| testrebase "" .git/rebase-apply | testrebase "" .git/rebase-apply | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Martin von Zweigbergk
						Martin von Zweigbergk