# git-p4 Question

10 messages from 2015-04-20 to 2015-04-26. Participants: FusionX86, Sam Vilain, Luke Diamand.
Thread: https://gitlist.dev/t/39120

## FusionX86, 2015-04-20 16:41

Subject: git-p4 Question
Message-ID: <CAFcBi89YqRGqigR1VCJJQtu1D206rP2T8Y-10KvFnvDjXYaN_g@mail.gmail.com>
URL: https://gitlist.dev/e/CAFcBi89YqRGqigR1VCJJQtu1D206rP2T8Y-10KvFnvDjXYaN_g%40mail.gmail.com

```
Hello,

Hopefully this is an appropriate place to ask questions about git-p4.

I started at a company that wants to migrate from Perforce to Git. I'm
new to Perforce and have been trying to learn just enough about it to
get through this migration. Anyway, I've been playing with git-p4 and
have one question/problem to discuss.

After setting up the p4 cli client I can 'p4 sync' some
//depot/main/app1 which pulls down the files I would expect from the
Perforce server. If I use 'git p4 clone //depot/main/app1', I get:

"Doing initial import of //depot/main/app1/ from revision #head into
refs/remotes/p4/master"

But I don't get any files from that depot/folder pulled down. I can
git p4 clone other depot/folders though and get some files. I suspect
that I'm just not understanding how the git-p4 module works.

Basically, I'm hoping to setup a live sync of Perforce to Git of
certain depots in preparation for the migration. Also, if anyone has
pointers or guides for this type of migration, any help is
appreciated.

```

## Sam Vilain, 2015-04-20 18:23

Subject: Re: git-p4 Question
Message-ID: <5535443C.1060600@vilain.net>
URL: https://gitlist.dev/e/5535443C.1060600%40vilain.net
In-Reply-To: <CAFcBi89YqRGqigR1VCJJQtu1D206rP2T8Y-10KvFnvDjXYaN_g@mail.gmail.com>

```
On 04/20/2015 09:41 AM, FusionX86 wrote:
> Hopefully this is an appropriate place to ask questions about git-p4.
>
> I started at a company that wants to migrate from Perforce to Git. I'm
> new to Perforce and have been trying to learn just enough about it to
> get through this migration.

You might also like to check out my git-p4raw project which imports 
directly from the raw repository files into a git repo using git fast-import

     http://github.com/samv/git-p4raw

Apparently it's my most popular github project :-).  YMMV.

Sam.

```

## Luke Diamand, 2015-04-20 19:26

Subject: Re: git-p4 Question
Message-ID: <553552FD.80703@diamand.org>
URL: https://gitlist.dev/e/553552FD.80703%40diamand.org
In-Reply-To: <CAFcBi89YqRGqigR1VCJJQtu1D206rP2T8Y-10KvFnvDjXYaN_g@mail.gmail.com>

```
On 20/04/15 17:41, FusionX86 wrote:
> Hello,
>
> Hopefully this is an appropriate place to ask questions about git-p4.
>
> I started at a company that wants to migrate from Perforce to Git. I'm
> new to Perforce and have been trying to learn just enough about it to
> get through this migration. Anyway, I've been playing with git-p4 and
> have one question/problem to discuss.
>
> After setting up the p4 cli client I can 'p4 sync' some
> //depot/main/app1 which pulls down the files I would expect from the
> Perforce server. If I use 'git p4 clone //depot/main/app1', I get:
>
> "Doing initial import of //depot/main/app1/ from revision #head into
> refs/remotes/p4/master"
>
> But I don't get any files from that depot/folder pulled down. I can
> git p4 clone other depot/folders though and get some files. I suspect
> that I'm just not understanding how the git-p4 module works.

You could try doing the clone with '-v' to get a bit more information.

>
> Basically, I'm hoping to setup a live sync of Perforce to Git of
> certain depots in preparation for the migration. Also, if anyone has
> pointers or guides for this type of migration, any help is
> appreciated.

I've done something similar in the past. You'll want to enable the 
--preserve-user option, for which you will need admin rights.

If it's a one-way mirror (p4-to-git) then just run git-p4 periodically 
(if you use cron, then try to avoid having two or more instances running 
at the same time).

If you want it to be two-way then it gets a bit more complicated.

You might also want to consider using git fusion, which is Perforce's 
take on this problem. I've not used it myself.

 From past experience though I would say the biggest problem is getting 
developers to switch from the P4 mindset (centralized; code review hard 
to do or ignored) to the git mindset (decentralized; code review 
actively supported by the version control system).

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

```

