From 90723e8b69eec60850872768abf4579fa3227eed Mon Sep 17 00:00:00 2001 From: tanvirtin Date: Tue, 9 Jul 2024 22:08:08 -0400 Subject: [PATCH] fix(git_log): use unit separator as delimiter --- lua/vgit/features/screens/HistoryScreen/Store.lua | 1 + lua/vgit/features/screens/ProjectCommitsScreen/init.lua | 2 -- lua/vgit/git/GitLog.lua | 2 +- lua/vgit/git/git_log.lua | 2 +- lua/vgit/ui/components/FoldableListComponent.lua | 2 -- 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lua/vgit/features/screens/HistoryScreen/Store.lua b/lua/vgit/features/screens/HistoryScreen/Store.lua index 517b993f..f5e592cf 100644 --- a/lua/vgit/features/screens/HistoryScreen/Store.lua +++ b/lua/vgit/features/screens/HistoryScreen/Store.lua @@ -85,6 +85,7 @@ function Store:get_diff(index) if lines_err then return nil, lines_err end + -- TODO(renames): If a file is renamed changes are not reflected. local diff = Diff():generate(hunks, lines, self.shape) self.state[id] = diff diff --git a/lua/vgit/features/screens/ProjectCommitsScreen/init.lua b/lua/vgit/features/screens/ProjectCommitsScreen/init.lua index 287679b5..9d31fe6b 100644 --- a/lua/vgit/features/screens/ProjectCommitsScreen/init.lua +++ b/lua/vgit/features/screens/ProjectCommitsScreen/init.lua @@ -122,8 +122,6 @@ function ProjectCommitsScreen:show(args) local buffer = Buffer(0) local filename = buffer:get_name() - -- TODO: Need to add an arg parser in core that takes you can - -- somehow define and then parse the input using definition. for i = 1, #args do local arg = args[i] diff --git a/lua/vgit/git/GitLog.lua b/lua/vgit/git/GitLog.lua index c5ce6613..e1d4e85d 100644 --- a/lua/vgit/git/GitLog.lua +++ b/lua/vgit/git/GitLog.lua @@ -4,7 +4,7 @@ local Object = require('vgit.core.Object') local GitLog = Object:extend() function GitLog:constructor(line, revision_count) - local log = vim.split(line, '-') + local log = vim.split(line, '\x1F') local parents = vim.split(log[2], ' ') local revision = revision_count and string.format('HEAD~%s', revision_count) diff --git a/lua/vgit/git/git_log.lua b/lua/vgit/git/git_log.lua index d98e348a..3dd2fc01 100644 --- a/lua/vgit/git/git_log.lua +++ b/lua/vgit/git/git_log.lua @@ -1,7 +1,7 @@ local GitLog = require('vgit.git.GitLog') local gitcli = require('vgit.git.gitcli') -local git_log = { format = '--pretty=format:"%H-%P-%at-%an-%ae-%s"' } +local git_log = { format = '--pretty=format:"%H\x1F%P\x1F%at\x1F%an\x1F%ae\x1F%s"' } function git_log.get(reponame, commit) if not reponame then return nil, { 'reponame is required' } end diff --git a/lua/vgit/ui/components/FoldableListComponent.lua b/lua/vgit/ui/components/FoldableListComponent.lua index 89a3ab0d..5d8da09e 100644 --- a/lua/vgit/ui/components/FoldableListComponent.lua +++ b/lua/vgit/ui/components/FoldableListComponent.lua @@ -129,7 +129,6 @@ function FoldableListComponent:generate_lines() if items then icon_hl_range_offset = 3 end if item.virtual_text then - -- TODO: add other support right now just use before virtual_texts[#virtual_texts + 1] = { type = 'before', hl = item.virtual_text.before.hl, @@ -234,7 +233,6 @@ function FoldableListComponent:paint() local virtual_texts = self.state.virtual_texts for i = 1, #virtual_texts do local virtual_text = virtual_texts[i] - -- TODO: add other support right now just use before if virtual_text.type == 'before' then self.buffer:transpose_virtual_text({ text = virtual_text.text,