log: Fix limit options not working #507
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In #498 I added some code to pre-parse arguments that we're going to pass to
git log
, to figure outwhich of the arguments were paths. This was necessary for future work (#496).
Unfortunately I failed to account for git's options that take an argument, notably
-n 1
, and the1
got treated as a path.This change fixes the bug for:
-n / --max-limit
--after / --since / --until / --before
--skip
--author / --committer
--grep
And incidentally adds those options to the
--help
output:Since we currently pass all unknown arguments on to
git log
, there could be other options that fail. Browsinggit log --help
shows these options that take positional arguments:I'd like to take a pragmatic approach to fixing these and so have categorised them below:
these ones make no sense in a kart context
(so no need to support/fix them)
-L<start>,<end>:<file>, -L:<funcname>:<file>
these ones don't actually accept a separate arg
These ones take an optional argument, so to keep parsing simple, git seems to have required that they be supplied as
--opt=value
rather than--opt value
. Which means they don't actually break in 0.10.6 at all, and don't need fixing.--no-decorate, --decorate[=short|full|auto|no]
--branches[=<pattern>] / --tags[=<pattern>] / --remotes[=<pattern>]
--pretty[=<format>], --format=<format>
--expand-tabs=<n>, --expand-tabs, --no-expand-tabs
--notes[=<ref>]
--show-linear-break[=<barrier>]
obscure opts that are unlikely to be used
pragmatically it's unlikely anyone's using these, and our rough plan is to stop forwarding unknown options to git log in a near-future release (0.11 or 0.12); ref #493 (comment) - which will break these options anyway. Let's just not re-add them now.
--decorate-refs=<pattern>, --decorate-refs-exclude=<pattern>
--grep-reflog=<pattern>
--min-parents=<number>, --max-parents=<number>, --no-min-parents, --no-max-parents
--glob=<glob-pattern>
--exclude=<glob-pattern>
--no-walk[=(sorted|unsorted)]
--encoding=<encoding>
--date=<format>
Checklist: