286c3e5e28b651c3f629e6aaba589a1cf56da4d8

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Merge pull request #4961 from aesopwolf/patch-1

Add git user profile functions for prompt display

Diff

 1diff --git a/lib/git.zsh b/lib/git.zsh
 2index f91b516bd38aafcf33e0b9b133381b78c2288fe1..1c76d58829bae4e2e91f31d99938fce1c96de746 100644
 3--- a/lib/git.zsh
 4+++ b/lib/git.zsh
 5@@ -188,6 +188,18 @@ function git_compare_version() {
 6   echo 0
 7 }
 8 
 9+# Outputs the name of the current user
10+# Usage example: $(git_current_user_name)
11+function git_current_user_name() {
12+  command git config user.name 2>/dev/null
13+}
14+
15+# Outputs the email of the current user
16+# Usage example: $(git_current_user_email)
17+function git_current_user_email() {
18+  command git config user.email 2>/dev/null
19+}
20+
21 # This is unlikely to change so make it all statically assigned
22 POST_1_7_2_GIT=$(git_compare_version "1.7.2")
23 # Clean up the namespace slightly by removing the checker function