File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,24 @@ function M.setup(userConfig)
136136 local msg = (' Border type "none" is not supported, falling back to %q.' ):format (fallback )
137137 require (" tinygit.shared.utils" ).notify (msg , " warn" )
138138 end
139+
140+ -- VALIDATE `context` > 0 (0 is not supported without `--unidiff-zero`)
141+ -- DOCS https://git-scm.com/docs/git-apply#Documentation/git-apply.txt---unidiff-zero
142+ -- However, it is discouraged in the git manual, and `git apply` tends to
143+ -- fail quite often, probably as line count changes are not accounted for
144+ -- when splitting up changes into hunks in `getHunksFromDiffOutput`.
145+ -- Using context=1 works, but has the downside of not being 1:1 the same
146+ -- hunks as with `gitsigns.nvim`. Since many small hunks are actually abit
147+ -- cumbersome, and since it's discouraged by git anyway, we simply disallow
148+ -- context=0 for now.
149+ if M .config .stage .contextSize < 1 then M .config .stage .contextSize = 1 end
150+
151+ -- `preview_width` is only supported by `horizontal` & `cursor` strategies,
152+ -- see https://github.com/chrisgrieser/nvim-scissors/issues/28
153+ local strategy = M .config .stage .telescopeOpts .layout_strategy
154+ if strategy ~= " horizontal" and strategy ~= " cursor" then
155+ M .config .stage .telescopeOpts .layout_config .preview_width = nil
156+ end
139157end
140158
141159---- ----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments