further work on git auto save

This commit is contained in:
2021-05-03 14:37:49 +02:00
parent a5a41b11e8
commit 3996045f93
6 changed files with 92 additions and 68 deletions
+26 -5
View File
@@ -15,14 +15,14 @@ function get_current_branch {
echo $(git branch | grep "*" | awk '{print $NF}') echo $(git branch | grep "*" | awk '{print $NF}')
} }
function auto_save_git { function git_auto_save {
if [[ $(is_git ".") -ne 0 ]]; then if [[ $(is_git ".") -ne 0 ]]; then
echo "Current dir is not a git repository." echo "Current dir is not a git repository."
return 1 return 1
fi fi
current_branch_name=get_current_branch current_branch_name=$(get_current_branch)
timestamp=`date +%Y_%m_%d_%H_%M_%S` timestamp=`date +%Y_%m_%d_%H_%M_%S`
new_branch_name="git_auto_save/$HOST/$timestamp" new_branch_name="git_auto_save/$HOST/$timestamp"
@@ -65,11 +65,15 @@ function remove_auto_save {
return 1 return 1
fi fi
if [[ $1 ]]; then
auto_save_branch=$1
else
auto_save_branch=`git branch | grep "git_auto_save" | head -1 | awk '{print $FN}'` auto_save_branch=`git branch | grep "git_auto_save" | head -1 | awk '{print $FN}'`
fi
if [[ ! $auto_save_branch ]]; then if [[ ! $auto_save_branch ]]; then
echo "No auto save branch found." echo "No auto-save branch found."
return return 1
fi fi
auto_save_branch=${auto_save_branch:2} auto_save_branch=${auto_save_branch:2}
@@ -87,17 +91,34 @@ function remove_auto_save {
# remove remote branch # remove remote branch
git push origin --delete $auto_save_branch git push origin --delete $auto_save_branch
return 0
} }
function remove_all_auto_saves { function remove_all_auto_saves {
# remove all auto save branches
if [[ $(is_git ".") -ne 0 ]]; then if [[ $(is_git ".") -ne 0 ]]; then
echo "Current dir is not a git repository." echo "Current dir is not a git repository."
return 1 return 1
fi fi
if [[ $1 != "y" ]]; then
echo "Please confirm with 'y'"
return
fi
# remove all auto save branches
while [[ 1 ]]; do
if ! remove_auto_save; then
break
fi
echo "Auto-Save removed."
done
echo "All auto-saves removed."
} }
function load_last_auto_save {
echo ""
}
@@ -121,8 +121,8 @@ padding = 0
; Number of spaces to add before/after each module ; Number of spaces to add before/after each module
; Individual side values can be defined using: ; Individual side values can be defined using:
; module-margin-{left,right} ; module-margin-{left,right}
module-margin-left = 5 module-margin-left = 2
module-margin-right = 5 module-margin-right = 2
; Fonts are defined using <font-name>;<vertical-offset> ; Fonts are defined using <font-name>;<vertical-offset>
; Font names are specified using a fontconfig pattern. ; Font names are specified using a fontconfig pattern.
@@ -165,7 +165,7 @@ modules-center = title
modules-right = pulseaudio mic_status network battery date modules-right = pulseaudio mic_status network battery date
; The separator will be inserted between the output of each module ; The separator will be inserted between the output of each module
separator = separator = |
; This value is used to add extra spacing between elements ; This value is used to add extra spacing between elements
; @deprecated: This parameter will be removed in an upcoming version ; @deprecated: This parameter will be removed in an upcoming version
+2
View File
@@ -1,2 +1,4 @@
alias spotify='spotify --force-device-scale-factor=2' alias spotify='spotify --force-device-scale-factor=2'
alias ll='ls -la --color=auto' alias ll='ls -la --color=auto'
alias hibernate='systemctl hibernate'
+2
View File
@@ -12,6 +12,8 @@ set hidden
set encoding=utf-8 set encoding=utf-8
set t_Co=256 set t_Co=256
set tabstop=4 set tabstop=4
set softtabstop=0 noexpandtab
set shiftwidth=4
" enable search highlighting " enable search highlighting
set hlsearch set hlsearch
+2 -2
View File
@@ -94,8 +94,8 @@ green = "#859900"
-- sizes -- sizes
gap = 10 gap = 10
topbar = 5 topbar = 0
border = 0 border = 2
prompt = 5 prompt = 5
status = 5 status = 5
+1 -2
View File
@@ -5,5 +5,4 @@ xrandr --dpi 110
sleep 5 && xset s 300 & sleep 5 && xset s 300 &
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -n -t bool -s true systemd-run --user --on-calendar=minutely --unit=polybar_auto_hide /usr/bin/polybar-msg cmd hide
xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-power-key -n -t bool -s true