## FusionX86, 2015-04-21 13:23

Subject: Re: git-p4 Question
Message-ID: <CAFcBi88CwmJ=bxf92BWKLB2m25jnJFD6jpFPYog9Hdneen38DQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAFcBi88CwmJ%3Dbxf92BWKLB2m25jnJFD6jpFPYog9Hdneen38DQ%40mail.gmail.com
In-Reply-To: <5535443C.1060600@vilain.net>

```
Thanks Sam, I'll check it out.

On Mon, Apr 20, 2015 at 12:23 PM, Sam Vilain <sam@vilain.net> wrote:
> On 04/20/2015 09:41 AM, FusionX86 wrote:
>>
>> Hopefully this is an appropriate place to ask questions about git-p4.
>>
>> I started at a company that wants to migrate from Perforce to Git. I'm
>> new to Perforce and have been trying to learn just enough about it to
>> get through this migration.
>
>
> You might also like to check out my git-p4raw project which imports directly
> from the raw repository files into a git repo using git fast-import
>
>     http://github.com/samv/git-p4raw
>
> Apparently it's my most popular github project :-).  YMMV.
>
> Sam.

```

## FusionX86, 2015-04-21 13:33

Subject: Re: git-p4 Question
Message-ID: <CAFcBi89pXTKzeVkB5EN3ZYkLwa1oPfDOqdHHhHeVogswhnpOAg@mail.gmail.com>
URL: https://gitlist.dev/e/CAFcBi89pXTKzeVkB5EN3ZYkLwa1oPfDOqdHHhHeVogswhnpOAg%40mail.gmail.com
In-Reply-To: <553552FD.80703@diamand.org>

```
Hi Luke,

Using -v was a good suggestion. Unfortunately I still don't see what
the problem is. I'm starting to think that maybe I should just create
the client views I need and setup a cron job that p4 syncs and then
git commits/pushes.

The --preserve-user option is for submitting back to Perforce correct?
I'm hoping to get away with a one-way sync from Perforce to Git...and
then eventually just cut over to Git.

I also looked at git fusion, but unfortunately the version of Perforce
we're running (2012.1) doesn't meet the requirements for fusion. I
wish it did.

Good point on developer mindset. I think we definitely have some
training and habit changing in the future.

Thanks for the suggestions and pointers, it's much appreciated.

On Mon, Apr 20, 2015 at 1:26 PM, Luke Diamand <luke@diamand.org> wrote:
> On 20/04/15 17:41, FusionX86 wrote:
>>
>> Hello,
>>
>> Hopefully this is an appropriate place to ask questions about git-p4.
>>
>> I started at a company that wants to migrate from Perforce to Git. I'm
>> new to Perforce and have been trying to learn just enough about it to
>> get through this migration. Anyway, I've been playing with git-p4 and
>> have one question/problem to discuss.
>>
>> After setting up the p4 cli client I can 'p4 sync' some
>> //depot/main/app1 which pulls down the files I would expect from the
>> Perforce server. If I use 'git p4 clone //depot/main/app1', I get:
>>
>> "Doing initial import of //depot/main/app1/ from revision #head into
>> refs/remotes/p4/master"
>>
>> But I don't get any files from that depot/folder pulled down. I can
>> git p4 clone other depot/folders though and get some files. I suspect
>> that I'm just not understanding how the git-p4 module works.
>
>
> You could try doing the clone with '-v' to get a bit more information.
>
>>
>> Basically, I'm hoping to setup a live sync of Perforce to Git of
>> certain depots in preparation for the migration. Also, if anyone has
>> pointers or guides for this type of migration, any help is
>> appreciated.
>
>
> I've done something similar in the past. You'll want to enable the
> --preserve-user option, for which you will need admin rights.
>
> If it's a one-way mirror (p4-to-git) then just run git-p4 periodically (if
> you use cron, then try to avoid having two or more instances running at the
> same time).
>
> If you want it to be two-way then it gets a bit more complicated.
>
> You might also want to consider using git fusion, which is Perforce's take
> on this problem. I've not used it myself.
>
> From past experience though I would say the biggest problem is getting
> developers to switch from the P4 mindset (centralized; code review hard to
> do or ignored) to the git mindset (decentralized; code review actively
> supported by the version control system).
>
>> --
>> 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
>>
>

```

## Luke Diamand, 2015-04-21 16:53

Subject: Re: git-p4 Question
Message-ID: <CAE5ih79L+RU934OYsBrXjP7PAoDYbeBS01hCgsOm+pnFD+dWwQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAE5ih79L%2BRU934OYsBrXjP7PAoDYbeBS01hCgsOm%2BpnFD%2BdWwQ%40mail.gmail.com
In-Reply-To: <CAFcBi89pXTKzeVkB5EN3ZYkLwa1oPfDOqdHHhHeVogswhnpOAg@mail.gmail.com>

```
Can you post up the output from 'git p4 clone', and also see what the
output from doing this is:

$ p4 print //depot/some/branch/missingfile.c



On 21 April 2015 at 14:33, FusionX86 <fusionx86@gmail.com> wrote:
> Hi Luke,
>
> Using -v was a good suggestion. Unfortunately I still don't see what
> the problem is. I'm starting to think that maybe I should just create
> the client views I need and setup a cron job that p4 syncs and then
> git commits/pushes.
>
> The --preserve-user option is for submitting back to Perforce correct?
> I'm hoping to get away with a one-way sync from Perforce to Git...and
> then eventually just cut over to Git.
>
> I also looked at git fusion, but unfortunately the version of Perforce
> we're running (2012.1) doesn't meet the requirements for fusion. I
> wish it did.
>
> Good point on developer mindset. I think we definitely have some
> training and habit changing in the future.
>
> Thanks for the suggestions and pointers, it's much appreciated.
>
> On Mon, Apr 20, 2015 at 1:26 PM, Luke Diamand <luke@diamand.org> wrote:
>> On 20/04/15 17:41, FusionX86 wrote:
>>>
>>> Hello,
>>>
>>> Hopefully this is an appropriate place to ask questions about git-p4.
>>>
>>> I started at a company that wants to migrate from Perforce to Git. I'm
>>> new to Perforce and have been trying to learn just enough about it to
>>> get through this migration. Anyway, I've been playing with git-p4 and
>>> have one question/problem to discuss.
>>>
>>> After setting up the p4 cli client I can 'p4 sync' some
>>> //depot/main/app1 which pulls down the files I would expect from the
>>> Perforce server. If I use 'git p4 clone //depot/main/app1', I get:
>>>
>>> "Doing initial import of //depot/main/app1/ from revision #head into
>>> refs/remotes/p4/master"
>>>
>>> But I don't get any files from that depot/folder pulled down. I can
>>> git p4 clone other depot/folders though and get some files. I suspect
>>> that I'm just not understanding how the git-p4 module works.
>>
>>
>> You could try doing the clone with '-v' to get a bit more information.
>>
>>>
>>> Basically, I'm hoping to setup a live sync of Perforce to Git of
>>> certain depots in preparation for the migration. Also, if anyone has
>>> pointers or guides for this type of migration, any help is
>>> appreciated.
>>
>>
>> I've done something similar in the past. You'll want to enable the
>> --preserve-user option, for which you will need admin rights.
>>
>> If it's a one-way mirror (p4-to-git) then just run git-p4 periodically (if
>> you use cron, then try to avoid having two or more instances running at the
>> same time).
>>
>> If you want it to be two-way then it gets a bit more complicated.
>>
>> You might also want to consider using git fusion, which is Perforce's take
>> on this problem. I've not used it myself.
>>
>> From past experience though I would say the biggest problem is getting
>> developers to switch from the P4 mindset (centralized; code review hard to
>> do or ignored) to the git mindset (decentralized; code review actively
>> supported by the version control system).
>>
>>> --
>>> 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
>>>
>>

```

## FusionX86, 2015-04-23 13:42

Subject: Re: git-p4 Question
Message-ID: <CAFcBi88ZohscEZXVXbaf+6=ZKJAy9LRfn2-4WT0JV+1RodBTJg@mail.gmail.com>
URL: https://gitlist.dev/e/CAFcBi88ZohscEZXVXbaf%2B6%3DZKJAy9LRfn2-4WT0JV%2B1RodBTJg%40mail.gmail.com
In-Reply-To: <CAE5ih79L+RU934OYsBrXjP7PAoDYbeBS01hCgsOm+pnFD+dWwQ@mail.gmail.com>

```
Hi Luke,

I found a silly mistake I was making in the command I've been using.
The folder under the depot should have been capitalized, but it
wasn't. Also, I expected that if there was a problem with the command,
it would fail with some message instead of creating an empty local git
repo.

Now I'll move forward with setting up an automated and periodic sync
of P4 to Git in preparation for the migration. Thanks Luke, your
suggestions prompted me to look in the right location for the problem.


On Tue, Apr 21, 2015 at 10:53 AM, Luke Diamand <luke@diamand.org> wrote:
> Can you post up the output from 'git p4 clone', and also see what the
> output from doing this is:
>
> $ p4 print //depot/some/branch/missingfile.c
>
>
>
> On 21 April 2015 at 14:33, FusionX86 <fusionx86@gmail.com> wrote:
>> Hi Luke,
>>
>> Using -v was a good suggestion. Unfortunately I still don't see what
>> the problem is. I'm starting to think that maybe I should just create
>> the client views I need and setup a cron job that p4 syncs and then
>> git commits/pushes.
>>
>> The --preserve-user option is for submitting back to Perforce correct?
>> I'm hoping to get away with a one-way sync from Perforce to Git...and
>> then eventually just cut over to Git.
>>
>> I also looked at git fusion, but unfortunately the version of Perforce
>> we're running (2012.1) doesn't meet the requirements for fusion. I
>> wish it did.
>>
>> Good point on developer mindset. I think we definitely have some
>> training and habit changing in the future.
>>
>> Thanks for the suggestions and pointers, it's much appreciated.
>>
>> On Mon, Apr 20, 2015 at 1:26 PM, Luke Diamand <luke@diamand.org> wrote:
>>> On 20/04/15 17:41, FusionX86 wrote:
>>>>
>>>> Hello,
>>>>
>>>> Hopefully this is an appropriate place to ask questions about git-p4.
>>>>
>>>> I started at a company that wants to migrate from Perforce to Git. I'm
>>>> new to Perforce and have been trying to learn just enough about it to
>>>> get through this migration. Anyway, I've been playing with git-p4 and
>>>> have one question/problem to discuss.
>>>>
>>>> After setting up the p4 cli client I can 'p4 sync' some
>>>> //depot/main/app1 which pulls down the files I would expect from the
>>>> Perforce server. If I use 'git p4 clone //depot/main/app1', I get:
>>>>
>>>> "Doing initial import of //depot/main/app1/ from revision #head into
>>>> refs/remotes/p4/master"
>>>>
>>>> But I don't get any files from that depot/folder pulled down. I can
>>>> git p4 clone other depot/folders though and get some files. I suspect
>>>> that I'm just not understanding how the git-p4 module works.
>>>
>>>
>>> You could try doing the clone with '-v' to get a bit more information.
>>>
>>>>
>>>> Basically, I'm hoping to setup a live sync of Perforce to Git of
>>>> certain depots in preparation for the migration. Also, if anyone has
>>>> pointers or guides for this type of migration, any help is
>>>> appreciated.
>>>
>>>
>>> I've done something similar in the past. You'll want to enable the
>>> --preserve-user option, for which you will need admin rights.
>>>
>>> If it's a one-way mirror (p4-to-git) then just run git-p4 periodically (if
>>> you use cron, then try to avoid having two or more instances running at the
>>> same time).
>>>
>>> If you want it to be two-way then it gets a bit more complicated.
>>>
>>> You might also want to consider using git fusion, which is Perforce's take
>>> on this problem. I've not used it myself.
>>>
>>> From past experience though I would say the biggest problem is getting
>>> developers to switch from the P4 mindset (centralized; code review hard to
>>> do or ignored) to the git mindset (decentralized; code review actively
>>> supported by the version control system).
>>>
>>>> --
>>>> 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
>>>>
>>>

```

