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 v2 1/2] filter-branch: stop special-casing $filter_subdir argument
Date: Thu, 22 Oct 2009 10:31:56 +0200 [thread overview]
Message-ID: <4AE0187C.4040608@viscovery.net> (raw)
In-Reply-To: <200910221005.11813.trast@student.ethz.ch>
Thomas Rast schrieb:
> Well, I just observed while writing the patch that you cannot say
>
> git filter-branch --subdirectory-filter subdir -- --all -- subdir/file
Please include this in the commit message.
> Johannes Sixt wrote:
>> Thomas Rast schrieb:
>>> @@ -257,15 +257,29 @@ git read-tree || die "Could not seed the index"
>>> # map old->new commit ids for rewriting parents
>>> mkdir ../map || die "Could not create map/ directory"
>>>
>>> +non_ref_args=$(git rev-parse --no-revs --sq "$@")
>>> +dashdash=--
>>> +for arg in "$non_ref_args"; do
>> At this point $non_ref_args might contain one or more IFS-separatable
>> words, but if you say "$non_ref_args" here, this loop will be entered
>> exactly once. But even if you drop the dquotes, the --sq quoting that you
>> requested from rev-parse bought you nothing.
>
> Hrm. Ok, so the ".." were clearly in mistake, but why could I remove
> the --sq? Doesn't the shell expand the arguments provided by
> $non_ref_args if I use it without quotes nor --sq, so that it might
> accidentally expand paths or such?
When the shell expands $variable (outside quotes), it does not apply
quotes anymore, but only word-splits using $IFS. In your code, the words
would contain literal single-quotes, and paths with spaces would still be
split into words.
Wouldn't it be sufficient to just check whether any non-rev arguments are
present, and to suppress '--' if there are, like:
dashdash=
test -z "$(git rev-parse --no-revs "$@")" && dashdash=--
OK, this still leaves you with the problem that you want to separate
non-rev arguments from rev arguments. Right?
For this I suggest that you extract revs into a regular variable (because
the SHA1s can be word-split in a predictable way), and that you leave the
non-rev arguments in $@:
revs=$(git rev-parse --revs "$@") # don't know if this works
eval set -- "$(git rev-parse --no-revs --sq "$@")" # dquotes?
or so... This way you 'eval' should not be needed in later code.
-- Hannes
next prev parent reply other threads:[~2009-10-22 8:32 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 [this message]
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 ` [PATCH v4 1/2] filter-branch: stop special-casing $filter_subdir argument Johannes Sixt
2009-11-11 8:53 ` [PATCH v5 " 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=4AE0187C.4040608@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.