Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
1c300d3a
Commit
1c300d3a
authored
Apr 11, 2016
by
Evan Chiu
Committed by
Marc Cornellà
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: add git function to determine repository name (#4989)
Closes #4989 Co-authored-by:
Marc Cornellà
<
marc.cornella@live.com
>
parent
22cf7159
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
git.zsh
lib/git.zsh
+9
-0
No files found.
lib/git.zsh
View file @
1c300d3a
...
@@ -199,3 +199,12 @@ function git_current_user_name() {
...
@@ -199,3 +199,12 @@ function git_current_user_name() {
function
git_current_user_email
()
{
function
git_current_user_email
()
{
command
git config user.email 2>/dev/null
command
git config user.email 2>/dev/null
}
}
# Output the name of the root directory of the git repository
# Usage example: $(git_repo_name)
function
git_repo_name
()
{
local
repo_path
if
repo_path
=
"
$(
git rev-parse
--show-toplevel
2>/dev/null
)
"
&&
[[
-n
"
$repo_path
"
]]
;
then
echo
${
repo_path
:t
}
fi
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment