git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* filter-branch vs. <rev-list options>
@ 2012-03-01 23:39 Phil Hord
  2012-03-02  1:00 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Hord @ 2012-03-01 23:39 UTC (permalink / raw)
  To: git@vger.kernel.org, Johannes Schindelin

I'm trying to pass some arguments to gilt-filter-branch, but it's not
doing what I expect.  The manual says that git-filter-branch ends with
'rev-list options'.  So I tested git-rev-list with this trivial example
and got what I wanted:
    $ git rev-list --not --remotes --not HEAD^..HEAD
    019483b7aedfef711b3c85eca000d812a3b501bd

But when I tried it with filter-branch it didn't work:
    $ git filter-branch --msg-filter cat --not --remotes --not HEAD^..HEAD
     Usage: git filter-branch [--env-filter <command>] [--tree-filter
<command>]
            [--index-filter <command>] [--parent-filter <command>]
            [--msg-filter <command>] [--commit-filter <command>]
            [--tag-name-filter <command>] [--subdirectory-filter
<directory>]
            [--original <namespace>] [-d <directory>] [-f | --force]
            [<rev-list options>...]

On the other hand, this works ok:
    $ git filter-branch --msg-filter catHEAD^..HEAD--not --remotes --not
    Rewrite 019483b7aedfef711b3c85eca000d812a3b501bd (1/1)
    WARNING: Ref 'refs/heads/master' is unchanged

git-filter-branch seems to be parsing its own switches and not
recognizing when they run out and the rest are "rev-list" options. 

Is there a way to force this break, or should I just expect to have to
rewrite the logic so that there's always a non-switch argument at the
start of the rev-list section?  Or am I just doing this wrong?

fwiw - I'm actually wanting to do this in a script:
    git filter-branch --msg-filter cat --not --remotes --not "$@"

I put my "--not --remotes --not" before the user arguments in case the
user arguments include an odd number of "--not" switches on its own.

Thanks,
Phil

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: filter-branch vs. <rev-list options>
  2012-03-01 23:39 filter-branch vs. <rev-list options> Phil Hord
@ 2012-03-02  1:00 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2012-03-02  1:00 UTC (permalink / raw)
  To: Phil Hord; +Cc: git@vger.kernel.org, Johannes Schindelin

On Thu, Mar 01, 2012 at 06:39:07PM -0500, Phil Hord wrote:

> git-filter-branch seems to be parsing its own switches and not
> recognizing when they run out and the rest are "rev-list" options. 
> 
> Is there a way to force this break, or should I just expect to have to
> rewrite the logic so that there's always a non-switch argument at the
> start of the rev-list section?  Or am I just doing this wrong?
> 
> fwiw - I'm actually wanting to do this in a script:
>     git filter-branch --msg-filter cat --not --remotes --not "$@"

Did you try "--":

  git filter-branch --msg-filter cat -- --not --remotes --not "$@"

?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-02  1:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 23:39 filter-branch vs. <rev-list options> Phil Hord
2012-03-02  1:00 ` Jeff King

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).