2005-05-30 23:51:00 +04:00
|
|
|
#!/bin/sh
|
2005-08-26 13:12:50 +04:00
|
|
|
#
|
|
|
|
# Copyright (c) 2005 Linus Torvalds
|
|
|
|
#
|
2005-09-08 04:26:23 +04:00
|
|
|
. git-sh-setup || die "Not a git archive"
|
2005-08-15 12:56:23 +04:00
|
|
|
|
2005-05-30 23:51:00 +04: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-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-09-08 04:26:23 +04:00
|
|
|
git-diff-index -M --cached HEAD |
|
2005-10-08 03:55:00 +04:00
|
|
|
sed -e '
|
|
|
|
s/^://
|
|
|
|
h
|
2005-10-11 00:58:52 +04:00
|
|
|
s/^[^ ]*//
|
2005-10-08 03:55:00 +04:00
|
|
|
s/ /\\ /g
|
|
|
|
x
|
2005-10-11 00:58:52 +04:00
|
|
|
s/ .*$//
|
2005-10-08 03:55:00 +04:00
|
|
|
G
|
|
|
|
s/\n/ /' |
|
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 '
|
|
|
|
s/ /\\ /g
|
|
|
|
s/^/o o o o 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
|
|
|
|
|
|
|
git-diff-files |
|
2005-10-08 03:55:00 +04:00
|
|
|
sed -e '
|
|
|
|
s/^://
|
|
|
|
h
|
2005-10-11 00:58:52 +04:00
|
|
|
s/^[^ ]*//
|
2005-10-08 03:55:00 +04:00
|
|
|
s/ /\\ /g
|
|
|
|
x
|
2005-10-11 00:58:52 +04:00
|
|
|
s/ .*$//
|
2005-10-08 03:55:00 +04:00
|
|
|
G
|
|
|
|
s/\n/ /' |
|
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
|
|
|
|
|
|
|
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 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
|