On Wed, 29 Jul 2015 08:26:23 -0700
Ying Huang <huangyi...@gmail.com> wrote:

> > I'm afraid I don't "get" your problem statement.
> > As I understood it, you told that,
> > 1) say, let the history of hello.txt includes 3 commits, and
> > 2) you'd like to see three diff views -- one for each of
> >     those commits, and
> > 3) each such diff view should display the changes between
> >     the indicated commit and its parent commit.
> >
> > Is that correct?
>          Yes, I want to see all 3 of them, each one diff against its
> parent.

OK, thanks.  At least the common ground is now established. :-)

> Say, we have these 3 commits, just for easy:
>          commit1
>          commit2
>          commit3
>          I am expecting the following diff running:
>          git difftool commit1^! "$1"

Could you elaborate on why are you keep insisting on using <rev>^!
instead of <rev>^1 which, IMO, is a sensbile thing for this case?

>From the gitrevisions(7) manual page:

| <rev>^!, e.g. HEAD^!
|  A suffix ^ followed by an exclamation mark is the same as
| giving commit <rev> and then all its parents prefixed with ^ to
| exclude them (and their ancestors).

That's clearly a thing from the "commit set theory" used when pruning
parts of the history DAG to get a smaller *set* of commits out of it.
Let me reinstate this logical chain: 1) A diff tool expects two
references to single commits; 2) <rev>^1 picks the first (left) or
the only parent -- always a single commit.
<rev>^! might potentially return any number of commits (bound only by
the total number of commits in your hisory graph); it this really what
you're looking for?  I'd question that.

>          git difftool commit2^! "$1"
>          git difftool commit3^! "$1"
>          While, only these two are running:
>          git difftool commit1^! "$1"
>          git difftool commit3^! "$1"
>          commit2 is not run. That's my problem, and I don't know
> why......

OK, one immediate thought is that your <rev>^! simply returns more than
a single entity and then one of the two possible things happen:
* All the list of revisions returned by that operator gets interpreted
  as a single string (according to the POSIX shell rules), and that
  string gets passed to your difftool which then fails to "resolve" such
  revision string into anything sensible.
* All that list gets passed to the difftool as separate arguments, but
  the tool gets confused about their number.

So...  Could you just freaking try the suggested

  git difftool commit2 commit2^1 "$1"

approach and see if that works?  Really, that would have saved a lot of
virtual trees already. ;-)

The next thing to try if that fails is to debug.  Do not call difftool,
but rather read up on `git rev-parse` and call it instead to see what
the difftool (or, rather, Git calling it) would think about what you
submit to it.  Make that printed to the console.  See what happens.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to