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

[PATCH 4/5] t3200: test -l with core.logAllRefUpdates options

From
Erick Mattos <erick.mattos@gmail.com>
Date
May 22, 2010, 00:28 UTC
Message-ID
<1274488119-6989-5-git-send-email-erick.mattos@gmail.com>
In-Reply-To
<1274488119-6989-1-git-send-email-erick.mattos@gmail.com>

By default reflogs are always created for new local branches by "checkout -b". But by setting core.logAllRefUpdates to false this will not be true anymore.

In that case you only create the reflogs when you use -l switch with "checkout -b".

Added missing tests to check expected behaviors.
---
 t/t3200-branch.sh |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index e0b7605..9d2c06e 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -224,6 +224,30 @@ test_expect_success \
 	 test -f .git/logs/refs/heads/g/h/i &&
 	 diff expect .git/logs/refs/heads/g/h/i'
 
+test_expect_success 'checkout -b makes reflog by default' '
+	git checkout master &&
+	git config --unset core.logAllRefUpdates &&
+	git checkout -b alpha &&
+	test -f .git/logs/refs/heads/alpha &&
+	PAGER= git reflog show alpha
+'
+
+test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
+	git checkout master &&
+	git config core.logAllRefUpdates false &&
+	git checkout -b beta &&
+	! test -f .git/logs/refs/heads/beta &&
+	test_must_fail PAGER= git reflog show beta
+'
+
+test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
+	git checkout master &&
+	git checkout -lb gamma &&
+	git config --unset core.logAllRefUpdates &&
+	test -f .git/logs/refs/heads/gamma &&
+	PAGER= git reflog show gamma
+'
+
 test_expect_success 'avoid ambiguous track' '
 	git config branch.autosetupmerge true &&
 	git config remote.ambi1.url lalala &&
-- 
1.7.1.231.g0687c.dirty
Previous: Michael J GruberNext: Erick Mattos
Message 17 of 18 in “checkout --orphan improvements”
  1. 0/5 checkout --orphan improvementsErick Mattos, May 22, 2010
  2. 1/5 Documentation: alter checkout --orphan descriptionErick Mattos, May 22, 2010
  3. 2/5 refs: split log_ref_write logic into log_ref_setupErick Mattos, May 22, 2010
  4. Junio C HamanoMay 26, 2010
  5. Erick MattosMay 26, 2010
  6. Junio C HamanoJun 2, 2010
  7. Erick MattosJun 2, 2010
  8. 3/5 checkout --orphan: respect -l option alwaysErick Mattos, May 22, 2010
  9. Junio C HamanoMay 26, 2010
  10. Erick MattosMay 26, 2010
  11. Erik Faye-LundMay 26, 2010
  12. Erick MattosMay 26, 2010
  13. Erick MattosJun 3, 2010
  14. Michael J GruberMay 26, 2010
  15. Erick MattosMay 26, 2010
  16. Michael J GruberMay 27, 2010
  17. 4/5 t3200: test -l with core.logAllRefUpdates optionsErick Mattos, May 22, 2010
  18. 5/5 bash completion: add --orphan to 'git checkout'Erick Mattos, May 22, 2010

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.