X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-status.sh;h=fbdd377539eea2c4521a2df2d37ff06b80567664;hb=7baa3e8694d823ce9731172c700bf0d780ae283e;hp=621fa49d2bcad6c5343ac5c172fb9ca6a855c18d;hpb=c1067050ce58b5b39f528fe634732da858664603;p=git.git diff --git a/git-status.sh b/git-status.sh index 621fa49d..fbdd3775 100755 --- a/git-status.sh +++ b/git-status.sh @@ -31,18 +31,26 @@ report () { [ "$header" ] } -branch=`readlink "$GIT_DIR/HEAD"` +branch=$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD) case "$branch" in refs/heads/master) ;; *) echo "# On branch $branch" ;; esac -git-update-index --refresh >/dev/null 2>&1 +git-update-index -q --unmerged --refresh || exit -if test -f "$GIT_DIR/HEAD" +if GIT_DIR="$GIT_DIR" git-rev-parse --verify HEAD >/dev/null 2>&1 then git-diff-index -M --cached HEAD | - sed 's/^://' | + sed -e ' + s/^:// + h + s/^[^ ]*// + s/ /\\ /g + x + s/ .*$// + G + s/\n/ /' | report "Updated but not checked in" "will commit" committable="$?" @@ -51,14 +59,24 @@ else # Initial commit #' git-ls-files | - sed 's/^/o o o o A /' | + sed -e ' + s/ /\\ /g + s/^/o o o o A /' | report "Updated but not checked in" "will commit" committable="$?" fi git-diff-files | -sed 's/^://' | +sed -e ' + s/^:// + h + s/^[^ ]*// + s/ /\\ /g + x + s/ .*$// + G + s/\n/ /' | report "Changed but not updated" "use git-update-index to mark for commit" if grep -v '^#' "$GIT_DIR/info/exclude" >/dev/null 2>&1