Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UserConfig
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jiří Kalvoda
UserConfig
Commits
4db8144b
Commit
4db8144b
authored
3 years ago
by
Jiří Kalvoda
Browse files
Options
Downloads
Patches
Plain Diff
BASH git promt [U] and [E]
parent
46ff7a06
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bash/bashrc
+17
-2
17 additions, 2 deletions
bash/bashrc
with
17 additions
and
2 deletions
bash/bashrc
+
17
−
2
View file @
4db8144b
...
@@ -393,9 +393,24 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
...
@@ -393,9 +393,24 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo
promt_NoGit=0
promt_NoGit=0
promt_parse_git_branch() {
promt_parse_git_branch() {
if [ $promt_NoGit -eq 0 ]; then
if [ $promt_NoGit -eq 0 ]; then
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
promt_git_branch="$(git branch 2>&1)"
if ! [[ "$promt_git_branch" == *"fatal: not a git repository"* ]]
then
if [[ "$promt_git_branch" == *"fatal: unsafe repository"* ]]
then
echo "[S]"
else
promt_git_branch=$(echo "$promt_git_branch" |sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')
if [[ "$promt_git_branch" == '('*')' ]]
then
echo "$promt_git_branch"
else
echo "[E]"
fi
fi
fi
else
else
echo "
?
"
echo "
[?]
"
fi
fi
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment