login
Header Space

 
 

Re: [PATCH] More test cases for sanitized path names

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <gitster@...>
Cc: Johannes Schindelin <Johannes.Schindelin@...>, Johannes Sixt <j.sixt@...>, Shawn Bohrer <shawn.bohrer@...>, <git@...>
Date: Friday, February 1, 2008 - 5:10 am

fredagen den 1 februari 2008 skrev Junio C Hamano:
Oops. Remove the echo $?. It still fails, i.e. git add succeeds when
it shouldn't. I was double checking it just before sending the patch.

Can we move the default trash one level down for all tests? That
would give us one free level to play with.

I respect that.
[...]

If I recall things properly there are lots of test that test for success
rather than checking that the command does what it should.

Update follows.

-- robin

From 11a52821ca81096987f53c29bf1b9ce373fe7fd4 Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Fri, 1 Feb 2008 05:29:38 +0100
Subject: [PATCH] More test cases for sanitized path names

Verify a few more commands and pathname variants.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 t/t7010-setup.sh |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/t/t7010-setup.sh b/t/t7010-setup.sh
index da20ba5..ef30099 100755
--- a/t/t7010-setup.sh
+++ b/t/t7010-setup.sh
@@ -4,6 +4,10 @@ test_description='setup taking and sanitizing funny paths'
 
 . ./test-lib.sh
 
+rm -rf .git
+test_create_repo repo
+cd repo
+
 test_expect_success setup '
 
 	mkdir -p a/b/c a/e &&
@@ -114,4 +118,42 @@ test_expect_success 'git ls-files (relative #3)' '
 
 '
 
+test_expect_success 'commit using absolute path names' '
+	git commit -m "foo" &&
+	echo aa >>a/b/c/d &&
+	git commit -m "aa" "$(pwd)/a/b/c/d"
+'
+
+test_expect_success 'log using absolute path names' '
+	echo bb >>a/b/c/d &&
+	git commit -m "bb" $(pwd)/a/b/c/d &&
+
+	git log a/b/c/d >f1.txt &&
+	git log "$(pwd)/a/b/c/d" >f2.txt &&
+	diff -u f1.txt f2.txt
+'
+
+test_expect_success 'blame using absolute path names' '
+	git blame a/b/c/d >f1.txt &&
+	git blame "$(pwd)/a/b/c/d" >f2.txt &&
+	diff -u f1.txt f2.txt
+'
+
+test_expect_success 'add a directory outside the work tree' '
+	d1="$(cd .. ; pwd)" &&
+	! git add "$d1"
+'
+
+test_expect_success 'add a file outside the work tree, nasty case 1' '(
+	f="$(pwd)x" &&
+	touch "$f" &&
+	! git add "$f"
+)'
+
+test_expect_success 'add a file outside the work tree, nasty case 2' '(
+	f="$(pwd|sed "s/.$//")x" &&
+	touch "$f" &&
+	! git add "$f"
+)'
+
 test_done
-- 
1.5.4.rc4.25.g81cc

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-clean buglet, Johannes Sixt, (Wed Jan 23, 11:14 am)
Re: git-clean buglet, Johannes Schindelin, (Wed Jan 23, 11:29 am)
Re: git-clean buglet, Johannes Sixt, (Wed Jan 23, 11:40 am)
[PATCH] Fix off by one error in prep_exclude., Shawn Bohrer, (Sun Jan 27, 3:55 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Johannes Schindelin, (Sun Jan 27, 4:44 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Junio C Hamano, (Sun Jan 27, 6:34 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Shawn Bohrer, (Sun Jan 27, 8:34 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Junio C Hamano, (Sun Jan 27, 10:52 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Johannes Sixt, (Mon Jan 28, 3:12 am)
Re: [PATCH] Fix off by one error in prep_exclude., Junio C Hamano, (Mon Jan 28, 4:46 am)
Re: [PATCH] Fix off by one error in prep_exclude., Johannes Sixt, (Mon Jan 28, 5:05 am)
[RFH/PATCH] prefix_path(): disallow absolute paths, Johannes Schindelin, (Mon Jan 28, 8:33 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Mon Jan 28, 9:23 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, しらいしななこ, (Tue Jan 29, 5:53 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Tue Jan 29, 8:43 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Johannes Sixt, (Tue Jan 29, 3:20 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Tue Jan 29, 3:28 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Johannes Sixt, (Tue Jan 29, 3:43 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Tue Jan 29, 4:31 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Johannes Schindelin, (Mon Jan 28, 10:37 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Mon Jan 28, 10:45 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Johannes Schindelin, (Mon Jan 28, 10:59 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Mon Jan 28, 10:03 pm)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Tue Jan 29, 3:02 am)
[PATCH] More test cases for sanitized path names, Robin Rosenberg, (Fri Feb 1, 12:34 am)
Re: [PATCH] More test cases for sanitized path names, Junio C Hamano, (Fri Feb 1, 3:17 am)
[PATCH for post 1.5.4] Sane use of test_expect_failure, Junio C Hamano, (Fri Feb 1, 5:50 am)
Re: [PATCH] Sane use of test_expect_failure, Junio C Hamano, (Sat Feb 2, 6:06 am)
Re: [PATCH] More test cases for sanitized path names, Robin Rosenberg, (Fri Feb 1, 5:10 am)
Re: [PATCH] More test cases for sanitized path names, Junio C Hamano, (Fri Feb 1, 6:22 am)
Re: [PATCH] More test cases for sanitized path names, Robin Rosenberg, (Fri Feb 1, 10:17 am)
Re: [PATCH] More test cases for sanitized path names, Junio C Hamano, (Fri Feb 1, 1:45 pm)
Re: [PATCH] More test cases for sanitized path names, Junio C Hamano, (Fri Feb 1, 6:51 am)
Re: [PATCH] More test cases for sanitized path names, Junio C Hamano, (Fri Feb 1, 7:10 am)
[PATCH] Make blame accept absolute paths, Robin Rosenberg, (Fri Feb 1, 12:07 am)
Re: [RFH/PATCH] prefix_path(): disallow absolute paths, Junio C Hamano, (Mon Jan 28, 10:03 pm)
[PATCH] prefix_path(): disallow absolute paths, Johannes Schindelin, (Mon Jan 28, 11:05 am)
Re: [PATCH] Fix off by one error in prep_exclude., Junio C Hamano, (Mon Jan 28, 5:22 am)
[PATCH] Fix off by one error in prep_exclude., Shawn Bohrer, (Sun Jan 27, 8:37 pm)
Re: [PATCH] Fix off by one error in prep_exclude., Johannes Schindelin, (Mon Jan 28, 7:59 am)
Re: [PATCH] Fix off by one error in prep_exclude., Junio C Hamano, (Mon Jan 28, 8:04 am)
Re: [PATCH] Fix off by one error in prep_exclude., Shawn Bohrer, (Sun Jan 27, 5:15 pm)
Re: git-clean buglet, Johannes Sixt, (Wed Jan 23, 11:24 am)
speck-geostationary