diff options
author | Rohit Ashiwal <rohit.ashiwal265@gmail.com> | 2019-11-01 19:30:00 +0530 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-02 15:36:23 +0900 |
commit | cbd8db17acb77ea646c739bf96c31fe7484bc491 (patch) | |
tree | 3648b99f63cbb6aac5f5f89700f24dc7fa141d49 /t | |
parent | sequencer: allow callers of read_author_script() to ignore fields (diff) | |
download | tgif-cbd8db17acb77ea646c739bf96c31fe7484bc491.tar.xz |
rebase -i: support --committer-date-is-author-date
rebase am already has this flag to "lie" about the committer date
by changing it to the author date. Let's add the same for
interactive machinery.
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t3422-rebase-incompatible-options.sh | 1 | ||||
-rwxr-xr-x | t/t3433-rebase-options-compatibility.sh | 37 |
2 files changed, 37 insertions, 1 deletions
diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index 4342f79eea..7402f7e3da 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -61,7 +61,6 @@ test_rebase_am_only () { } test_rebase_am_only --whitespace=fix -test_rebase_am_only --committer-date-is-author-date test_rebase_am_only -C4 test_expect_success REBASE_P '--preserve-merges incompatible with --signoff' ' diff --git a/t/t3433-rebase-options-compatibility.sh b/t/t3433-rebase-options-compatibility.sh index 2e16e00a9d..a98cfe18b7 100755 --- a/t/t3433-rebase-options-compatibility.sh +++ b/t/t3433-rebase-options-compatibility.sh @@ -7,6 +7,9 @@ test_description='tests to ensure compatibility between am and interactive backe . ./test-lib.sh +GIT_AUTHOR_DATE="1999-04-02T08:03:20+05:30" +export GIT_AUTHOR_DATE + # This is a special case in which both am and interactive backends # provide the same output. It was done intentionally because # both the backends fall short of optimal behaviour. @@ -26,8 +29,13 @@ test_expect_success 'setup' ' EOF git commit -am "update file" && git tag side && + test_commit commit1 foo foo1 && + test_commit commit2 foo foo2 && + test_commit commit3 foo foo3 && git checkout --orphan master && + git rm --cached foo && + rm foo && sed -e "s/^|//" >file <<-\EOF && |line 1 | line 2 @@ -62,4 +70,33 @@ test_expect_success '--ignore-whitespace works with interactive backend' ' test_cmp expect file ' +test_expect_success '--committer-date-is-author-date works with am backend' ' + git commit --amend && + git rebase --committer-date-is-author-date HEAD^ && + git show HEAD --pretty="format:%ai" >authortime && + git show HEAD --pretty="format:%ci" >committertime && + test_cmp authortime committertime +' + +test_expect_success '--committer-date-is-author-date works with interactive backend' ' + git commit --amend && + git rebase -i --committer-date-is-author-date HEAD^ && + git show HEAD --pretty="format:%ai" >authortime && + git show HEAD --pretty="format:%ci" >committertime && + test_cmp authortime committertime +' + +test_expect_success '--committer-date-is-author-date works with rebase -r' ' + git checkout side && + git merge --no-ff commit3 && + git rebase -r --root --committer-date-is-author-date && + git rev-list HEAD >rev_list && + while read HASH + do + git show $HASH --pretty="format:%ai" >authortime + git show $HASH --pretty="format:%ci" >committertime + test_cmp authortime committertime + done <rev_list +' + test_done |