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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Dailey <rcdailey.lists@xxxxxxxxx> 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[=<pattern>]
        Pretend as if all the refs in refs/remotes are listed on the
        command line as <commit>. If <pattern> 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=<option>" is already taken to specify
the decoration levels, so you would need a different one.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]