lkjsadlkjdaslkjs
This commit is contained in:
48
.envrc
Normal file
48
.envrc
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
(
|
||||
set -euo pipefail
|
||||
|
||||
now="$(date +%Y-%m-%d)"
|
||||
if [[ -s .direnv/pull-date && "$now" = "$(cat .direnv/pull-date)" ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
prints_true() {
|
||||
[[ "$("$@" 2>/dev/null)" = "true" ]]
|
||||
}
|
||||
|
||||
git_dot_git_dir() {
|
||||
if prints_true git rev-parse --is-inside-work-tree; then
|
||||
git rev-parse --git-dir 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
gdot="$(git_dot_git_dir)"
|
||||
[ -n "$gdot" ] || return 1
|
||||
|
||||
if [[ -f "$gdot/rebase-merge/interactive" ]]; then
|
||||
printf >&2 "%s\n" "REBASE-i"
|
||||
return 1
|
||||
elif [[ -d "$gdot/rebase-merge" ]]; then
|
||||
printf >&2 "%s\n" "REBASE-m"
|
||||
return 1
|
||||
elif [[ -d "$gdot/rebase-apply" ]]; then
|
||||
printf >&2 "%s\n" "AM/REBASE"
|
||||
return 1
|
||||
elif [[ -f "$gdot/MERGE_HEAD" ]]; then
|
||||
printf >&2 "%s\n" "MERGING"
|
||||
return 1
|
||||
elif [[ -f "$gdot/CHERRY_PICK_HEAD" ]]; then
|
||||
printf >&2 "%s\n" "CHERRY-PICKING"
|
||||
return 1
|
||||
elif [[ -f "$gdot/BISECT_LOG" ]]; then
|
||||
printf >&2 "%s\n" "BISECTING"
|
||||
return 1
|
||||
fi
|
||||
|
||||
git pull --rebase --autostash
|
||||
|
||||
mkdir -p .direnv/
|
||||
printf "%s\n" "$now" >.direnv/pull-date
|
||||
)
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
!/justfile
|
||||
!/.gitignore
|
||||
!/clean.sh
|
||||
!/.envrc
|
||||
|
||||
Reference in New Issue
Block a user