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

Re: [PATCH] Use "-f" when adding files with odd names in t9200.

From
Junio C Hamano <junkio@cox.net>
Date
Feb 5, 2007, 01:30 UTC
Message-ID
<7vwt2xpezx.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<D7716B9E-0F00-4AEF-95BC-699933B7FFD8@silverinsanity.com>
Brian Gernhardt <benji@silverinsanity.com> writes:
> I really think the patch is useful and allows the test to pass even on
> systems with idiotic filesystems and doesn't make it vulnerable to
> any bugs in cvsexportcommit.  (Bugs in git-add, maybe, but that's not
> what it's testing.)

In reality, I find highly valuable that our tests find new bugs introduced in unexpected places. I agree that the person who wrote t9200 did not _mean_ to test "git add", but it ended up helping us identify the problematic behaviour between creat() and readdir() on HFS+ affects "git add".

We at least know that the test as written has a problem in an environment where "touch '$p'; ls | fgrep '$p'" fails, and have a clear understand why it fails. I think that knowledge is valuable -- adding '-f' to the test may hide potential problems we might have with "git add" in other environments.

So how about doing this instead? It tests if the filesystem has that particular issue we know "git add" has a problem with, and skips the test in such an environment.

---
 t/t9200-git-cvsexportcommit.sh |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index c443f32..4efa0c9 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -169,6 +169,16 @@ test_expect_success \
       test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/"
       )'
 
+# Some filesystems mangle pathnames with UTF-8 characters --
+# check and skip
+if p="Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" &&
+	mkdir -p "tst/$p" &&
+	date >"tst/$p/day" &&
+	found=$(find tst -type f -print) &&
+	test "z$found" = "ztst/$p/day" &&
+	rm -fr tst
+then
+
 # This test contains UTF-8 characters
 test_expect_success \
      'File with non-ascii file name' \
@@ -184,6 +194,10 @@ test_expect_success \
       test "$(echo $(sort Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/"
       )'
 
+fi
+
+rm -fr tst
+
 test_expect_success \
      'Mismatching patch should fail' \
      'date >>"E/newfile5.txt" &&
Previous: Brian GernhardtNext: Brian Gernhardt
Message 14 of 17 in “t9200 still failing...”
  1. Brian GernhardtFeb 3, 2007
  2. Wolfgang FischerFeb 3, 2007
  3. Brian GernhardtFeb 3, 2007
  4. Use "-f" when adding files with odd names in t9200.Brian Gernhardt, Feb 3, 2007
  5. Junio C HamanoFeb 3, 2007
  6. Brian GernhardtFeb 3, 2007
  7. Junio C HamanoFeb 3, 2007
  8. Brian GernhardtFeb 3, 2007
  9. Junio C HamanoFeb 3, 2007
  10. Junio C HamanoFeb 4, 2007
  11. Shawn O. PearceFeb 4, 2007
  12. Brian GernhardtFeb 4, 2007
  13. Brian GernhardtFeb 4, 2007
  14. Junio C HamanoFeb 5, 2007
  15. Brian GernhardtFeb 5, 2007
  16. Brian GernhardtFeb 6, 2007
  17. Brian GernhardtFeb 3, 2007

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.