git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] t3200: add test for single parameter passed to -m option

From
Sahil Dua <sahildua2305@gmail.com>
Date
Jun 11, 2017, 11:42 UTC
Message-ID
<0102015c96f631f3-557a7960-2557-4aab-894b-efccf6728f31-000000@eu-west-1.amazonses.com>
In-Reply-To
<0102015c7a68c647-372a5a13-5412-4838-921d-66980bac4099-000000@eu-west-1.amazonses.com>

Add a test for the case when only one parameter is passed to '-m' (move/rename) option.

For example - if 'git branch -m bbb' is run, it should rename the currently checked out branch to bbb. There was no test for this particular case with only one parameter for -m option. However, there's one similar test case for -M option.

Add test for making sure HEAD points to the bbb (new branch name). Also add a test for making sure the reflog that is moved to 'bbb' retains entries created for the currently checked out branch.

Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
---
 t/t3200-branch.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index fe62e7c775da6..720400c0e42af 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -100,6 +100,20 @@ test_expect_success 'git branch -m n/n n should work' '
 	git reflog exists refs/heads/n
 '
 
+test_expect_success 'git branch -m bbb should rename checked out branch' '
+	test_when_finished git branch -D bbb &&
+	test_when_finished git checkout master &&
+	git checkout -b aaa &&
+	git commit --allow-empty -m "a new commit" &&
+	git rev-parse aaa@{0} >expect &&
+	git branch -m bbb &&
+	git rev-parse bbb@{1} >actual &&
+	test_cmp expect actual &&
+	git symbolic-ref HEAD >actual &&
+	echo refs/heads/bbb >expect &&
+	test_cmp expect actual
+'
+
 test_expect_success 'git branch -m o/o o should fail when o/p exists' '
 	git branch o/o &&
 	git branch o/p &&

--
https://github.com/git/git/pull/371
Previous: Sahil DuaNext: Junio C Hamano
Message 4 of 6 in “t3200: add test for single parameter passed to -m option”
  1. t3200: add test for single parameter passed to -m optionSahil Dua, Jun 5, 2017
  2. Junio C HamanoJun 6, 2017
  3. Sahil DuaJun 6, 2017
  4. t3200: add test for single parameter passed to -m optionSahil Dua, Jun 11, 2017
  5. Junio C HamanoJun 12, 2017
  6. t3200: add test for single parameter passed to -m optionSahil Dua, Jun 13, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.