[PATCH] dim: Add range-diff convenience wrapper
Daniel Vetter
daniel at ffwll.ch
Fri Oct 5 21:36:35 UTC 2018
On Fri, Oct 05, 2018 at 01:39:23PM -0700, Lucas De Marchi wrote:
> On Fri, Oct 5, 2018 at 12:11 PM Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> >
> > range-diff is awesome, but the interface is a bit silly. Add a bunch
> > of shortcuts, inspired by what git diff does.
> >
> > v2: Add it to the developer commmands list. With this dim range-diff
> > is useable on any git repo, not just a dim managed one.
> >
> > v3: Comments from Lucas:
> > - Forward additional arguments. There's no --no-patch in upstream git,
>
> There is (at least in the 2.19.0 final release), it's just not
> documented... like in other
> git commands, these option are forwarded to the command below, which in this
> case is git-diff.
>
> $ git range-diff --no-patch 0cb02867d768...f2fcb2af4be0
> 1: 0cb02867d768 ! 1: f2fcb2af4be0 untested crap
>
> I discovered this while trying to figure out why range-diff was not
> working for me:
>
> $ git range-diff 0cb02867d768...f2fcb2af4be0
> 1: 0cb02867d768 ! 1: f2fcb2af4be0 untested crap
> Submodule a 000000000000...000000000000 (new submodule)
>
> And it still isn't, not sure why.
>
> But I'm digressing.
>
> Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>
Thanks for reviewing, patch pushed.
-Daniel
>
> Lucas De Marchi
>
> > but I tested this with --no-color and --no-dual-color. Slightly a
> > hack since detecting whether it's a branch or not became even more
> > fun, but works in all cases.
> > - Remove impossible "$branch" == "" check - I added a default.
> >
> > v4: Update docs.
> >
> > Cc: Lucas De Marchi <lucas.de.marchi at gmail.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
> > ---
> > dim | 19 +++++++++++++++++++
> > dim.rst | 10 ++++++++++
> > 2 files changed, 29 insertions(+)
> >
> > diff --git a/dim b/dim
> > index 72c86db560a7..aeaea05dac4b 100755
> > --- a/dim
> > +++ b/dim
> > @@ -475,6 +475,24 @@ function dim_retip
> > git rebase --onto $new_upstream $upstream $branch "$@"
> > }
> >
> > +function dim_range_diff
> > +{
> > + local branch
> > +
> > + branch=${1:-@\{1\}}
> > +
> > + if [[ $(git rev-parse $branch | wc -l) -eq 1 ]] ; then
> > + if [[ $(git rev-parse $branch) == "$branch" ]] ; then
> > + branch="@{1}"
> > + else
> > + shift || true
> > + fi
> > + git range-diff $branch...HEAD "$@"
> > + else
> > + git range-diff "$@"
> > + fi
> > +}
> > +
> > # update for-linux-next and for-linux-next-fixes branches
> > function update_linux_next # branch next next-fixes fixes
> > {
> > @@ -2190,6 +2208,7 @@ function list_developer_commands
> > "cite"
> > "fixes"
> > "retip"
> > + "range-diff"
> > "sparse"
> > "tc"
> > # help commands
> > diff --git a/dim.rst b/dim.rst
> > index b149fa39445e..5a093b03c24a 100644
> > --- a/dim.rst
> > +++ b/dim.rst
> > @@ -95,6 +95,16 @@ retip [*branch*] [*git-rebase option* ...]
> > Rebase the given local branch, current branch by default, onto drm-tip. Options
> > after the branch will be passed to **git-rebase**.
> >
> > +range-diff [ *commit-ish* ] [ *git-range-diff options* ]
> > +-------------------------------------------------------------------------------------
> > +
> > +Convenience wrapper around the git range-diff command which automatically
> > +compares against HEAD if you only specify a commit-ish. In all other cases
> > +forwards to git range-diff. Defaults to @{1}, which is very useful for reviewing
> > +rebases. Additional options after the commit-ish will be passed to
> > +**git-range-diff**. Anything that can't be parsed as a commit-ish will also be
> > +forward in its entirety.
> > +
> > COMMANDS FOR COMMITTERS AND MAINTAINERS
> > =======================================
> >
> > --
> > 2.19.0.rc2
> >
>
>
> --
> Lucas De Marchi
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dim-tools
mailing list