## Luke Diamand, 2015-04-24 09:20

Subject: Re: git-p4 Question
Message-ID: <553A0ACF.4000006@diamand.org>
URL: https://gitlist.dev/e/553A0ACF.4000006%40diamand.org
In-Reply-To: <CAFcBi88ZohscEZXVXbaf+6=ZKJAy9LRfn2-4WT0JV+1RodBTJg@mail.gmail.com>

```
On 23/04/15 14:42, FusionX86 wrote:
> Hi Luke,
>
> I found a silly mistake I was making in the command I've been using.
> The folder under the depot should have been capitalized, but it
> wasn't. Also, I expected that if there was a problem with the command,
> it would fail with some message instead of creating an empty local git
> repo.

I would expect that as well - it will usually create the empty git repo, 
but it should then fail with an error message, like this:

$ git p4 clone //depot/main/nosuchpath
Importing from //depot/main/nosuchpath into nosuchpath
Initialized empty Git repository in 
/home/lgd/p4-hacking/git/nosuchpath/.git/
Doing initial import of //depot/main/nosuchpath/ from revision #head 
into refs/remotes/p4/master
p4 returned an error: //depot/main/nosuchpath/...#head - no such file(s).

$ echo $?
1

If you get a moment can you send your command output; if it's not doing 
something like the above, then it's a bug.

Thanks!

Luke

```

## FusionX86, 2015-04-24 14:36

Subject: Re: git-p4 Question
Message-ID: <CAFcBi8-GGxrtm+f7NEf0PmWTkS0m6x2fNPt+y4bopqNLfyvyoQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAFcBi8-GGxrtm%2Bf7NEf0PmWTkS0m6x2fNPt%2By4bopqNLfyvyoQ%40mail.gmail.com
In-Reply-To: <553A0ACF.4000006@diamand.org>

```
I get an error if I misspell part of the path. For example, if I type
//depot/maain instead of //depot/main I will get the "no such files"
message you indicated. BUT using incorrect case like //depot/main
instead of //depot/Main doesn't return any error, but still completes
and creates an empty repo. If it does require correct case, then it
should throw an error for //depot/main as well.

Let me know if you need any additional information.

On Fri, Apr 24, 2015 at 3:20 AM, Luke Diamand <luke@diamand.org> wrote:
> On 23/04/15 14:42, FusionX86 wrote:
>>
>> Hi Luke,
>>
>> I found a silly mistake I was making in the command I've been using.
>> The folder under the depot should have been capitalized, but it
>> wasn't. Also, I expected that if there was a problem with the command,
>> it would fail with some message instead of creating an empty local git
>> repo.
>
>
> I would expect that as well - it will usually create the empty git repo, but
> it should then fail with an error message, like this:
>
> $ git p4 clone //depot/main/nosuchpath
> Importing from //depot/main/nosuchpath into nosuchpath
> Initialized empty Git repository in
> /home/lgd/p4-hacking/git/nosuchpath/.git/
> Doing initial import of //depot/main/nosuchpath/ from revision #head into
> refs/remotes/p4/master
> p4 returned an error: //depot/main/nosuchpath/...#head - no such file(s).
>
> $ echo $?
> 1
>
> If you get a moment can you send your command output; if it's not doing
> something like the above, then it's a bug.
>
> Thanks!
>
> Luke
>

```

## Luke Diamand, 2015-04-26 22:27

Subject: Re: git-p4 Question
Message-ID: <553D6643.5020100@diamand.org>
URL: https://gitlist.dev/e/553D6643.5020100%40diamand.org
In-Reply-To: <CAFcBi8-GGxrtm+f7NEf0PmWTkS0m6x2fNPt+y4bopqNLfyvyoQ@mail.gmail.com>

```
On 24/04/15 15:36, FusionX86 wrote:
> I get an error if I misspell part of the path. For example, if I type
> //depot/maain instead of //depot/main I will get the "no such files"
> message you indicated. BUT using incorrect case like //depot/main
> instead of //depot/Main doesn't return any error, but still completes
> and creates an empty repo. If it does require correct case, then it
> should throw an error for //depot/main as well.

Thanks, that's a somewhat subtle bug....!

Luke

```
