summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonid Volnitsky <Leonid@Volnitsky.com>2008-09-19 11:24:28 +0300
committerLeonid Volnitsky <Leonid@Volnitsky.com>2008-09-19 11:29:46 +0300
commit5851985b5659e466f1c3457024b48df8dec9be4c (patch)
tree20d1f662b2c2a2b511ec14e5d2e640508e79c5d0
parentfixed: git hides git-* command away from $PATH (diff)
downloadgit-prompt-5851985b5659e466f1c3457024b48df8dec9be4c.tar.gz
git-prompt-5851985b5659e466f1c3457024b48df8dec9be4c.tar.bz2
git-prompt-5851985b5659e466f1c3457024b48df8dec9be4c.zip
don't show files from parent dir
-rw-r--r--Makefile2
-rw-r--r--git-demo1
-rw-r--r--git-prompt.sh20
3 files changed, 12 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index ca02224..245101f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
install:
cp git-prompt.sh /etc/
- ln -sf /etc/git-prompt.sh /etc/prompt
+ [ -s /etc/prompt ] || ln -sf /etc/git-prompt.sh /etc/prompt
clean:
git clean -df
diff --git a/git-demo b/git-demo
index 1b303c1..eb2e34c 100644
--- a/git-demo
+++ b/git-demo
@@ -28,6 +28,7 @@ git add hello.c
git commit -q -m "merged"
cat hello.c
git checkout HEAD^
+git checkout HEAD^
cat hello.c
git checkout master
sleep 2; echo "this emulates unsaved vim session" > .hello.c.swp
diff --git a/git-prompt.sh b/git-prompt.sh
index 2517f5f..077866e 100644
--- a/git-prompt.sh
+++ b/git-prompt.sh
@@ -33,9 +33,9 @@
op_vcs_color=MAGENTA
detached_vcs_color=RED
- max_untracked=6
- max_modified=6
- max_added=6
+ max_untracked=2
+ max_modified=4
+ max_added=4
##################################################################### post config
@@ -289,19 +289,19 @@ parse_git_dir() {
s/^# Initial commit/init=init/p
/^# Untracked files:/,/^[^#]/{
s/^# Untracked files:/untracked=untracked;/p
- s/^# /untracked_files[${#untracked_files[@]}+1]=/p
+ s/^# \([^.]\)/untracked_files[${#untracked_files[@]}+1]=\1/p
}
/^# Changed but not updated:/,/^# [A-Z]/ {
s/^# Changed but not updated:/modified=modified;/p
- s/^# modified: /modified_files[${#modified_files[@]}+1]=/p
- s/^# unmerged: /modified_files[${#modified_files[@]}+1]=/p
+ s/^# modified: \([^.]\)/modified_files[${#modified_files[@]}+1]=\1/p
+ s/^# unmerged: \([^.]\)/modified_files[${#modified_files[@]}+1]=\1/p
}
/^# Changes to be committed:/,/^# [A-Z]/ {
s/^# Changes to be committed:/added=added;/p
- s/^# modified: /added_files[${#added_files[@]}+1]=/p
- s/^# new file: */added_files[${#added_files[@]}+1]=/p
- s/^# renamed:[^>]*> /added_files[${#added_files[@]}+1]=/p
- s/^# copied:[^>]*> /added_files[${#added_files[@]}+1]=/p
+ s/^# \([^.]\)modified: /added_files[${#added_files[@]}+1]=\1/p
+ s/^# \([^.]\)new file: */added_files[${#added_files[@]}+1]=\1/p
+ s/^# \([^.]\)renamed:[^>]*> /added_files[${#added_files[@]}+1]=\1/p
+ s/^# \([^.]\)copied:[^>]*> /added_files[${#added_files[@]}+1]=\1/p
}
'
`