diff --git a/bin/git-ard.sh b/bin/git-ard.sh index 1d11cb5..a1d5311 100755 --- a/bin/git-ard.sh +++ b/bin/git-ard.sh @@ -5,12 +5,19 @@ # Enforce being in a git repository git rev-parse --is-inside-work-tree >/dev/null || exit $? -GIT_REMOTE=origin +# We actually should check out the head branch via `git remote show ${REMOTE}`, +# but this requires active connection and active 2FA verification. Tedious to +# have multiple calls for this +if git rev-parse --verify main &>/dev/null; then + MAIN_BRANCH=main +else + MAIN_BRANCH=master +fi -HEAD_REMOT="$(git rev-parse --abbrev-ref ${GIT_REMOTE}/HEAD | cut -d/ -f2)" -HEAD_LOCAL="$(git rev-parse --abbrev-ref HEAD)" +CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" +GIT_REMOTE=origin # Show the next command set -x -git range-diff "${GIT_REMOTE}/${HEAD_REMOT}..${GIT_REMOTE}/${HEAD_LOCAL}" "${HEAD_REMOT}..${HEAD_LOCAL}" +git range-diff "${GIT_REMOTE}/${MAIN_BRANCH}..${GIT_REMOTE}/${CURRENT_BRANCH}" "${MAIN_BRANCH}..${CURRENT_BRANCH}" diff --git a/bin/git-rewrite-commits.sh b/bin/git-rewrite-commits.sh index 4ccf73c..217aa60 100755 --- a/bin/git-rewrite-commits.sh +++ b/bin/git-rewrite-commits.sh @@ -8,15 +8,23 @@ # Enforce being in a git repository git rev-parse --is-inside-work-tree >/dev/null || exit $? -HEAD_REMOT="$(git rev-parse --abbrev-ref origin/HEAD | cut -d/ -f2)" -HEAD_LOCAL="$(git rev-parse --abbrev-ref HEAD)" +# We actually should check out the head branch via `git remote show ${REMOTE}`, +# but this requires active connection and active 2FA verification. Tedious to +# have multiple calls for this +if git rev-parse --verify main &>/dev/null; then + MAIN_BRANCH=main +else + MAIN_BRANCH=master +fi -if [ "${HEAD_LOCAL}" = "${HEAD_REMOT}" ]; then - echo "Cannot rebase commits from '${HEAD_LOCAL}' (HEAD) onto '${HEAD_REMOT}'" >&2 +CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" + +if [ "${CURRENT_BRANCH}" = "${MAIN_BRANCH}" ]; then + echo "Cannot rebase commits from '${CURRENT_BRANCH}' (HEAD) onto '${MAIN_BRANCH}'" >&2 exit 1 fi -MERGE_BASE="$(git merge-base "${HEAD_REMOT}" HEAD)" +MERGE_BASE="$(git merge-base "${MAIN_BRANCH}" HEAD)" # Show the next command set -x diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 5ada03b..cf5ca3f 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,5 +1,4 @@ { - "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "gitsigns.nvim": { "branch": "main", "commit": "42d6aed4e94e0f0bbced16bbdcc42f57673bd75e" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, diff --git a/nvim/lua/plugins/bufferline.lua b/nvim/lua/plugins/bufferline.lua deleted file mode 100644 index 10ec00e..0000000 --- a/nvim/lua/plugins/bufferline.lua +++ /dev/null @@ -1,27 +0,0 @@ -return { - "akinsho/bufferline.nvim", - version = "*", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - event = "VeryLazy", - opts = { - options = { - mode = "buffers", -- show buffers, not tabs - numbers = "none", - diagnostics = "nvim_lsp", - separator_style = "slant", - show_buffer_close_icons = true, - show_close_icon = false, - always_show_bufferline = true, - offsets = { - { - filetype = "NvimTree", - text = "File Explorer", - highlight = "Directory", - separator = true, - }, - }, - }, - }, -}