Re: Git log exclude/remotes/branches options not working as expected

2016-10-18 Thread Junio C Hamano
Robert Dailey  writes:

> I have 3 remotes registered in my clone:
>
> origin, fork, drive
>
> When I do:
>
> $ git log --oneline --decorate --graph
>
> I only want to see branches under:
>
> refs/heads/*
> refs/remotes/origin/*
>
> I tried the following:
>
> $ git log --oneline --decorate --graph --simplify-by-decoration
> --remote=origin topic1..master

I am guessing that the above is not what you actually typed and
s/remote/remotes/ is what you did.

According to "git log --help":

--remotes[=]
Pretend as if all the refs in refs/remotes are listed on the
command line as . If  is given, limit
remote-tracking branches to ones matching given shell glob. If
pattern lacks ?, *, or [, /* at the end is implied.

So your command line is equivalent to

$ git log --oneline --decorate --graph --simplify-by-decoration \
  refs/remotes/origin/master refs/remotes/origin/topic ... \
  topic1..master

(replace the second line with all the remote-tracking branches you
have for "origin").

There is nothing that tells "--decorate" which refs to base its
decoration on, so it is reasonable to expect that a commit that
happens to match a tip of remote-tracking branches from other
remotes are decorated as such, and I think that is what you are
seeing.

> What I'm expecting is that I literally see NONE of those excluded refs
> ... How can I achieve my goals?

The decorations are added in log-tree.c::load_ref_decorations() and
it does not get anything that says "I want to see decorations based
on only these refs", so a short answer is that there is no canned
way to do this in today's codebase.

Having said that, I would say it is a reasonable new feature to
have.  Another related wishlist item might say "decorate only based
on tags, not branches or remote-tracking refs".

You can achieve your goals by teaching that codepath to take such
new pieces of information, come up with a new command line option
[*1*] and add a code to parse your command line option to either
builtin/log.c or revisions.c and pass it down the callchain that
leads to load_ref_decorations().


[Footnote]

*1* Unfortunately "--decorate=" is already taken to specify
the decoration levels, so you would need a different one.


Git log exclude/remotes/branches options not working as expected

2016-10-18 Thread Robert Dailey
I have 3 remotes registered in my clone:

origin, fork, drive

When I do:

$ git log --oneline --decorate --graph

I only want to see branches under:

refs/heads/*
refs/remotes/origin/*

I tried the following:

$ git log --oneline --decorate --graph --simplify-by-decoration
--remote=origin topic1..master

However, I still see refs present in the graph for 'drive' and 'fork'
remote tracking branches. I can't tell if these are shown simply
because other refs not excluded by my options happen to also be at
that SHA1, or if the log command is still generating the graph based
on other branches.

What I'm expecting is that I literally see NONE of those excluded refs
on the graph, even if other included refs also happen to be positioned
at those commits. It's the visualization of the refs I'm concerned
about: I have a lot of remote tracking branches in those remotes that
clutter the view; I'd rather not see them at all (in addition to the
graph not considering them when it is being built/generated). Am I
misunderstanding the purpose here? How can I achieve my goals?
Documentation hasn't really helped me out here.