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

[PATCH 2/2] Tests for branch names with slashes

From
Karl Hasselström <kha@treskal.com>
Date
May 16, 2006, 06:37 UTC
Message-ID
<20060516063716.GA11230@backpacker.hemma.treskal.com>
In-Reply-To
<20060515105810.GA27077@diana.vm.bytemark.co.uk>

Test a number of operations on a repository that has branch names containing slashes (that is, branches living in a subdirectory of .git/refs/heads).

Signed-off-by: Karl Hasselström <kha@treskal.com>
---
The test also had to be changed to use % instead of #.
 t/t0001-subdir-branches.sh |   59 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 t/t0001-subdir-branches.sh
2278d3988ae3fee7624aac6db6bd92677173749f
diff --git a/t/t0001-subdir-branches.sh b/t/t0001-subdir-branches.sh
new file mode 100644
index 0000000..64f583c
--- /dev/null
+++ b/t/t0001-subdir-branches.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Karl Hasselström
+#
+
+test_description='Branch names containing slashes
+
+Test a number of operations on a repository that has branch names
+containing slashes (that is, branches living in a subdirectory of
+.git/refs/heads).'
+
+. ./test-lib.sh
+
+test_expect_success 'Create a patch' \
+  'stg init &&
+   echo "foo" > foo.txt &&
+   stg add foo.txt &&
+   stg new foo -m "Add foo.txt" &&
+   stg refresh'
+
+test_expect_success 'Old and new id with non-slashy branch' \
+  'stg id foo &&
+   stg id foo% &&
+   stg id foo/ &&
+   stg id foo%top &&
+   stg id foo/top &&
+   stg id foo@master &&
+   stg id foo@master%top &&
+   stg id foo@master/top'
+
+test_expect_success 'Clone branch to slashier name' \
+  'stg branch --clone x/y/z'
+
+test_expect_success 'Try new form of id with slashy branch' \
+  'stg id foo &&
+   stg id foo% &&
+   stg id foo%top &&
+   stg id foo@x/y/z &&
+   stg id foo@x/y/z%top'
+
+test_expect_failure 'Try old id with slashy branch' \
+  'stg id foo/ ||
+   stg id foo/top ||
+   stg id foo@x/y/z/top'
+
+test_expect_success 'Create patch in slashy branch' \
+  'echo "bar" >> foo.txt &&
+   stg new bar -m "Add another line" &&
+   stg refresh'
+
+test_expect_success 'Rename branches' \
+  'stg branch --rename master goo/gaa &&
+   test ! -e .git/refs/heads/master &&
+   stg branch --rename goo/gaa x1/x2/x3/x4 &&
+   test ! -e .git/refs/heads/goo &&
+   stg branch --rename x1/x2/x3/x4 servant &&
+   test ! -e .git/refs/heads/x1'
+
+test_done
-- 
1.3.2.g639c


-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Karl HasselströmNext: Karl Hasselström
Message 14 of 15 in “Don't die when there are no branches”
  1. 1/3 Don't die when there are no branchesKarl Hasselström, May 15, 2006
  2. 2/3 Handle branch names with slashesKarl Hasselström, May 15, 2006
  3. Catalin MarinasMay 15, 2006
  4. Karl HasselströmMay 15, 2006
  5. 1/2 Handle branch names with slashesKarl Hasselström, May 16, 2006
  6. Junio C HamanoMay 16, 2006
  7. Karl HasselströmMay 16, 2006
  8. Catalin MarinasMay 17, 2006
  9. 1/2 Handle branch names with slashesKarl Hasselström, May 18, 2006
  10. Handle branch names with slashesKarl Hasselström, May 18, 2006
  11. Catalin MarinasMay 18, 2006
  12. Karl HasselströmMay 18, 2006
  13. 2/2 Tests for branch names with slashesKarl Hasselström, May 18, 2006
  14. 2/2 Tests for branch names with slashesKarl Hasselström, May 16, 2006
  15. 3/3 Tests for branch names with slashesKarl Hasselström, May 15, 2006

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.