You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Itamar O <it...@gmail.com> on 2010/03/15 21:06:21 UTC

Problem with "svn add" command

I might be doing something wrong here,
but I have an unversioned file named "- example.txt" (don't ask why..),
and when I 'svn add "- example.txt"' I get:
  svn: invalid option character:
  Type 'svn help' for usage.

Seems that the add command thinks the initial "-" is an option prefix...
This also occurs without the whitespace between "-" and "example.txt"
(then I get "svn: invalid option character: e").

Is there a way to work around this?

Thanks,
Itamar O.

Re: Problem with "svn add" command

Posted by Itamar O <it...@gmail.com>.
Both the escaping of the '-' and adding '--' before the filename did the
trick :-)
Thanks!

BTW, This was on Windows.

On Tue, Mar 16, 2010 at 2:05 AM, Ryan Schmidt <
subversion-2010a@ryandesign.com> wrote:

>
> On Mar 15, 2010, at 16:12, Aaron Friesen wrote:
>
> > From: Itamar O [mailto:itamarost@gmail.com]
> >> I have an unversioned file named "- example.txt" (don't ask why..),
> >> and when I 'svn add "- example.txt"' I get:
> >>   svn: invalid option character:
> >>   Type 'svn help' for usage.
> >
> > Try:
> >
> > svn add -- "- example.txt"
>
> FYI, this is not unique to Subversion; most UNIX command line programs have
> this behavior.
>
>

Re: Problem with "svn add" command

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 15, 2010, at 16:12, Aaron Friesen wrote:

> From: Itamar O [mailto:itamarost@gmail.com] 
>> I have an unversioned file named "- example.txt" (don't ask why..),
>> and when I 'svn add "- example.txt"' I get:
>>   svn: invalid option character:
>>   Type 'svn help' for usage.
> 
> Try:
> 
> svn add -- "- example.txt"

FYI, this is not unique to Subversion; most UNIX command line programs have this behavior.

RE: Problem with "svn add" command

Posted by Aaron Friesen <aa...@cartopac.com>.

> From: Itamar O [mailto:itamarost@gmail.com] 
> I might be doing something wrong here,
> but I have an unversioned file named "- example.txt" (don't ask why..),
> and when I 'svn add "- example.txt"' I get:
>   svn: invalid option character:
>   Type 'svn help' for usage.

Try:

svn add -- "- example.txt"


Re: Problem with "svn add" command

Posted by David Weintraub <qa...@gmail.com>.
A slash in front of a file name can be confused with a parameter. The
trick is to prefix files with a ./:

$ svn add ./-example.txt

That way, Subversion doesn't think the -example.txt are a series of
parameters to pass to the svn add command. If there's a space after
the dash and before the first "e" in example, you'll need quotes too:

$ svn add "./- example.txt"

On Mon, Mar 15, 2010 at 5:06 PM, Itamar O <it...@gmail.com> wrote:
> I might be doing something wrong here,
> but I have an unversioned file named "- example.txt" (don't ask why..),
> and when I 'svn add "- example.txt"' I get:
>   svn: invalid option character:
>   Type 'svn help' for usage.
>
> Seems that the add command thinks the initial "-" is an option prefix...
> This also occurs without the whitespace between "-" and "example.txt"
> (then I get "svn: invalid option character: e").
>
> Is there a way to work around this?
>
> Thanks,
> Itamar O.
>



-- 
David Weintraub
qazwart@gmail.com