2005-05-30 21:51:00 +02:00
|
|
|
#!/bin/sh
|
2005-08-26 11:12:50 +02:00
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Linus Torvalds
|
|
|
|
#
|
2005-09-08 02:26:23 +02:00
|
|
|
. git-sh-setup || die "Not a git archive"
|
2005-08-15 10:56:23 +02:00
|
|
|
|
2005-05-30 21:51:00 +02:00
|
|
|
report () {
|
|
|
|
header="#
|
|
|
|
# $1:
|
|
|
|
# ($2)
|
|
|
|
#
|
|
|
|
"
|
|
|
|
trailer=""
|
2005-10-15 06:56:46 +02:00
|
|
|
while read status name newname
|
2005-05-30 21:51:00 +02:00
|
|
|
do
|
|
|
|
echo -n "$header"
|
|
|
|
header=""
|
|
|
|
trailer="#
|
|
|
|
"
|
|
|
|
case "$status" in
|
2005-05-30 22:53:45 +02:00
|
|
|
M ) echo "# modified: $name";;
|
|
|
|
D*) echo "# deleted: $name";;
|
|
|
|
T ) echo "# typechange: $name";;
|
|
|
|
C*) echo "# copied: $name -> $newname";;
|
|
|
|
R*) echo "# renamed: $name -> $newname";;
|
2005-07-27 10:36:08 +02:00
|
|
|
A*) echo "# new file: $name";;
|
2005-05-30 22:53:45 +02:00
|
|
|
U ) echo "# unmerged: $name";;
|
2005-05-30 21:51:00 +02:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
echo -n "$trailer"
|
|
|
|
[ "$header" ]
|
|
|
|
}
|
|
|
|
|
2005-09-30 23:26:57 +02:00
|
|
|
branch=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD)
|
2005-08-27 01:53:26 +02:00
|
|
|
case "$branch" in
|
|
|
|
refs/heads/master) ;;
|
|
|
|
*) echo "# On branch $branch" ;;
|
|
|
|
esac
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-10-01 22:24:27 +02:00
|
|
|
git-update-index -q --unmerged --refresh || exit
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-09-30 23:26:57 +02:00
|
|
|
if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1
|
2005-09-01 02:13:48 +02:00
|
|
|
then
|
2005-10-15 06:56:46 +02:00
|
|
|
git-diff-index -M --cached --name-status HEAD |
|
2005-10-08 01:55:00 +02:00
|
|
|
sed -e '
|
2005-10-15 06:56:46 +02:00
|
|
|
s/\\/\\\\/g
|
2005-10-08 01:55:00 +02:00
|
|
|
s/ /\\ /g
|
2005-10-15 06:56:46 +02:00
|
|
|
' |
|
2005-09-01 02:13:48 +02:00
|
|
|
report "Updated but not checked in" "will commit"
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-09-01 02:13:48 +02:00
|
|
|
committable="$?"
|
|
|
|
else
|
|
|
|
echo '#
|
|
|
|
# Initial commit
|
|
|
|
#'
|
|
|
|
git-ls-files |
|
2005-10-08 01:55:00 +02:00
|
|
|
sed -e '
|
2005-10-15 06:56:46 +02:00
|
|
|
s/\\/\\\\/g
|
2005-10-08 01:55:00 +02:00
|
|
|
s/ /\\ /g
|
2005-10-15 06:56:46 +02:00
|
|
|
s/^/A /
|
|
|
|
' |
|
2005-09-01 02:13:48 +02:00
|
|
|
report "Updated but not checked in" "will commit"
|
|
|
|
|
|
|
|
committable="$?"
|
|
|
|
fi
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-10-15 06:56:46 +02:00
|
|
|
git-diff-files --name-status |
|
2005-10-08 01:55:00 +02:00
|
|
|
sed -e '
|
2005-10-15 06:56:46 +02:00
|
|
|
s/\\/\\\\/g
|
2005-10-08 01:55:00 +02:00
|
|
|
s/ /\\ /g
|
2005-10-15 06:56:46 +02:00
|
|
|
' |
|
2005-09-08 02:26:23 +02:00
|
|
|
report "Changed but not updated" "use git-update-index to mark for commit"
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-10-15 06:56:46 +02:00
|
|
|
|
|
|
|
if test -f "$GIT_DIR/info/exclude"
|
2005-08-26 11:12:50 +02:00
|
|
|
then
|
2005-10-15 06:56:46 +02:00
|
|
|
git-ls-files -z --others \
|
|
|
|
--exclude-from="$GIT_DIR/info/exclude" \
|
|
|
|
--exclude-per-directory=.gitignore
|
|
|
|
else
|
|
|
|
git-ls-files -z --others \
|
|
|
|
--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) {
|
2005-10-25 00:11:47 +02:00
|
|
|
print "#\n# Untracked files:\n";
|
2005-10-15 06:56:46 +02:00
|
|
|
print "# (use \"git add\" to add to commit)\n#\n";
|
|
|
|
$shown = 1;
|
|
|
|
}
|
|
|
|
print "$_\n";
|
|
|
|
}
|
|
|
|
'
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-09-02 19:53:15 +02:00
|
|
|
case "$committable" in
|
|
|
|
0)
|
2005-05-30 21:51:00 +02:00
|
|
|
echo "nothing to commit"
|
|
|
|
exit 1
|
2005-09-02 19:53:15 +02:00
|
|
|
esac
|
2005-05-30 21:51:00 +02:00
|
|
|
exit 0
|