improve diff popup and commands #1224

merged 13 commits into from Feb 22, 2014


None yet
1 participant

tarsius commented Feb 22, 2014

Also see #1220.

tarsius added some commits Feb 22, 2014

magit-refresh-commit-buffer: honor magit-diff-options
The diffs in the commit buffer ain't no different from diffs in
dedicated diff buffers and the status buffer, and so it should come with
the same flexibility these other diffs have, i.e. it should respect this
magit-insert-staged-changes: stop abusing magit-diff-options
Previously `magit-diff-options' was let-bound in
`magit-insert-staged-changes', which meant that
it could no longer fulfill its intended purpose.

Replace it with another ugly kludge, an additional
argument STAGED to `magit-insert-diff'.  That will
have to go too, but at least `magit-diff-options'
now has an effect on staged changes again.
magit-diff: improve doc-string
Yes, that really is an improvement - it's less misleading. "Diffing
a range" means to compare two endpoints, while log actually does
something with every commit in between those.

We still use `magit-read-rev-range' to get the endpoints, but that
has to be fixes as part of #876.  We keep using that function for
now because that allows using "a..b" OR "a...b", but that also isn't
obvious yet, unfortunately.
magit-diff-paths: new command
Now Magit supports all forms supported by `git diff'.
magit-diff-working-tree: silently default to HEAD
instead of offering it as default choice in mandatory completion.
Now a prefix argument has to be used to be able to select another
magit-diff-popup: new popup
This is the first popup which can be used to invoke git with some
arguments as well as to set the variable used when refreshing the
current buffer to these arguments.  It is therefor possible to either
create a new diff buffer using certain arguments, or to update the diffs
in the current buffer.  That buffer isn't necessarily a diff-only
buffer, the status buffer for example can also contain diffs.

For diff buffers the ability to set the arguments used for refreshing as
a buffer-local value isn't strictly necessary, one could just invoke the
command that created the buffer again, this time using different
arguments.  This isn't the case for the status buffer, there is no way
to pass arguments intended for `git diff' to `magit-status'.  In the
future we might do the same for `git log' arguments.
magit-diff-{less,more,default}-context: rename variables
Rename `magit-diff-default-hunks' to `magit-diff-default-context',
rename `magit-diff-smaller-hunks' to `magit-diff-less-context', and
rename `magit-diff-larger-hunks' to `magit-diff-less-context'.

"smaller/larger hunks" is ambitious, it might mean "split hunks into
more hunks"/"combine several hunks into one", or what these commands
actually do "show more context around added/removed lines".

"diff context" on the other hand is not ambitious.
magit-diff-context-lines: remove variable
Teach `magit-diff-{less,more,default}-context how to store `-U{N}' in
`magit-diff-options', making the `magit-diff-context-lines' variable
unnecessary.  Remove function `magit-diff-U-arg'; all of its former
callers also use the value of `magit-diff-options'.  In two places
`magit-diff-context-lines' was used directly; change them to use
`magit-diff-options' instead.

@tarsius tarsius merged commit 331ac8b into next Feb 22, 2014

@tarsius tarsius deleted the n/diff-popup-1 branch Feb 22, 2014

@tarsius tarsius added this to the 2.1.0 milestone Feb 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment