Staging
v0.5.1
https://github.com/git/git
Revision 297ca895a27a6bbdb7906371d533f72a12ad25b2 authored by Junio C Hamano on 20 January 2022, 23:25:38 UTC, committed by Junio C Hamano on 20 January 2022, 23:25:38 UTC
"git branch -h" incorrectly said "--track[=direct|inherit]",
implying that "--trackinherit" is a valid option, which has been
corrected.
source: <3de40324bea6a1dd9bca2654721471e3809e87d8.1642538935.git.steadmon@google.com>
source: <c3c26192-aee9-185a-e559-b8735139e49c@web.de>

* js/branch-track-inherit:
  branch,checkout: fix --track documentation
2 parent s 50b2d72 + 6327f0e
Raw File
Tip revision: 297ca895a27a6bbdb7906371d533f72a12ad25b2 authored by Junio C Hamano on 20 January 2022, 23:25:38 UTC
Merge branch 'js/branch-track-inherit'
Tip revision: 297ca89
t3429-rebase-edit-todo.sh
#!/bin/sh

test_description='rebase should reread the todo file if an exec modifies it'

. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-rebase.sh

test_expect_success 'setup' '
	test_commit first file &&
	test_commit second file &&
	test_commit third file
'

test_expect_success 'rebase exec modifies rebase-todo' '
	todo=.git/rebase-merge/git-rebase-todo &&
	git rebase HEAD~1 -x "echo exec touch F >>$todo" &&
	test -e F
'

test_expect_success 'rebase exec with an empty list does not exec anything' '
	git rebase HEAD -x "true" 2>output &&
	! grep "Executing: true" output
'

test_expect_success 'loose object cache vs re-reading todo list' '
	GIT_REBASE_TODO=.git/rebase-merge/git-rebase-todo &&
	export GIT_REBASE_TODO &&
	write_script append-todo.sh <<-\EOS &&
	# For values 5 and 6, this yields SHA-1s with the same first two digits
	echo "pick $(git rev-parse --short \
		$(printf "%s\\n" \
			"tree $EMPTY_TREE" \
			"author A U Thor <author@example.org> $1 +0000" \
			"committer A U Thor <author@example.org> $1 +0000" \
			"" \
			"$1" |
		  git hash-object -t commit -w --stdin))" >>$GIT_REBASE_TODO

	shift
	test -z "$*" ||
	echo "exec $0 $*" >>$GIT_REBASE_TODO
	EOS

	git rebase HEAD -x "./append-todo.sh 5 6"
'

test_expect_success 'todo is re-read after reword and squash' '
	write_script reword-editor.sh <<-\EOS &&
	GIT_SEQUENCE_EDITOR="echo \"exec echo $(cat file) >>actual\" >>" \
		git rebase --edit-todo
	EOS

	test_write_lines first third >expected &&
	set_fake_editor &&
	GIT_SEQUENCE_EDITOR="$EDITOR" FAKE_LINES="reword 1 squash 2 fixup 3" \
		GIT_EDITOR=./reword-editor.sh git rebase -i --root third &&
	test_cmp expected actual
'

test_expect_success 're-reading todo doesnt interfere with revert --edit' '
	git reset --hard third &&

	git revert --edit third second &&

	cat >expect <<-\EOF &&
	Revert "second"
	Revert "third"
	third
	second
	first
	EOF
	git log --format="%s" >actual &&
	test_cmp expect actual
'

test_expect_success 're-reading todo doesnt interfere with cherry-pick --edit' '
	git reset --hard first &&

	git cherry-pick --edit second third &&

	cat >expect <<-\EOF &&
	third
	second
	first
	EOF
	git log --format="%s" >actual &&
	test_cmp expect actual
'

test_done
back to top