mailinfo and applymbox updates
[git/jnareb-git/bp-gitweb.git] / git-status-script
blob1696f23e04a1b96234c60ae07306fdd94d0da314
1 #!/bin/sh
3 # Copyright (c) 2005 Linus Torvalds
5 . git-sh-setup-script || die "Not a git archive"
7 report () {
8 header="#
9 # $1:
10 # ($2)
13 trailer=""
14 while read oldmode mode oldsha sha status name newname
16 echo -n "$header"
17 header=""
18 trailer="#
20 case "$status" in
21 M ) echo "# modified: $name";;
22 D*) echo "# deleted: $name";;
23 T ) echo "# typechange: $name";;
24 C*) echo "# copied: $name -> $newname";;
25 R*) echo "# renamed: $name -> $newname";;
26 A*) echo "# new file: $name";;
27 U ) echo "# unmerged: $name";;
28 esac
29 done
30 echo -n "$trailer"
31 [ "$header" ]
34 branch=`readlink "$GIT_DIR/HEAD"`
35 case "$branch" in
36 refs/heads/master) ;;
37 *) echo "# On branch $branch" ;;
38 esac
40 git-update-cache --refresh >/dev/null 2>&1
42 git-diff-cache -M --cached HEAD |
43 sed 's/^://' |
44 report "Updated but not checked in" "will commit"
46 committable="$?"
48 git-diff-files |
49 sed 's/^://' |
50 report "Changed but not updated" "use git-update-cache to mark for commit"
52 if grep -v '^#' "$GIT_DIR/info/exclude" >/dev/null 2>&1
53 then
54 git-ls-files --others \
55 --exclude-from="$GIT_DIR/info/exclude" \
56 --exclude-per-directory=.gitignore |
57 sed -e '
58 1i\
60 # Ignored files:\
61 # (use "git add" to add to commit)\
63 s/^/# /
64 $a\
68 if [ "$committable" == "0" ]
69 then
70 echo "nothing to commit"
71 exit 1
73 exit 0