From e5765bfdc89f131d03051ba4963819fdfe252503 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 12 Mar 2020 18:06:23 +0000 Subject: 45541: internal: vcs_info git: Add a test case repository for rebase-apply situations --- Functions/VCS_Info/test-repo-git-rebase-apply | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 Functions/VCS_Info/test-repo-git-rebase-apply (limited to 'Functions/VCS_Info/test-repo-git-rebase-apply') diff --git a/Functions/VCS_Info/test-repo-git-rebase-apply b/Functions/VCS_Info/test-repo-git-rebase-apply new file mode 100755 index 000000000..cb4ea4f58 --- /dev/null +++ b/Functions/VCS_Info/test-repo-git-rebase-apply @@ -0,0 +1,49 @@ +#!/usr/local/bin/zsh -f +# +# This script creates a test repository for testing the git backend's behaviour during rebase-apply operations. +# +# It works in ./vcs-test/. +# +# Suggested zshrc settings: +# +# autoload vcs_info +# precmd() { vcs_info; typeset -pm vcs\* } +# zstyle ':vcs_info:*' actionformats %m +# zstyle ':vcs_info:*' patch-format '[%n+%c=%a] [%p] [%u]' +# zstyle :vcs_info:\*gen-applied-string\* hooks f1 +# +vi-f1() { typeset -p argv hook_com } +# zstyle :vcs_info:\*gen-unapplied-string\* hooks f2 +# +vi-f2() { typeset -p argv hook_com } +# zstyle :vcs_info:\* get-unapplied true +# +mkdir "vcs-test" +cd "vcs-test" +git init + +append_lines() { for 1; do echo line from r$1 >> iota && git commit -am "r$1: Append a line"; done } + +echo "This is the file 'iota'." > iota +git add iota +git commit -m "r1: Add iota" +git tag rebase_onto_this HEAD + +# Make another change to iota +append_lines 2 +git tag rebase_from_this HEAD + +# Make non-conflicting changes +for 1 in 3 4 5 6; do + touch kappa$1 + git add kappa$1 + git commit -m "r${1}: non-conflicting change" +done + +# Make more changes to iota +append_lines 7 8 9 + +# Specify a rebase that would create the history [1,3,4,5,6,7,8,9]. +# This will conflict because r7 depends on r2 which is not included. +git checkout -b myref +git rebase --onto=rebase_onto_this rebase_from_this myref + + -- cgit v1.2.3 From 75c3664a62010dfae620d77930f8ea5aae78b602 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 29 Jan 2022 13:10:26 +0000 Subject: unposted: vcs_info git: Teach the rebase-apply test case generator to also generate rebase-merge test cases --- ChangeLog | 5 +++++ Functions/VCS_Info/test-repo-git-rebase-apply | 12 +++++++++++- Functions/VCS_Info/test-repo-git-rebase-merge | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) create mode 120000 Functions/VCS_Info/test-repo-git-rebase-merge (limited to 'Functions/VCS_Info/test-repo-git-rebase-apply') diff --git a/ChangeLog b/ChangeLog index ff9bc0bce..57c26fb38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-01-29 Daniel Shahaf + * unposted: Functions/VCS_Info/test-repo-git-rebase-apply, + Functions/VCS_Info/test-repo-git-rebase-merge: vcs_info git: + Teach the rebase-apply test case generator to also generate + rebase-merge test cases + * unposted: Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: Add a missing guard against redefining a function. diff --git a/Functions/VCS_Info/test-repo-git-rebase-apply b/Functions/VCS_Info/test-repo-git-rebase-apply index cb4ea4f58..ce49690cd 100755 --- a/Functions/VCS_Info/test-repo-git-rebase-apply +++ b/Functions/VCS_Info/test-repo-git-rebase-apply @@ -44,6 +44,16 @@ append_lines 7 8 9 # Specify a rebase that would create the history [1,3,4,5,6,7,8,9]. # This will conflict because r7 depends on r2 which is not included. git checkout -b myref -git rebase --onto=rebase_onto_this rebase_from_this myref +case $0:P in + (*/test-repo-git-rebase-apply) + git rebase --onto=rebase_onto_this rebase_from_this myref + ;; + (*/test-repo-git-rebase-merge) + git -c core.editor=true rebase -i --onto=rebase_onto_this rebase_from_this myref + ;; + (*) + echo >&2 "$0: unrecognized basename" + ;; +esac diff --git a/Functions/VCS_Info/test-repo-git-rebase-merge b/Functions/VCS_Info/test-repo-git-rebase-merge new file mode 120000 index 000000000..fce9e9178 --- /dev/null +++ b/Functions/VCS_Info/test-repo-git-rebase-merge @@ -0,0 +1 @@ +test-repo-git-rebase-apply \ No newline at end of file -- cgit v1.2.3