Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Format

on: [pull_request]

jobs:
format:
name: Stylua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: JohnnyMorganz/stylua-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest # NOTE: we recommend pinning to a specific version in case of formatting changes
# CLI arguments
args: --check lua/ --config-path=.stylua.toml
14 changes: 14 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Lint

on: [pull_request]

jobs:
lint:
name: Luacheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Luacheck linter
uses: lunarmodules/luacheck@v0
with:
args: lua/ --globals vim
5 changes: 5 additions & 0 deletions .stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
column_width = 80
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
quote_style = "AutoPreferDouble"
25 changes: 16 additions & 9 deletions lua/advanced_git_search/git_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local finders = require("telescope.finders")
local previewers = require("telescope.previewers")

local last_prompt = nil
M = {}
local M = {}

local split_query_from_author = function(query)
local author = nil
Expand Down Expand Up @@ -185,8 +185,12 @@ M.git_diff_previewer_file = function(bufnr)
return {
"git",
"diff",
prev_commit .. ":" .. determine_historic_file_name(prev_commit, bufnr),
commit_hash .. ":" .. determine_historic_file_name(commit_hash, bufnr),
prev_commit
.. ":"
.. determine_historic_file_name(prev_commit, bufnr),
commit_hash
.. ":"
.. determine_historic_file_name(commit_hash, bufnr),
}
end,
})
Expand All @@ -195,8 +199,8 @@ end
--- open diff for current file
--- @param commit (string) commit or branch to diff with
M.open_diff_view = function(
commit, --[[optional]]
file_name
commit, --[[optional]]
file_name
)
if file_name ~= nil and file_name ~= "" then
vim.api.nvim_command(":Gvdiffsplit " .. commit .. ":" .. file_name)
Expand All @@ -207,10 +211,13 @@ end

--- returns the base branch of a branch (where fork_point is)
M.base_branch = function()
local command =
'git show-branch | sed "s/].*//" | grep "*" | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed "s/^.*\\[//"'
-- local command =
-- 'git show-branch | sed "s/].*//" | grep "*" | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed "s/^.*[//"'
local command = [[git show-branch |\
sed "s/].*//" |\
grep "*" |\
grep -v "$(git rev-parse --abbrev-ref HEAD)" |\
head -n1 |\
sed "s/^.*\\[//"]]

local handle = io.popen(command)
local output = handle:read("*a")
handle:close()
Expand Down
Loading