# git-p4 submit, Can't clobber writable file

8 messages from 2008-12-02 to 2008-12-03. Participants: Gary Yang, Reece Dunn, Jing Xue, Arafangion.
Thread: https://gitlist.dev/t/16568

## Gary Yang, 2008-12-02 22:30

Subject: git-p4 submit, Can't clobber writable file
Message-ID: <40586.80065.qm@web37902.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/40586.80065.qm%40web37902.mail.mud.yahoo.com

```

I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt

But, I am not able to git-p4 submit. Any idea?

git-p4 clone //build/scripts build_scripts
cd build_scripts
vi foo.h
git commit foo.h
git-p4 rebase
git-p4 submit

  from sets import Set;
Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
Syncronizing p4 checkout...
//build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
//build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
......
command failed: p4 sync ...

Thanks.





      

```

## Reece Dunn, 2008-12-02 23:51

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <3f4fd2640812021551t5451e6e3i91e6d2694c89e085@mail.gmail.com>
URL: https://gitlist.dev/e/3f4fd2640812021551t5451e6e3i91e6d2694c89e085%40mail.gmail.com
In-Reply-To: <40586.80065.qm@web37902.mail.mud.yahoo.com>

```
2008/12/2 Gary Yang <garyyang6@yahoo.com>:
>
> I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
>
> But, I am not able to git-p4 submit. Any idea?
>
> git-p4 clone //build/scripts build_scripts
> cd build_scripts
> vi foo.h
> git commit foo.h
> git-p4 rebase
> git-p4 submit
>
>  from sets import Set;
> Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
> Syncronizing p4 checkout...

This will be running a `p4 sync ...` command to ensure that the files
are up-to-date.

> //build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
> Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
> //build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
> Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
> ......
> command failed: p4 sync ...

Perforce will mark files as readonly when it does a checkout. When you
use `p4 edit` to say you have made changes to the file, Perforce
removes the readonly bit.

What is happening here is that the sync (checkout) command is trying
to write foo.h/c to your build_scripts directory, but because they
already exist there *and* are not readonly, Perforce is producing that
error as it does not want to overwrite any files that have changed
locally.

Not sure what is happening on the git-p4 side, though.

- Reece

```

## Gary Yang, 2008-12-03 00:14

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <94261.93438.qm@web37908.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/94261.93438.qm%40web37908.mail.mud.yahoo.com
In-Reply-To: <3f4fd2640812021551t5451e6e3i91e6d2694c89e085@mail.gmail.com>

```
Reece,

I understand your explanation. But, git-p4 submit does not work for me. Are you able to re-produce the problem?

Thanks,

Gary


--- On Tue, 12/2/08, Reece Dunn <msclrhd@googlemail.com> wrote:

> From: Reece Dunn <msclrhd@googlemail.com>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: garyyang6@yahoo.com
> Cc: git@vger.kernel.org
> Date: Tuesday, December 2, 2008, 3:51 PM
> 2008/12/2 Gary Yang <garyyang6@yahoo.com>:
> >
> > I followed the instructions at
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> >
> > But, I am not able to git-p4 submit. Any idea?
> >
> > git-p4 clone //build/scripts build_scripts
> > cd build_scripts
> > vi foo.h
> > git commit foo.h
> > git-p4 rebase
> > git-p4 submit
> >
> >  from sets import Set;
> > Perforce checkout for depot path //build/scripts/
> located at /home/gyang/workspace/build_scripts/
> > Syncronizing p4 checkout...
> 
> This will be running a `p4 sync ...` command to ensure that
> the files
> are up-to-date.
> 
> > //build/scripts/foo.h#1 - added as
> /home/gyang/workspace/build_scripts/foo.h
> > Can't clobber writable file
> /home/gyang/workspace/build_scripts/foo.h
> > //build/scripts/foo.c#1 - added as
> /home/gyang/workspace/build_scripts/foo.c
> > Can't clobber writable file
> /user/home/gyang/workspace/build_scripts/foo.c
> > ......
> > command failed: p4 sync ...
> 
> Perforce will mark files as readonly when it does a
> checkout. When you
> use `p4 edit` to say you have made changes to the file,
> Perforce
> removes the readonly bit.
> 
> What is happening here is that the sync (checkout) command
> is trying
> to write foo.h/c to your build_scripts directory, but
> because they
> already exist there *and* are not readonly, Perforce is
> producing that
> error as it does not want to overwrite any files that have
> changed
> locally.
> 
> Not sure what is happening on the git-p4 side, though.
> 
> - Reece


      

```

