# [BUG?] --boundary inconsistent with path limiting

3 messages from 2016-08-04 to 2016-08-04. Participants: Jeff King, Junio C Hamano.
Thread: https://gitlist.dev/t/43007

## Jeff King, 2016-08-04 19:40

Subject: [BUG?] --boundary inconsistent with path limiting
Message-ID: <20160804194043.z4nbosr4wpbzljdl@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20160804194043.z4nbosr4wpbzljdl%40sigill.intra.peff.net

```
Let's say I have a simple repo with three paths:

	git init -q repo
	cd repo
	for i in a b c
	do
		echo content >$i.t
		git add $i.t
		git commit -qm $i &&
		git tag $i
	done

If I ask for the top 2 commits, with the third as a boundary, I get the
expected output:

  $ git log --format='%m %s' --boundary a..c
  > c
  > b
  - a

If I limit the path to "b.t", I get:

  $ git log --format='%m %s' --boundary a..c -- b.t
  > b
  - a

That makes sense to me. We omit "c" because it doesn't touch "b.t", and
obviously include "b", which does. We _do_ include the boundary commit,
even though it doesn't touch the path, which makes sense to me. It
remains a boundary whether it touched the path or not, and without it,
we get no boundary at all.

But now if I limit to "a.t", I get no output at all:

  $ git log --format='%m %s' --boundary a..c -- a.t

whereas I would have expected "- a" to show the boundary.

Is this a bug, or are my expectations wrong?

-Peff

```

## Jeff King, 2016-08-04 20:09

Subject: Re: [BUG?] --boundary inconsistent with path limiting
Message-ID: <20160804200905.7xdiei2yfv2aw6im@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20160804200905.7xdiei2yfv2aw6im%40sigill.intra.peff.net
In-Reply-To: <20160804194043.z4nbosr4wpbzljdl@sigill.intra.peff.net>

```
On Thu, Aug 04, 2016 at 03:40:43PM -0400, Jeff King wrote:

> That makes sense to me. We omit "c" because it doesn't touch "b.t", and
> obviously include "b", which does. We _do_ include the boundary commit,
> even though it doesn't touch the path, which makes sense to me. It
> remains a boundary whether it touched the path or not, and without it,
> we get no boundary at all.
> 
> But now if I limit to "a.t", I get no output at all:
> 
>   $ git log --format='%m %s' --boundary a..c -- a.t
> 
> whereas I would have expected "- a" to show the boundary.
> 
> Is this a bug, or are my expectations wrong?

So I suppose it depends how you define "boundary" commits. In
get_revision_internal(), I see this comment:

        /*
         * boundary commits are the commits that are parents of the
         * ones we got from get_revision_1() but they themselves are
         * not returned from get_revision_1().  Before returning
         * 'c', we need to mark its parents that they could be boundaries.
         */

By that definition, obviously if we do not have any commits to show,
then we have no boundary commits. I don't think this definition is
anywhere in the user-facing documentation, though.

It still seems weird to me, and I wonder if we should show all
UNINTERESTING commits as boundaries in the case that we haven't produced
any positive commits at all. But perhaps there is a case where that
would not be desirable.

-Peff

```

## Junio C Hamano, 2016-08-04 20:11

Subject: Re: [BUG?] --boundary inconsistent with path limiting
Message-ID: <xmqqr3a41eho.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqr3a41eho.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20160804194043.z4nbosr4wpbzljdl@sigill.intra.peff.net>

```
Jeff King <peff@peff.net> writes:

> But now if I limit to "a.t", I get no output at all:
>
>   $ git log --format='%m %s' --boundary a..c -- a.t
>
> whereas I would have expected "- a" to show the boundary.
>
> Is this a bug, or are my expectations wrong?

In a range a..c, there is nothing that touches the path, so there is
no positive outcome.  As boundaries are essentially the parents of
the "last" positive outcome, I would not be surprised if I see an
empty output in that scenario.

But to be honest, I do not think anybody cared between the
distinction between a bug and intended behaviour in this case.

The boundary started as a debugging aid for the traversal machinery
and not as a serious feature to support end-user workflow.  In its
early days, I do not think we even showed _all_ boundaries (instead
we showed only ones that we have already parsed, or something like
that).  I think we added code to do a bit more work when asked to
show boundaries to show boundary commits that the traditional
"primarily for debugging" logic wouldn't have shown later, losing
its value as a debugging aid (because it no longer showed precisely
where the traversal machinery stopped digging).




```
