Open SammysHP opened 1 week ago
Workaround:
let g: flog_permanent_default_opts = {
\ "raw_args": "--exclude=refs/stash",
\ }
Known issue: if you use raw args combined with --all
for anything else, raw args will get overwritten. We need an elegant solution for cases like this with raw args.
My thoughts on a potential native solution:
-exclude-stash-refs
would work but that sets a new precedent and I want to think about it more.-exclude
. This would have the same issues as -raw-args
, being overwritten if you use it for anything else, but at least it would allow you to use raw args for other things. Completion also would also be basic to start but that's a secondary issue.Potential solution to arguments getting overwritten:
We could add a setting that always prepends to certain args instead of allowing default values to be overwritten. This would work with either the workaround or the native -exclude
solution:
# Always adds "--exclude=refs/stash" to the beginning of raw args, separating the rest with a space
let g: flog_prepended_default_opts = {
\ "raw_args": "--exclude=refs/stash",
\ }
# Effectively adds an -exclude=refs/stash arg at the start of the command
let g: flog_prepended_default_opts = {
\ "exclude": ["refs/stash"],
\ }
Let me know what you would think about this interface, particularly with -exclude
because I think I want to add it.
Didn't know about raw_args
, which might work here. On the other hand, exposing --exclude
as a "native" -exclude
sounds also nice.
We could add a setting that always prepends to certain args instead of allowing default values to be overwritten.
I think the fundamental issue is that there is no way to easily extend default options. Vim lets you +=add
and -=remove
option values. I don't know how difficult it would be to add something similar to the option parsing in Flog. Then you could simply do :Flog -exclude+=foo/bar
and maintain the default options.
The +=
and -=
proposal is interesting, and could be a potential new feature, but Flog arguments are ordered list, so the behaviour of -=
could be confusing.
Also, I'm realizing I have to dig deeper into how other options interact with -exclude
before I add it. I might want to add some other new flags at the same time.
Workaround:
Unfortunately not a workaround. Flog first appends --all
to args
and then raw_args
afterwards. Filter expressions are position dependent and evaluation stops after the fist hit. If --all
comes first, --exclude
will be never evaluated.
When "all" mode is enabled, the log contains commits from the stash as well. Most users will probably consider the stash as something special and don't want to see it mixed together with "regular" commits.
Outside of vim/Flog my "git log" aliases include
--exclude=refs/stash --all
to exclude the stash. I'd like to see a similar option in Flog that can be set ing:flog(_permanent)_default_opts
or a special variant of-all
.