You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.5 KiB
86 lines
1.5 KiB
20 years ago
|
#!/bin/sh
|
||
20 years ago
|
#
|
||
|
# Copyright (c) 2005 Linus Torvalds
|
||
|
#
|
||
19 years ago
|
. git-sh-setup || die "Not a git archive"
|
||
20 years ago
|
|
||
20 years ago
|
report () {
|
||
|
header="#
|
||
|
# $1:
|
||
|
# ($2)
|
||
|
#
|
||
|
"
|
||
|
trailer=""
|
||
|
while read oldmode mode oldsha sha status name newname
|
||
|
do
|
||
|
echo -n "$header"
|
||
|
header=""
|
||
|
trailer="#
|
||
|
"
|
||
|
case "$status" in
|
||
20 years ago
|
M ) echo "# modified: $name";;
|
||
|
D*) echo "# deleted: $name";;
|
||
|
T ) echo "# typechange: $name";;
|
||
|
C*) echo "# copied: $name -> $newname";;
|
||
|
R*) echo "# renamed: $name -> $newname";;
|
||
20 years ago
|
A*) echo "# new file: $name";;
|
||
20 years ago
|
U ) echo "# unmerged: $name";;
|
||
20 years ago
|
esac
|
||
|
done
|
||
|
echo -n "$trailer"
|
||
|
[ "$header" ]
|
||
|
}
|
||
|
|
||
20 years ago
|
branch=`readlink "$GIT_DIR/HEAD"`
|
||
|
case "$branch" in
|
||
|
refs/heads/master) ;;
|
||
|
*) echo "# On branch $branch" ;;
|
||
|
esac
|
||
20 years ago
|
|
||
19 years ago
|
git-update-index --refresh >/dev/null 2>&1
|
||
20 years ago
|
|
||
19 years ago
|
if test -f "$GIT_DIR/HEAD"
|
||
|
then
|
||
19 years ago
|
git-diff-index -M --cached HEAD |
|
||
19 years ago
|
sed 's/^://' |
|
||
|
report "Updated but not checked in" "will commit"
|
||
20 years ago
|
|
||
19 years ago
|
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
|
||
20 years ago
|
|
||
|
git-diff-files |
|
||
|
sed 's/^://' |
|
||
19 years ago
|
report "Changed but not updated" "use git-update-index to mark for commit"
|
||
20 years ago
|
|
||
|
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
|
||
|
|
||
19 years ago
|
case "$committable" in
|
||
|
0)
|
||
20 years ago
|
echo "nothing to commit"
|
||
|
exit 1
|
||
19 years ago
|
esac
|
||
20 years ago
|
exit 0
|