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