Audit rev-parse users again.
[git/jnareb-git.git] / git-status-script
blob947cc219752ce3f099ca182e32e684f09ab4c1db
1 #!/bin/sh
2 . git-sh-setup-script || die "Not a git archive"
4 report () {
5 header="#
6 # $1:
7 # ($2)
10 trailer=""
11 while read oldmode mode oldsha sha status name newname
13 echo -n "$header"
14 header=""
15 trailer="#
17 case "$status" in
18 M ) echo "# modified: $name";;
19 D*) echo "# deleted: $name";;
20 T ) echo "# typechange: $name";;
21 C*) echo "# copied: $name -> $newname";;
22 R*) echo "# renamed: $name -> $newname";;
23 A*) echo "# new file: $name";;
24 U ) echo "# unmerged: $name";;
25 esac
26 done
27 echo -n "$trailer"
28 [ "$header" ]
31 git-update-cache --refresh >/dev/null 2>&1
32 git-diff-cache -M --cached HEAD | sed 's/^://' | report "Updated but not checked in" "will commit"
33 committable="$?"
34 git-diff-files | sed 's/^://' | report "Changed but not updated" "use git-update-cache to mark for commit"
35 if [ "$committable" == "0" ]
36 then
37 echo "nothing to commit"
38 exit 1
40 branch=`readlink "$GIT_DIR/HEAD"`
41 case "$branch" in
42 refs/heads/master) ;;
43 *) echo "#
44 # On branch $branch" ;;
45 esac
46 exit 0