git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH/RFC] branch: add tests for new copy branch feature
@ 2017-05-28 22:56 Sahil Dua
  2017-05-28 23:30 ` Ævar Arnfjörð Bjarmason
                   ` (2 more replies)
  0 siblings, 3 replies; 49+ messages in thread
From: Sahil Dua @ 2017-05-28 22:56 UTC (permalink / raw)
  To: git

New feature - copying a branch along with its config section.

Aim is to have an option -c for copying a branch just like -m option for
renaming a branch.

This commit adds a few basic tests for getting any suggestions/feedback
about expected behavior for this new feature.

Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
---
 t/t3200-branch.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index fe62e7c775da..2c95ed6ebf3c 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -341,6 +341,59 @@ test_expect_success 'config information was renamed, too' '
 	test_must_fail git config branch.s/s/dummy
 '
 
+test_expect_success 'git branch -c dumps usage' '
+	test_expect_code 128 git branch -c 2>err &&
+	test_i18ngrep "branch name required" err
+'
+
+git config branch.d.dummy Hello
+
+test_expect_success 'git branch -c d e should work' '
+	git branch -l d &&
+	git reflog exists refs/heads/d &&
+	git branch -c d e &&
+	git reflog exists refs/heads/d &&
+	git reflog exists refs/heads/e
+'
+
+test_expect_success 'config information was copied, too' '
+	test $(git config branch.e.dummy) = Hello &&
+	test $(git config branch.d.dummy) = Hello
+'
+
+git config branch.f/f.dummy Hello
+
+test_expect_success 'git branch -c f/f g/g should work' '
+	git branch -l f/f &&
+	git reflog exists refs/heads/f/f &&
+	git branch -c f/f g/g &&
+	git reflog exists refs/heads/f/f &&
+	git reflog exists refs/heads/g/g
+'
+
+test_expect_success 'config information was copied, too' '
+	test $(git config branch.f/f.dummy) = Hello &&
+	test $(git config branch.g/g.dummy) = Hello
+'
+
+test_expect_success 'git branch -c m2 m2 should work' '
+	git branch -l m2 &&
+	git reflog exists refs/heads/m2 &&
+	git branch -c m2 m2 &&
+	git reflog exists refs/heads/m2
+'
+
+test_expect_success 'git branch -c a a/a should fail' '
+	git branch -l a &&
+	git reflog exists refs/heads/a &&
+	test_must_fail git branch -c a a/a
+'
+
+test_expect_success 'git branch -c b/b b should fail' '
+	git branch -l b/b &&
+	test_must_fail git branch -c b/b b
+'
+
 test_expect_success 'deleting a symref' '
 	git branch target &&
 	git symbolic-ref refs/heads/symref refs/heads/target &&

--
https://github.com/git/git/pull/363

^ permalink raw reply related	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2017-06-19 14:51 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-28 22:56 [PATCH/RFC] branch: add tests for new copy branch feature Sahil Dua
2017-05-28 23:30 ` Ævar Arnfjörð Bjarmason
2017-05-29 20:41   ` Sahil Dua
2017-05-29 20:50     ` Ævar Arnfjörð Bjarmason
2017-05-29 22:23       ` Sahil Dua
2017-06-13 17:55       ` Jonathan Nieder
2017-06-13 18:01         ` Ævar Arnfjörð Bjarmason
2017-06-13 18:08           ` Jonathan Nieder
2017-05-29  2:09 ` Junio C Hamano
2017-05-29 19:39   ` Sahil Dua
2017-05-31 23:35 ` [PATCH/RFC v2 1/6] " Sahil Dua
2017-05-31 23:35   ` [PATCH/RFC v2 5/6] config: add copy config section logic Sahil Dua
2017-05-31 23:35   ` [PATCH/RFC v2 4/6] config: modify function signature to include copy argument Sahil Dua
2017-05-31 23:35   ` [PATCH/RFC v2 2/6] branch: add copy branch option Sahil Dua
2017-06-01  1:50     ` Junio C Hamano
2017-06-01 16:09       ` Sahil Dua
2017-05-31 23:35   ` [PATCH/RFC v2 3/6] config: abstract out create section from key logic Sahil Dua
2017-05-31 23:35   ` [PATCH/RFC v2 6/6] branch: don't copy or rename config when same branch name Sahil Dua
2017-06-01 18:35   ` [PATCH/RFC v3 1/3] branch: add tests for new copy branch feature Sahil Dua
2017-06-01 18:35     ` [PATCH/RFC v3 2/3] config: abstract out create section from key logic Sahil Dua
2017-06-01 18:35     ` [PATCH/RFC v3 3/3] branch: add copy branch feature implementation Sahil Dua
2017-06-01 18:59       ` Ævar Arnfjörð Bjarmason
2017-06-01 22:05         ` Sahil Dua
2017-06-05 20:40     ` [PATCH/RFC v4 1/3] branch: add tests for new copy branch feature Sahil Dua
2017-06-05 20:40       ` [PATCH/RFC v4 2/3] config: abstract out create section from key logic Sahil Dua
2017-06-05 20:40       ` [PATCH/RFC v4 3/3] branch: add copy branch feature implementation Sahil Dua
2017-06-05 20:52         ` Sahil Dua
2017-06-06  0:10           ` Junio C Hamano
2017-06-06  0:14             ` Junio C Hamano
2017-06-06  7:39             ` Ævar Arnfjörð Bjarmason
2017-06-06 10:13               ` Sahil Dua
2017-06-06 12:03               ` Junio C Hamano
2017-06-13 16:17       ` [PATCH 1/3] config: create a function to format section headers Sahil Dua
2017-06-13 16:17         ` [PATCH 2/3] branch: add test for -m renaming multiple config sections Sahil Dua
2017-06-13 17:10           ` Junio C Hamano
2017-06-13 17:31             ` Ævar Arnfjörð Bjarmason
2017-06-13 17:39               ` Junio C Hamano
2017-06-13 17:53                 ` Ævar Arnfjörð Bjarmason
2017-06-18 21:17           ` [PATCH v2 " Sahil Dua
2017-06-13 16:17         ` [PATCH 3/3] branch: add a --copy (-c) option to go with --move (-m) Sahil Dua
2017-06-13 17:05           ` Junio C Hamano
2017-06-13 17:30             ` Junio C Hamano
2017-06-14  8:01               ` Sahil Dua
2017-06-18 21:19           ` [PATCH v2 " Sahil Dua
2017-06-13 17:06         ` [PATCH 1/3] config: create a function to format section headers Junio C Hamano
2017-06-13 17:09         ` Ævar Arnfjörð Bjarmason
2017-06-18 21:16         ` [PATCH v2 " Sahil Dua
2017-06-19 12:08           ` Ramsay Jones
2017-06-19 14:51             ` Sahil Dua

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).