Add 'git bisect replay/log' documentation.
[git/gitweb.git] / git-status.sh
blob621fa49d2bcad6c5343ac5c172fb9ca6a855c18d
1 #!/bin/sh
3 # Copyright (c) 2005 Linus Torvalds
5 . git-sh-setup || 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-index --refresh >/dev/null 2>&1
42 if test -f "$GIT_DIR/HEAD"
43 then
44 git-diff-index -M --cached HEAD |
45 sed 's/^://' |
46 report "Updated but not checked in" "will commit"
48 committable="$?"
49 else
50 echo '#
51 # Initial commit
53 git-ls-files |
54 sed 's/^/o o o o A /' |
55 report "Updated but not checked in" "will commit"
57 committable="$?"
60 git-diff-files |
61 sed 's/^://' |
62 report "Changed but not updated" "use git-update-index to mark for commit"
64 if grep -v '^#' "$GIT_DIR/info/exclude" >/dev/null 2>&1
65 then
66 git-ls-files --others \
67 --exclude-from="$GIT_DIR/info/exclude" \
68 --exclude-per-directory=.gitignore |
69 sed -e '
70 1i\
72 # Ignored files:\
73 # (use "git add" to add to commit)\
75 s/^/# /
76 $a\
80 case "$committable" in
82 echo "nothing to commit"
83 exit 1
84 esac
85 exit 0