Skip to content

Commit

Permalink
Don't bash -l things
Browse files Browse the repository at this point in the history
  • Loading branch information
robotdana committed Dec 4, 2023
1 parent 82b842a commit 39eb7a0
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 31 deletions.
2 changes: 1 addition & 1 deletion bin/gcr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

git_reword $*
git reword $*
2 changes: 1 addition & 1 deletion bin/gg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

git_get $1
git get $1
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions bin/git-uncommit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

echodo git reset --quiet HEAD^
File renamed without changes.
2 changes: 1 addition & 1 deletion bin/git_bisect
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else
echodo git checkout "$1"
if echodo "${@:2}"; then
echodo git bisect good
git bisect run bash -cl "echodo ${@:2}"
git bisect run echodo "${@:2}"
echodo git bisect reset
else
echodo git bisect reset
Expand Down
4 changes: 2 additions & 2 deletions bin/git_bisect_branch
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# TODO: test

if echodo "$@"; then
echo ${COLOR_GREEN}HEAD passes${COLOR_RESET};
echo $'\033'"[32mHEAD passes"$'\033'[m;
else
echodo git bisect reset;
echodo git bisect start;
echodo git bisect bad;
echodo git checkout "$(git_branch_fork_point)";
if echodo "$@"; then
echodo git bisect good;
git bisect run bash -cl "echodo $*";
git bisect run echodo "$@"
echodo git bisect reset;
else
echodo git bisect reset;
Expand Down
2 changes: 1 addition & 1 deletion bin/git_rebase_exec
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

git_can_autostash && ( git_rebase_i --exec="bash -cl '${*:2}'" "$1" --reschedule-failed-exec )
git_can_autostash && ( git_rebase_i --exec="${*:2}" "$1" --reschedule-failed-exec )
3 changes: 0 additions & 3 deletions bin/git_uncommit

This file was deleted.

19 changes: 6 additions & 13 deletions functions/colors
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
#!/usr/bin/env bash

export COLOR_RED=$'\033[38;5;125m'
export COLOR_GREEN=$'\033[38;5;48m'
export COLOR_YELLOW=$'\033[38;5;227m'
export COLOR_BLUE=$'\033[1;34m'
export COLOR_AQUA=$'\033[1;36m'
export COLOR_GREY=$'\033[0;90m'
export COLOR_RESET=$'\033[0m'
# Have less display colours
# from: https://wiki.archlinux.org/index.php/Color_output_in_console#man
export LESS_TERMCAP_mb=$COLOR_BLUE # begin bold
export LESS_TERMCAP_md=$COLOR_GREEN # begin blink
export LESS_TERMCAP_mb=$'\e[1;34m' # begin bold
export LESS_TERMCAP_md=$'\e[1;32m' # begin blink
export LESS_TERMCAP_so=$'\e[01;44;37m' # begin reverse video
export LESS_TERMCAP_us=$COLOR_AQUA # begin underline
export LESS_TERMCAP_me=$COLOR_RESET # reset bold/blink
export LESS_TERMCAP_se=$COLOR_RESET # reset reverse video
export LESS_TERMCAP_ue=$COLOR_RESET # reset underline
export LESS_TERMCAP_us=$'\e[1;36m' # begin underline
export LESS_TERMCAP_me=$'\e[m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[m' # reset underline

2 changes: 1 addition & 1 deletion functions/git_alias_completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ __git_complete cc_menu_add __git_complete_refs
__git_complete git_branch_D __git_complete_refs
__git_complete git_branch_rm __git_complete_refs
__git_complete gg __git_complete_remote_or_refspec
__git_complete git_get __git_complete_remote_or_refspec
__git_complete git-get __git_complete_remote_or_refspec
6 changes: 0 additions & 6 deletions gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
short = true
[rerere]
enabled = true
[alias]
unstage = ! bash -lc git_unstage
purge = ! bash -lc git_purge
uncommit = ! bash -lc git_uncommit
get = "!f() { bash -lc \"git_get $1\"; }; f"
reword = "!f() { bash -lc \"git_reword $1\"; }; f"
[log]
mailmap = true
[commit]
Expand Down
4 changes: 2 additions & 2 deletions spec/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
end
end

describe 'git_reword' do
describe 'git reword' do
it 'can reword the commit message' do
git_checkout('-b branch')
file('a').write('a')
Expand All @@ -180,7 +180,7 @@
sha_by_alias = run('git rev-parse --short HEAD^')
expect(sha_by_alias).to have_output(/\A\h+\n\z/)
expect(sha_by_name.output.to_s).to eq sha_by_alias.output.to_s
expect(run("git_reword 'to be changed'",
expect(run("git reword 'to be changed'",
env: { GIT_EDITOR: "sed -i.~ 's/to be changed/was changed/'" }))
.not_to have_output
expect(git_log).to have_output(
Expand Down

0 comments on commit 39eb7a0

Please sign in to comment.