## Jing Xue, 2008-12-03 03:07

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <20081203030729.GB5624@jabba.hq.digizenstudio.com>
URL: https://gitlist.dev/e/20081203030729.GB5624%40jabba.hq.digizenstudio.com
In-Reply-To: <40586.80065.qm@web37902.mail.mud.yahoo.com>

```
On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
> 
> I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> 
> But, I am not able to git-p4 submit. Any idea?
> 
> git-p4 clone //build/scripts build_scripts
> cd build_scripts
> vi foo.h
> git commit foo.h
> git-p4 rebase
> git-p4 submit
> 
>   from sets import Set;
> Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
> Syncronizing p4 checkout...
> //build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
> Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
> //build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
> Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
> ......
> command failed: p4 sync ...

You might want to clone to a git working dir different than the p4
working dir.

For instance, if your p4 workspace has the working dir set to
build_scripts/, try 'git p4 clone //build/scripts build_scripts.git'.

You would then normally work under build_scripts.git/. build_scripts/
would only be used by git-p4 at submission time.

Cheers.
-- 
Jing Xue

```

## Gary Yang, 2008-12-03 06:04

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <410584.87710.qm@web37905.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/410584.87710.qm%40web37905.mail.mud.yahoo.com
In-Reply-To: <20081203030729.GB5624@jabba.hq.digizenstudio.com>

```
So, I have to keep two copies of source tree at my home directory. One is for Perforce build_scripts workspace, another is for Git build_scripts.git. I normally work at build_scripts.git. But, when I need to submit changes to Perforce, I have to copy changed code from build_scripts.git to build_scripts. Then, p4 submit code into Perforce. Is this the only way of using git-p4?
Note: I cannot use git-p4 submit at build_scripts. It claims "Cannot clobber writable file". Is it a bug of git-p4 or the instruction is not correct?


--- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:

> From: Jing Xue <jingxue@digizenstudio.com>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: "Gary Yang" <garyyang6@yahoo.com>
> Cc: git@vger.kernel.org
> Date: Tuesday, December 2, 2008, 7:07 PM
> On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
> > 
> > I followed the instructions at
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > 
> > But, I am not able to git-p4 submit. Any idea?
> > 
> > git-p4 clone //build/scripts build_scripts
> > cd build_scripts
> > vi foo.h
> > git commit foo.h
> > git-p4 rebase
> > git-p4 submit
> > 
> >   from sets import Set;
> > Perforce checkout for depot path //build/scripts/
> located at /home/gyang/workspace/build_scripts/
> > Syncronizing p4 checkout...
> > //build/scripts/foo.h#1 - added as
> /home/gyang/workspace/build_scripts/foo.h
> > Can't clobber writable file
> /home/gyang/workspace/build_scripts/foo.h
> > //build/scripts/foo.c#1 - added as
> /home/gyang/workspace/build_scripts/foo.c
> > Can't clobber writable file
> /user/home/gyang/workspace/build_scripts/foo.c
> > ......
> > command failed: p4 sync ...
> 
> You might want to clone to a git working dir different than
> the p4
> working dir.
> 
> For instance, if your p4 workspace has the working dir set
> to
> build_scripts/, try 'git p4 clone //build/scripts
> build_scripts.git'.
> 
> You would then normally work under build_scripts.git/.
> build_scripts/
> would only be used by git-p4 at submission time.
> 
> Cheers.
> -- 
> Jing Xue


      

```

## Arafangion, 2008-12-03 11:07

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <1228302466.23167.1.camel@therock.nsw.bigpond.net.au>
URL: https://gitlist.dev/e/1228302466.23167.1.camel%40therock.nsw.bigpond.net.au
In-Reply-To: <410584.87710.qm@web37905.mail.mud.yahoo.com>

```
I would argue that's a bug with git-p4, however that is a warning given
by perforce, thus, you should be able to work around it by changing the
clientspec, change the clientspec so that it will clobber such files,
you will need to refer to the perforce docs for info about that.

On Tue, 2008-12-02 at 22:04 -0800, Gary Yang wrote:
> So, I have to keep two copies of source tree at my home directory. One is for Perforce build_scripts workspace, another is for Git build_scripts.git. I normally work at build_scripts.git. But, when I need to submit changes to Perforce, I have to copy changed code from build_scripts.git to build_scripts. Then, p4 submit code into Perforce. Is this the only way of using git-p4?
> Note: I cannot use git-p4 submit at build_scripts. It claims "Cannot clobber writable file". Is it a bug of git-p4 or the instruction is not correct?
> 
> 
> --- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:
> 
> > From: Jing Xue <jingxue@digizenstudio.com>
> > Subject: Re: git-p4 submit, Can't clobber writable file
> > To: "Gary Yang" <garyyang6@yahoo.com>
> > Cc: git@vger.kernel.org
> > Date: Tuesday, December 2, 2008, 7:07 PM
> > On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary Yang wrote:
> > > 
> > > I followed the instructions at
> > http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > > 
> > > But, I am not able to git-p4 submit. Any idea?
> > > 
> > > git-p4 clone //build/scripts build_scripts
> > > cd build_scripts
> > > vi foo.h
> > > git commit foo.h
> > > git-p4 rebase
> > > git-p4 submit
> > > 
> > >   from sets import Set;
> > > Perforce checkout for depot path //build/scripts/
> > located at /home/gyang/workspace/build_scripts/
> > > Syncronizing p4 checkout...
> > > //build/scripts/foo.h#1 - added as
> > /home/gyang/workspace/build_scripts/foo.h
> > > Can't clobber writable file
> > /home/gyang/workspace/build_scripts/foo.h
> > > //build/scripts/foo.c#1 - added as
> > /home/gyang/workspace/build_scripts/foo.c
> > > Can't clobber writable file
> > /user/home/gyang/workspace/build_scripts/foo.c
> > > ......
> > > command failed: p4 sync ...
> > 
> > You might want to clone to a git working dir different than
> > the p4
> > working dir.
> > 
> > For instance, if your p4 workspace has the working dir set
> > to
> > build_scripts/, try 'git p4 clone //build/scripts
> > build_scripts.git'.
> > 
> > You would then normally work under build_scripts.git/.
> > build_scripts/
> > would only be used by git-p4 at submission time.
> > 
> > Cheers.
> > -- 
> > Jing Xue
> 
> 
>       
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Jing Xue, 2008-12-03 14:24

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <20081203142459.GC5624@jabba.hq.digizenstudio.com>
URL: https://gitlist.dev/e/20081203142459.GC5624%40jabba.hq.digizenstudio.com
In-Reply-To: <410584.87710.qm@web37905.mail.mud.yahoo.com>

```

(Just a friendly reminder - I believe the convention on this list is "no
top-post.")

On Tue, Dec 02, 2008 at 10:04:20PM -0800, Gary Yang wrote:
> 
> --- On Tue, 12/2/08, Jing Xue <jingxue@digizenstudio.com> wrote:
>
> > You might want to clone to a git working dir different than
> > the p4
> > working dir.
> > 
> > For instance, if your p4 workspace has the working dir set
> > to
> > build_scripts/, try 'git p4 clone //build/scripts
> > build_scripts.git'.
> > 
> > You would then normally work under build_scripts.git/.
> > build_scripts/
> > would only be used by git-p4 at submission time.
>
> So, I have to keep two copies of source tree at my home directory. One
> is for Perforce build_scripts workspace, another is for Git
> build_scripts.git. I normally work at build_scripts.git. But, when I
> need to submit changes to Perforce, I have to copy changed code from
> build_scripts.git to build_scripts.

You don't have to do that, not manually. That's git-p4's job. When you
do 'git p4 submit', it basically:

1. calls 'p4 sync' in the p4 working dir,
2. generates patches from p4/master..HEAD,
3. for each of the patches, applies it in the p4 working dir, and 'p4
submit' it as one changelist.

> Then, p4 submit code into
> Perforce. Is this the only way of using git-p4?  Note: I cannot use
> git-p4 submit at build_scripts. It claims "Cannot clobber writable
> file". Is it a bug of git-p4 or the instruction is not correct?

Git-p4.txt does mention this (although briefly) in the "Submitting"
section:

"git-p4 has support for submitting changes from a git repository back to the
Perforce depot. This requires a Perforce checkout separate from your git
repository..."

Cheers.
-- 
Jing Xue

```

## Gary Yang, 2008-12-03 19:06

Subject: Re: git-p4 submit, Can't clobber writable file
Message-ID: <210854.98218.qm@web37908.mail.mud.yahoo.com>
URL: https://gitlist.dev/e/210854.98218.qm%40web37908.mail.mud.yahoo.com
In-Reply-To: <1228302466.23167.1.camel@therock.nsw.bigpond.net.au>

```
Arafangion,

I got email from Jing and I solved the problem. The doc should clearly state that we need a separated P4 working dir in order to make git p4 submit work. Many thanks to Jing.

Gary


--- On Wed, 12/3/08, Arafangion <thestar@fussycoder.id.au> wrote:

> From: Arafangion <thestar@fussycoder.id.au>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: garyyang6@yahoo.com
> Cc: "Jing Xue" <jingxue@digizenstudio.com>, git@vger.kernel.org
> Date: Wednesday, December 3, 2008, 3:07 AM
> I would argue that's a bug with git-p4, however that is
> a warning given
> by perforce, thus, you should be able to work around it by
> changing the
> clientspec, change the clientspec so that it will clobber
> such files,
> you will need to refer to the perforce docs for info about
> that.
> 
> On Tue, 2008-12-02 at 22:04 -0800, Gary Yang wrote:
> > So, I have to keep two copies of source tree at my
> home directory. One is for Perforce build_scripts workspace,
> another is for Git build_scripts.git. I normally work at
> build_scripts.git. But, when I need to submit changes to
> Perforce, I have to copy changed code from build_scripts.git
> to build_scripts. Then, p4 submit code into Perforce. Is
> this the only way of using git-p4?
> > Note: I cannot use git-p4 submit at build_scripts. It
> claims "Cannot clobber writable file". Is it a bug
> of git-p4 or the instruction is not correct?
> > 
> > 
> > --- On Tue, 12/2/08, Jing Xue
> <jingxue@digizenstudio.com> wrote:
> > 
> > > From: Jing Xue <jingxue@digizenstudio.com>
> > > Subject: Re: git-p4 submit, Can't clobber
> writable file
> > > To: "Gary Yang"
> <garyyang6@yahoo.com>
> > > Cc: git@vger.kernel.org
> > > Date: Tuesday, December 2, 2008, 7:07 PM
> > > On Tue, Dec 02, 2008 at 02:30:51PM -0800, Gary
> Yang wrote:
> > > > 
> > > > I followed the instructions at
> > >
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> > > > 
> > > > But, I am not able to git-p4 submit. Any
> idea?
> > > > 
> > > > git-p4 clone //build/scripts build_scripts
> > > > cd build_scripts
> > > > vi foo.h
> > > > git commit foo.h
> > > > git-p4 rebase
> > > > git-p4 submit
> > > > 
> > > >   from sets import Set;
> > > > Perforce checkout for depot path
> //build/scripts/
> > > located at /home/gyang/workspace/build_scripts/
> > > > Syncronizing p4 checkout...
> > > > //build/scripts/foo.h#1 - added as
> > > /home/gyang/workspace/build_scripts/foo.h
> > > > Can't clobber writable file
> > > /home/gyang/workspace/build_scripts/foo.h
> > > > //build/scripts/foo.c#1 - added as
> > > /home/gyang/workspace/build_scripts/foo.c
> > > > Can't clobber writable file
> > > /user/home/gyang/workspace/build_scripts/foo.c
> > > > ......
> > > > command failed: p4 sync ...
> > > 
> > > You might want to clone to a git working dir
> different than
> > > the p4
> > > working dir.
> > > 
> > > For instance, if your p4 workspace has the
> working dir set
> > > to
> > > build_scripts/, try 'git p4 clone
> //build/scripts
> > > build_scripts.git'.
> > > 
> > > You would then normally work under
> build_scripts.git/.
> > > build_scripts/
> > > would only be used by git-p4 at submission time.
> > > 
> > > Cheers.
> > > -- 
> > > Jing Xue
> > 
> > 
> >       
> > --
> > To unsubscribe from this list: send the line
> "unsubscribe git" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
> 
> --
> To unsubscribe from this list: send the line
> "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html


      

```
