git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v4 1/2] filter-branch: stop special-casing $filter_subdir argument
Date: Wed, 11 Nov 2009 09:30:28 +0100	[thread overview]
Message-ID: <4AFA7624.5040400@viscovery.net> (raw)
In-Reply-To: <0280836a32983c848bbb0e3b441be256d3c8f4fa.1257885121.git.trast@student.ethz.ch>

Thomas Rast schrieb:
> Johannes Sixt wrote:
>> # we need "--" only if there are no path arguments in $@
>> nonrevs=$(git rev-parse --no-revs "$@") || exit
>> dashdash=${nonrevs+"--"}
>>
>> (including the comment; you can drop the dquotes in the dashdash
>> assignment if you think the result is still readable.)
> 
> Ok.  I was briefly scared that this was bash-specific syntax, but dash
> seems happy so I'll trust your advice.

You shouldn't. I'm wrong ;-)

In the snippet above, dashdash will always be set to "--" because a mere
'+' in the variable expansion only tests whether the variable ('nonrevs')
is unset, but it is always set. Even ${nonrevs:+"--"} is wrong, and your
earlier 'test -z' invocation was the correct way to set dashdash.

But...

I did some testing, and now I have to wonder about the use-case that you
present in the commit message:

> Furthermore, the case for --subdirectory-filter supplies its own --,
> so the user cannot provide one himself, so the following was
> impossible:
>
>   git filter-branch --subdirectory-filter subdir -- --all -- subdir/file

If you try in git.git itself:

  $ git rev-list --simplify-merges --all -- \
	Documentation/git-commit.txt | wc -l
  84
  $ git rev-list --simplify-merges --all -- \
	Documentation/git-commit.txt Documentation | wc -l
  4624

I thought that the intention to give an extra path argument is to reduce
the number of commits that remain in the rewritten history. But by giving
--subdirectory-filter, the path filter actually loosened, and many more
commits are rewritten.

Since your intention to write this patch is actually to implement
--remap-to-ancestor, I suggest that we defer the question whether the
above use-case makes sense, and only rewrite this particular paragraph in
the commit message to point out the real bug:

-----
Furthermore, --subdirectory-filter supplies its own '--', and if the user
provided one himself, such as in

  git filter-branch --subdirectory-filter subdir -- --all -- subdir/file

an extra '--' was used as path filter in the call to git-rev-list that
determines the commits that shall be rewritten.
-----

I'll submit a replacement patch.

-- Hannes

  parent reply	other threads:[~2009-11-11  8:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21 18:16 [PATCH 1/2] filter-branch: stop special-casing $filter_subdir argument Thomas Rast
2009-10-21 18:16 ` [PATCH 2/2] filter-branch: nearest-ancestor rewriting outside subdir filter Thomas Rast
2009-10-21 18:28 ` [PATCH v2 1/2] filter-branch: stop special-casing $filter_subdir argument Thomas Rast
2009-10-21 18:28   ` [PATCH v2 2/2] filter-branch: nearest-ancestor rewriting outside subdir filter Thomas Rast
2009-10-22  6:06   ` [PATCH v2 1/2] filter-branch: stop special-casing $filter_subdir argument Johannes Sixt
2009-10-22  8:05     ` Thomas Rast
2009-10-22  8:31       ` Johannes Sixt
2009-10-28 22:59         ` [PATCH v3 " Thomas Rast
2009-10-28 22:59           ` [PATCH v3 2/2] filter-branch: nearest-ancestor rewriting outside subdir filter Thomas Rast
2009-10-29  7:38             ` Johannes Sixt
2009-10-29  7:35           ` [PATCH v3 1/2] filter-branch: stop special-casing $filter_subdir argument Johannes Sixt
2009-11-10 21:04             ` [PATCH v4 " Thomas Rast
2009-11-10 21:04               ` [PATCH v4 2/2] filter-branch: nearest-ancestor rewriting outside subdir filter Thomas Rast
2009-11-11  8:30               ` Johannes Sixt [this message]
2009-11-11  8:53                 ` [PATCH v5 1/2] filter-branch: stop special-casing $filter_subdir argument Johannes Sixt
2009-11-11  8:55                   ` [PATCH v5 2/2] filter-branch: nearest-ancestor rewriting outside subdir filter Johannes Sixt
2009-11-11 18:22                     ` Junio C Hamano
2009-11-11 18:36                       ` Thomas Rast
2009-11-11  8:58                   ` [PATCH v5 1/2] filter-branch: stop special-casing $filter_subdir argument Johannes Sixt
2009-11-11 10:24                   ` Thomas Rast
2009-11-11 12:10                     ` Johannes Sixt
2009-11-11 18:00                 ` [PATCH v4 " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AFA7624.5040400@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).