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 13, 2006, 08:30 UTC
Message-ID
<81b0412b0607130130n52a25d91wd8476ad8d018623f@mail.gmail.com>
In-Reply-To
<7v3bd6xgnz.fsf@assigned-by-dhcp.cox.net>

git-commit.sh has the only one place where perl is used and there it can 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).

This system is an ugly combination of cygwin and activestate perl. The combination has some quirks (like the perl producing \r\n by default, expecting windows pathnames instead of cygwin fakes, or ignoring environment variables under some hard to reproduce circumstances), so reducing number of this interactions reduces number of hacks one has to put in core code to make things work. I used to patch git-commit.sh to put binmode in perl output, and git-clone.sh still has these calls to cygpath.

Signed-off-by: Alex Riesen <raa.lkml@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.

Junio C Hamano wrote:
> (1) Sign-off?
done
Show 5 quoted lines
> (2) I think the cover letter comment talks more apporpirate
>    things than your proposed commit message.  The commit log is
>    not a place to vent your frustration.  It's where you
>    justify why that change was needed for people who will want
>    to figure out why your patch broke their workflow later.
done.
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
Previous: Junio C Hamano
Message 9 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.