Skip to content

Commit

Permalink
Do not use perl in git-commit.sh
Browse files Browse the repository at this point in the history
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 is good
enough.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Jul 14, 2006
1 parent f5b571f commit 3dffd2c
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,32 +138,26 @@ run_status () {
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
Expand Down

0 comments on commit 3dffd2c

Please sign in to comment.