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

[PATCH] Add test case for $Id$ expanded in the repository

From
APAndy Parkins <andyparkins@gmail.com>
Date
May 27, 2007, 10:52 UTC
Message-ID
<200705271152.11962.andyparkins@gmail.com>
In-Reply-To
<200705271150.50147.andyparkins@gmail.com>

This test case would have caught the bug fixed by revision c23290d5.

It puts various forms of $Id$ into a file in the repository, without allowing git to collapse them to uniformity. Then enables the $Id$ expansion on checkout, and checks that what is checked out has coped with the various forms.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 t/t0021-conversion.sh |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh
index 6c26fd8..a839f4e 100755
--- a/t/t0021-conversion.sh
+++ b/t/t0021-conversion.sh
@@ -45,4 +45,40 @@ test_expect_success check '
 	test "z$id" = "z$embedded"
 '
 
+# If an expanded ident ever gets into the repository, we want to make sure that
+# it is collapsed before being expanded again on checkout
+test_expect_success expanded_in_repo '
+	{
+		echo "File with expanded keywords"
+		echo "\$Id\$"
+		echo "\$Id:\$"
+		echo "\$Id: 0000000000000000000000000000000000000000 \$"
+		echo "\$Id: NoSpaceAtEnd\$"
+		echo "\$Id:NoSpaceAtFront \$"
+		echo "\$Id:NoSpaceAtEitherEnd\$"
+		echo "\$Id: NoTerminatingSymbol"
+	} > expanded-keywords &&
+
+	{
+		echo "File with expanded keywords"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$"
+		echo "\$Id: NoTerminatingSymbol"
+	} > expected-output &&
+
+	git add expanded-keywords &&
+	git commit -m "File with keywords expanded" &&
+
+	echo "expanded-keywords ident" >> .gitattributes &&
+
+	rm -f expanded-keywords &&
+	git checkout -- expanded-keywords &&
+	cat expanded-keywords &&
+	cmp expanded-keywords expected-output
+'
+
 test_done
-- 
1.5.2.86.g99b5-dirty
Previous: Andy Parkins
Message 13 of 13 in “Fix mishandling of $Id$ expanded in the repository copy in convert.c”
  1. Fix mishandling of $Id$ expanded in the repository copy in convert.cAndy Parkins, May 25, 2007
  2. Joshua N PritikinMay 25, 2007
  3. Andy ParkinsMay 25, 2007
  4. Don't allow newlines to occur in $Id:$ collapseAndy Parkins, May 25, 2007
  5. Joshua N PritikinMay 25, 2007
  6. Nicolas PitreMay 25, 2007
  7. Andy ParkinsMay 25, 2007
  8. Joshua N PritikinMay 25, 2007
  9. Junio C HamanoMay 26, 2007
  10. Andy ParkinsMay 26, 2007
  11. Junio C HamanoMay 26, 2007
  12. Andy ParkinsMay 27, 2007
  13. Add test case for $Id$ expanded in the repositoryAndy Parkins, May 27, 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.