Skip to content

Commit 5262b01

Browse files
committed
Restore v2.0.x content after rebase
1 parent 73989e3 commit 5262b01

9 files changed

Lines changed: 3 additions & 71 deletions

File tree

lua/vgit/core/Spawn.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ function Spawn:process_chunk(chunk, buffer, callback)
6262
end
6363
end
6464
end
65-
callback(output:sub(start, newline_pos - 1))
66-
start = newline_pos + 1
6765
end
6866

6967
local compact = {}

lua/vgit/features/buffer/Hunks.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ function Hunks:cursor_stage()
8282
if not buffer then return end
8383
if buffer:editing() then return end
8484

85-
-- Performance: Suppress VGitSync broadcast; refresh only this buffer after delay
86-
git_buffer_store.suppress_sync_and_refresh(buffer, 200)
87-
8885
if not buffer:is_tracked() then
8986
local _, err = buffer:stage()
9087
if err then return console.debug.error(err) end

lua/vgit/git/GitFile.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ function GitFile:unstage_hunk(hunk)
6464
return result, nil
6565
end
6666

67-
function GitFile:reset_hunk(hunk)
68-
return git_stager.reset_hunk(self.reponame, self.filename, hunk)
69-
end
70-
7167
function GitFile:stage()
7268
local result, err = git_stager.stage(self.reponame, self.filename)
7369
if err then return nil, err end

lua/vgit/git/git_buffer_store.lua

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ local events = {
1414
}
1515
local is_registered = false
1616

17-
-- When true, VGitSync events are suppressed (e.g., during staging operations)
18-
local suppress_sync = false
19-
2017
local git_buffer_store = {}
2118

2219
git_buffer_store.register_events = event.async(function()
@@ -147,25 +144,4 @@ git_buffer_store.collect = function()
147144
git_buffer_store.dispatch(git_buffer, 'attach')
148145
end
149146

150-
-- Suppress VGitSync broadcast and refresh only the specified buffer after delay.
151-
-- This prevents refreshing all tracked buffers when only one needs updating.
152-
--
153-
-- Note: External git operations during the suppression window won't trigger a
154-
-- refresh until the next VGitSync event. This is an acceptable tradeoff given
155-
-- the short window (typically 200ms).
156-
git_buffer_store.suppress_sync_and_refresh = function(buffer, ms)
157-
local git_buffer = git_buffer_store.get(buffer)
158-
if not git_buffer then return end
159-
160-
suppress_sync = true
161-
162-
vim.defer_fn(loop.coroutine(function()
163-
suppress_sync = false
164-
165-
if git_buffer:is_valid() then
166-
git_buffer_store.dispatch(git_buffer, 'sync')
167-
end
168-
end), ms)
169-
end
170-
171147
return git_buffer_store

lua/vgit/git/git_hunks.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
local fs = require('vgit.core.fs')
22
local utils = require('vgit.core.utils')
33
local GitHunk = require('vgit.git.GitHunk')
4-
local git_setting = require('vgit.settings.git')
54

6-
local git_hunks = {}
5+
local git_hunks = { algorithm = 'myers' }
76

87
function git_hunks.live(reponame, original_lines, current_lines)
98
local lines_limit = 5000
@@ -59,7 +58,7 @@ function git_hunks.live(reponame, original_lines, current_lines)
5958

6059
live_hunks[#live_hunks + 1] = hunk
6160
end,
62-
algorithm = git_setting:get('algorithm'),
61+
algorithm = git_hunks.algorithm,
6362
})
6463

6564
return live_hunks
@@ -114,7 +113,7 @@ function git_hunks.list(reponame, opts)
114113
'core.safecrlf=false',
115114
'diff',
116115
'--color=never',
117-
string.format('--diff-algorithm=%s', git_setting:get('algorithm')),
116+
string.format('--diff-algorithm=%s', git_hunks.algorithm),
118117
'--patch-with-raw',
119118
'--unified=0',
120119
}

lua/vgit/git/git_repo.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ local GitQueryBuilder = require('vgit.git.GitQueryBuilder')
22

33
local git_repo = {}
44

5-
-- Cache: directory path -> repo root. Stable within a session; only stale if
6-
-- user runs `git init` in a new location (rare, restart neovim to clear).
7-
local discover_cache = {}
8-
95
function git_repo.config(reponame)
106
if not reponame then return nil, { 'reponame is required' } end
117
return GitQueryBuilder(reponame):raw_args('config', '--list'):execute()

lua/vgit/git/git_stager.lua

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,4 @@ function git_stager.unstage_hunk(reponame, filename, hunk)
5555
return nil, err
5656
end
5757

58-
-- Reset (discard) a hunk in the working directory
59-
function git_stager.reset_hunk(reponame, filename, hunk)
60-
if not reponame then return nil, { 'reponame is required' } end
61-
if not filename then return nil, { 'filename is required' } end
62-
if not hunk then return nil, { 'hunk is required' } end
63-
64-
local patch = GitPatch(filename, hunk)
65-
local patch_filename = fs.tmpname()
66-
67-
fs.write_file(patch_filename, patch)
68-
69-
-- Apply the patch in reverse to the working directory (not staged)
70-
local _, err = gitcli.run({
71-
'-C',
72-
reponame,
73-
'--no-pager',
74-
'apply',
75-
'--reverse',
76-
'--whitespace=nowarn',
77-
'--unidiff-zero',
78-
patch_filename,
79-
})
80-
81-
fs.remove_file(patch_filename)
82-
83-
return nil, err
84-
end
85-
8658
return git_stager

lua/vgit/git/gitcli.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
local event = require('vgit.core.event')
22
local Spawn = require('vgit.core.Spawn')
33
local console = require('vgit.core.console')
4-
local git_setting = require('vgit.settings.git')
54

65
local gitcli = {}
76

lua/vgit/settings/git.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ local Config = require('vgit.core.Config')
22

33
return Config({
44
cmd = 'git',
5-
algorithm = 'myers',
65
fallback_cwd = '',
76
fallback_args = {},
87
})

0 commit comments

Comments
 (0)