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=""
|
|
|
|
while read oldmode mode oldsha sha status name newname
|
|
|
|
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-08-27 01:53:26 +02:00
|
|
|
branch=`readlink "$GIT_DIR/HEAD"`
|
|
|
|
case "$branch" in
|
|
|
|
refs/heads/master) ;;
|
|
|
|
*) echo "# On branch $branch" ;;
|
|
|
|
esac
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-09-08 02:26:23 +02:00
|
|
|
git-update-index --refresh >/dev/null 2>&1
|
2005-08-26 11:12:50 +02:00
|
|
|
|
2005-09-01 02:13:48 +02:00
|
|
|
if test -f "$GIT_DIR/HEAD"
|
|
|
|
then
|
2005-09-08 02:26:23 +02:00
|
|
|
git-diff-index -M --cached HEAD |
|
2005-09-01 02:13:48 +02:00
|
|
|
sed 's/^://' |
|
|
|
|
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 |
|
|
|
|
sed 's/^/o o o o A /' |
|
|
|
|
report "Updated but not checked in" "will commit"
|
|
|
|
|
|
|
|
committable="$?"
|
|
|
|
fi
|
2005-08-26 11:12:50 +02:00
|
|
|
|
|
|
|
git-diff-files |
|
|
|
|
sed 's/^://' |
|
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
|
|
|
|
|
|
|
if grep -v '^#' "$GIT_DIR/info/exclude" >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
git-ls-files --others \
|
|
|
|
--exclude-from="$GIT_DIR/info/exclude" \
|
|
|
|
--exclude-per-directory=.gitignore |
|
|
|
|
sed -e '
|
|
|
|
1i\
|
|
|
|
#\
|
|
|
|
# Ignored files:\
|
|
|
|
# (use "git add" to add to commit)\
|
|
|
|
#
|
|
|
|
s/^/# /
|
|
|
|
$a\
|
|
|
|
#'
|
|
|
|
fi
|
|
|
|
|
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
|