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-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-09-08 02:26:23 +02:00
|
|
|
git-diff-index -M --cached HEAD |
|
2005-10-08 01:55:00 +02:00
|
|
|
sed -e '
|
|
|
|
s/^://
|
|
|
|
h
|
|
|
|
s/^[^\t]*//
|
|
|
|
s/ /\\ /g
|
|
|
|
x
|
|
|
|
s/\t.*$//
|
|
|
|
G
|
|
|
|
s/\n/ /' |
|
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 '
|
|
|
|
s/ /\\ /g
|
|
|
|
s/^/o o o o 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
|
|
|
|
|
|
|
git-diff-files |
|
2005-10-08 01:55:00 +02:00
|
|
|
sed -e '
|
|
|
|
s/^://
|
|
|
|
h
|
|
|
|
s/^[^\t]*//
|
|
|
|
s/ /\\ /g
|
|
|
|
x
|
|
|
|
s/\t.*$//
|
|
|
|
G
|
|
|
|
s/\n/ /' |
|
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
|