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

[PATCH 2/2] Test File Name: t1306-second-config-file.sh

From
NNNGUYEN Huynh Khoi Nguyen <nguyenhu@ensimag.imag.fr>
Date
May 25, 2012, 19:47 UTC
Message-ID
<1337975239-17169-2-git-send-email-nguyenhu@ensibm.imag.fr>
In-Reply-To
<1337975239-17169-1-git-send-email-nguyenhu@ensibm.imag.fr>
There are 4 tests:
test1 and test2: read tests
test1: ~/.config/git/config exists and ~/.gitconfig doesn't
git reads ~/.config/git/config
test2: ~/.config/git/config exists and ~/.gitconfig exists
git reads ~/.gitconfig
test3 and test4: write tests
test3: ~/.config/git/config exists and ~/.gitconfig doesn't
git writes in ~/.config/git/config
test4: ~/.config/git/config exists and ~/.gitconfig exists
git writes in ~/.gitconfig
---
 t/t1306-second-config-file.sh |   47 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100755 t/t1306-second-config-file.sh
diff --git a/t/t1306-second-config-file.sh b/t/t1306-second-config-file.sh
new file mode 100755
index 0000000..5406456
--- /dev/null
+++ b/t/t1306-second-config-file.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (c) 2012 Valentin Duperray, Lucien Kong, Franck Jonas,
+#		     Thomas Nguy, Khoi Nguyen
+#		     Grenoble INP Ensimag
+#
+
+test_description='~/.config/git/config instead of ~/.gitconfig'
+
+. ./test-lib.sh
+
+test_expect_success 'read: ~/.config/git/config exists and ~/.gitconfig doesn'\''t' '
+	mkdir .config &&
+	mkdir .config/git &&
+	echo "[user]" >.config/git/config &&
+	echo "	name = read_config" >>.config/git/config &&
+	echo read_config >expect &&
+	git config --global --get user.name >output &&
+	test_cmp expect output
+'
+
+test_expect_success 'read: ~/.config/git/config exists and ~/.gitconfig exists' '
+	>.gitconfig &&
+	echo "[user]" >.gitconfig &&
+	echo "	name = read_gitconfig" >>.gitconfig &&
+	echo read_gitconfig >expect &&
+	git config --global --get user.name >output &&
+	test_cmp expect output
+'
+
+test_expect_success 'write: ~/.config/git/config exists and ~/.gitconfig doesn'\''t' '
+	rm .gitconfig &&
+	git config --global user.name "write_config" &&
+	echo "[user]" >expect &&
+	echo "	name = write_config" >>expect &&
+	test_cmp expect .config/git/config
+'
+
+test_expect_success 'write: ~/.config/git/config exists and ~/.gitconfig exists' '
+	>.gitconfig &&
+	git config --global user.name "write_gitconfig" &&
+	echo "[user]" >expect &&
+	echo "	name = write_gitconfig" >>expect &&
+	test_cmp expect .gitconfig
+'
+
+test_done
-- 
1.7.0.4
Previous: NGUYEN Huynh Khoi NguyenNext: Jeff King
Message 2 of 12 in “Add possibility to store configuration in ~/.config/git/config file”
  1. 1/2 Add possibility to store configuration in ~/.config/git/config fileNGUYEN Huynh Khoi Nguyen, May 25, 2012
  2. 2/2 Test File Name: t1306-second-config-file.shNGUYEN Huynh Khoi Nguyen, May 25, 2012
  3. Jeff KingMay 25, 2012
  4. Junio C HamanoMay 25, 2012
  5. Jeff KingMay 25, 2012
  6. Nguyen Thai Ngoc DuyMay 26, 2012
  7. Jeff KingMay 26, 2012
  8. David AguilarMay 28, 2012
  9. Matthieu MoyMay 26, 2012
  10. jaseem abidMay 25, 2012
  11. Matthieu MoyMay 26, 2012
  12. Jeff KingMay 26, 2012

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.