Skip to content
This repository

Add function to display if there is a rebase, merge or bisect going on on the prompt #844

Closed
wants to merge 1 commit into from

2 participants

Mario Fernández Robby Russell
Mario Fernández

It is useful to create custom prompts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jan 17, 2012
Mario Fernandez Add function to display if there is a rebase, merge or bisect going o…
…n on the prompt
600975c
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 19 additions and 0 deletions. Show diff stats Hide diff stats

  1. +19 0 lib/git.zsh
19 lib/git.zsh
@@ -62,3 +62,22 @@ git_prompt_status() {
62 62 fi
63 63 echo $STATUS
64 64 }
  65 +
  66 +# Checks if there is a bisect, merge or rebase currently going on
  67 +git_prompt_rebase_state() {
  68 + STATUS=""
  69 +
  70 + if [ -f ".git/BISECT_LOG" ] ; then
  71 + STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_BISECT"
  72 + elif [ -f ".git/MERGE_HEAD" ] ; then
  73 + STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_MERGE"
  74 + else
  75 + for dir in rebase rebase-apply rebase-merge ; do
  76 + if [ -d ".git/$dir" ] ; then
  77 + STATUS="$ZSH_THEME_GIT_PROMPT_STATE_BEFORE$ZSH_THEME_GIT_PROMPT_STATE_REBASE"
  78 + break
  79 + fi
  80 + done
  81 + fi
  82 + echo $STATUS
  83 +}

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.