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

remove perl from git-commit.sh

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jul 12, 2006, 11:15 UTC
Message-ID
<81b0412b0607120415g243f2160tf42c40e52b8bc9ac@mail.gmail.com>

It is really annoying when the essentials do not work. I think we could improve at least them, by minimizing their dependencies to external tools.

---

git-commit.sh has only ohne place where perl is used and it can actually quite trivially be done in sh. git-ls-files without "-z" produces quoted output, even if is different from that produced by perl code it could be enough. Otherwise I'd better suggest to add another quoting style (replacing only \t, \n and backslash) than having to constantly patch git-commit.sh for binmode or perl path (Windows has no stable tool set, and perl for instance often resides "somewhere").

From 69bf41df4ef69d0f1e4ab52942c59bb3fd568cb8 Mon Sep 17 00:00:00 2001
From: Alex Riesen <raa.lkml@gmail.com>
Date: Wed, 12 Jul 2006 13:02:23 +0200
Subject: remove perl from git-commit.sh
---
 git-commit.sh |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/git-commit.sh b/git-commit.sh
index 802dd72..4cf3fab 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -138,32 +138,26 @@ #'
         if test -z "$untracked_files"; then
             option="--directory --no-empty-directory"
         fi
+	hdr_shown=
 	if test -f "$GIT_DIR/info/exclude"
 	then
-	    git-ls-files -z --others $option \
+	    git-ls-files --others $option \
 		--exclude-from="$GIT_DIR/info/exclude" \
 		--exclude-per-directory=.gitignore
 	else
-	    git-ls-files -z --others $option \
+	    git-ls-files --others $option \
 		--exclude-per-directory=.gitignore
 	fi |
-	@@PERL@@ -e '$/ = "\0";
-	    my $shown = 0;
-	    while (<>) {
-		chomp;
-		s|\\|\\\\|g;
-		s|\t|\\t|g;
-		s|\n|\\n|g;
-		s/^/#	/;
-		if (!$shown) {
-		    print "#\n# Untracked files:\n";
-		    print "#   (use \"git add\" to add to commit)\n";
-		    print "#\n";
-		    $shown = 1;
-		}
-		print "$_\n";
-	    }
-	'
+	while read line; do
+	    if [ -z "$hdr_shown" ]; then
+		echo '#'
+		echo '# Untracked files:'
+		echo '#   (use "git add" to add to commit)'
+		echo '#'
+		hdr_shown=1
+	    fi
+	    echo "#	$line"
+	done
 
 	if test -n "$verbose" -a -z "$IS_INITIAL"
 	then
-- 
1.4.1.gb4adf
Next: Nikolai Weibull
Message 1 of 9 in “remove perl from git-commit.sh”
  1. Alex RiesenJul 12, 2006
  2. Nikolai WeibullJul 12, 2006
  3. Alex RiesenJul 12, 2006
  4. Nikolai WeibullJul 12, 2006
  5. Alex RiesenJul 12, 2006
  6. Petr BaudisJul 12, 2006
  7. Alex RiesenJul 12, 2006
  8. Junio C HamanoJul 13, 2006
  9. Alex RiesenJul 13, 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.