diff options
-rw-r--r-- | .old/demo-more-script (renamed from demo-more-script) | 0 | ||||
-rw-r--r-- | .old/git-demo (renamed from git-demo) | 0 | ||||
-rwxr-xr-x | git-prompt.sh | 13 | ||||
-rw-r--r-- | index.txt | 81 |
4 files changed, 56 insertions, 38 deletions
diff --git a/demo-more-script b/.old/demo-more-script index ca33522..ca33522 100644 --- a/demo-more-script +++ b/.old/demo-more-script diff --git a/git-prompt.sh b/git-prompt.sh index 094424c..9ba0b35 100755 --- a/git-prompt.sh +++ b/git-prompt.sh @@ -7,7 +7,8 @@ ##### read config file if any. - unset dir_color rc_color root_id_color init_vcs_color clean_vcs_color modified_vcs_color added_vcs_color mixed_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color + unset dir_color rc_color root_id_color init_vcs_color clean_vcs_color + unset modified_vcs_color added_vcs_color mixed_vcs_color untracked_vcs_color op_vcs_color detached_vcs_color conf=git-prompt.conf; [[ -r $conf ]] && . $conf conf=/etc/git-prompt.conf; [[ -r $conf ]] && . $conf @@ -55,7 +56,7 @@ ##################################################################### post config ################# make PARSE_VCS_STATUS - + PARSE_VCS_STATUS="" [[ $git_module = "on" ]] && type git >&/dev/null && PARSE_VCS_STATUS="parse_git_status" [[ $svn_module = "on" ]] && type svn >&/dev/null && PARSE_VCS_STATUS+="||parse_svn_status" [[ $hg_module = "on" ]] && type hg >&/dev/null && PARSE_VCS_STATUS+="||parse_hg_status" @@ -345,12 +346,20 @@ parse_git_status() { /^# Changed but not updated:/,/^# [A-Z]/ { s/^# Changed but not updated:/modified=modified;/p + s/^# modified: \.\./: SKIP/ s/^# modified: \(.*\)/modified_files[${#modified_files[@]}+1]=\"\1\"/p + s/^# unmerged: \.\./: SKIP/ 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: \.\./: SKIP/ + s/^# new file: \.\./: SKIP/ + s/^# renamed:[^>]*> \.\./: SKIP/ + s/^# copied:[^>]*> \.\./: SKIP/ + 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 @@ -34,20 +34,25 @@ image:screenshot-prompt-git.png[git module screenshot] |================================================================ -== Subversion +== Subversion/SVN image:screenshot-svn.png[svn module screenshot] SVN module disabled by default because even on moderate sized working directories there is noticeable delay for prompt display. SVN is slower than GIT. Enable if needed in <<config,config>> +== Mercurial/HG +Was recently added thanks to Lee Nussbaum <wln@scrunch.org>. + == Labels Labels are visual cues to help figure out what terminal is running what command. It is generalization of xterm-title but differ from xterm-title that it can be displayed in other places (on Screen(1) windows titles for example). -On screenshot below they are in red ovals. +Also label can display currently executed command (when bash prompt obviously +is not displayed). +On screenshot below labels are in red ovals. image:screenshot-labels.png["labels screenshot", width="300", link="screenshot-labels.png"] @@ -99,16 +104,20 @@ is, then above command should be: [[ $- == *i* ]] && . /path/to/git-prompt.sh --------------------- -There might be your old prompt defined too. You need to commment it out. +There might be your old prompt defined too. You need to comment it out. +Some distros also have `/etc/bashrc` or `/etc/bash/bashrc` with distro default +prompt. == Config [[config]] -Git-prompt sources (in listed order) two config file if they are present: +Is optional. If config file is not found then git-prompt uses defaults. +Defaults are listed in example `git-prompt.conf`. Git-prompt looks (in listed order) +for config file in following locations: -- `/etc/git-prompt.conf` -- `~/.git-prompt.conf` +* `/etc/git-prompt.conf` +* `~/.git-prompt.conf` Copy example config `git-prompt.conf` to any of above locations and customize as needed. @@ -116,45 +125,45 @@ to any of above locations and customize as needed. == Limitations -- cd-ing into something like linux kernel git working directory for the 1st - time (with cold cache) will take about 10 seconds (that is how long `git status` executes). -- Because you will be always reminded about not checked-in files, you will - be more disciplined about maintaining clean working - directory. And you probably will better maintain `.gitignore` and commit more often. -- This prompt is most useful if your screen have enough width. If this is - not the case, you might want to disable - file list display (`max_file_list_length=0`). -- When prompt is longer then screen-width it wraps to second line. Because of - bug in `gnome-terminal` (or `readline`?) some color escape codes can be - visible on second line. I've reported gnome-terminal bug. - Again, you can disable file list display or limit length (`max_file_list_length`). -- By default some terminals display ascii color with maximum color saturation - which makes colored text of different perceptual brightness. This makes it hard - to read. If your terminal colors are configurable, try to change it softer(pastel) +* cd-ing into something like linux kernel git working directory for the 1st + time (with cold cache) might take up to 10 seconds (that is how long `git status` executes). +* Because you will be always reminded about not checked-in files, + it will force you to keep working directory clean, better maintain `.gitignore` and commit more often. +* This prompt is most useful if your screen have enough width. + If this is not the case, you might want to disable file list display (`max_file_list_length=0`). +* When prompt is longer then screen-width it wraps to second line. + Because of bug in `gnome-terminal` (or `readline` ?) some color escape codes can be visible on second line. + I've reported gnome-terminal bug. Again, you can disable file list display or limit length (`max_file_list_length`). +* By default some terminals display ascii color with maximum color saturation + which makes colored text of different perceptual brightness. This makes it hard to read. + If your terminal colors are configurable, try change it to softer (pastel) colors. == DEPENDENCY -Most of dependencies (except git and svn) are probably already installed on your host. +Most of not optional dependencies are probably already installed on your host. + +* bash (tested with v3.2.33) +* sed +* tput (terminfo) +* tty (core utils) +* grep +* locale (glibc) +* id (core utils) -- bash (tested with v3.2.33) -- git (optional) -- svn (optional) -- sed -- tput (terminfo) -- tty (core utils) -- grep -- locale (glibc) -- id (core utils) +* git (optional) +* svn (optional) +* hg (optional) == TODO -- new mail (howto at: `http://kikhome.net/?p=11` ) -- ctrl-Z subshell indicator -- VIM module needs to be moved out of GIT module -- make module (to show generated, stale files) -- How detect current merge? (current method through .git/MERGE_HEAD not always works) +* VCS exclude dir list +* new mail (howto at: `http://kikhome.net/?p=11` ) +* ctrl-Z subshell indicator +* VIM module needs to be moved out of GIT module +* make module (to show generated, stale files) +* How detect current merge? (current method through .git/MERGE_HEAD not always works) include::../volnitsky.com/project/howto-submit-patch.txt[] |