{"thread":{"id":"23146","subject":"git-p4 and git clone","startedAt":"2010-03-22T23:16:19Z","lastAt":"2010-04-08T15:55:33Z","messageCount":7,"participants":["Thomas Kistler","Benjamin Meyer","Tor Arvid Lund"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137594","messageId":"B978892CA0FBD142827E74F92AC4BBD429B2444D4D@HQMAIL03.nvidia.com","threadId":"23146","inReplyTo":null,"subject":"git-p4 and git clone","fromName":"Thomas Kistler","fromEmail":"tkistler@nvidia.com","sentAt":"2010-03-22T23:16:19Z","receivedAt":"2010-03-22T23:16:19Z","isPatch":false,"sender":{"key":"tkistler@nvidia.com","avatar":null},"body":"I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n\nFirst, I'm setting up a git-p4 master repository:\n\n    $ cd tmp1\n    $ git-p4 clone //foo/bar\n\nThen I'm cloning it through git:\n\n    $ cd tmp2\n    $ git clone tmp1/bar\n\nFinally, I'm trying to submit back to p4:\n\n    $ git-p4 submit\n\nThis now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n\n-Thomas\n-----------------------------------------------------------------------------------\nThis email message is for the sole use of the intended recipient(s) and may contain\nconfidential information.  Any unauthorized review, use, disclosure or distribution\nis prohibited.  If you are not the intended recipient, please contact the sender by\nreply email and destroy all copies of the original message.\n-----------------------------------------------------------------------------------\n"},{"id":"137599","messageId":"4880E32B-7880-40BF-8AFD-AC00DA457CEE@meyerhome.net","threadId":"23146","inReplyTo":"B978892CA0FBD142827E74F92AC4BBD429B2444D4D@HQMAIL03.nvidia.com","subject":"Re: git-p4 and git clone","fromName":"Benjamin Meyer","fromEmail":"ben@meyerhome.net","sentAt":"2010-03-23T00:15:19Z","receivedAt":"2010-03-23T00:15:19Z","isPatch":false,"sender":{"key":"ben@meyerhome.net","avatar":null},"body":"\nOn Mar 22, 2010, at 7:16 PM, Thomas Kistler wrote:\n\n> I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n> \n> First, I'm setting up a git-p4 master repository:\n> \n>    $ cd tmp1\n>    $ git-p4 clone //foo/bar\n> \n> Then I'm cloning it through git:\n> \n>    $ cd tmp2\n>    $ git clone tmp1/bar\n> \n> Finally, I'm trying to submit back to p4:\n> \n>    $ git-p4 submit\n> \n> This now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n> \n> -Thomas\n\nThere is a -import-local option you can use.  Then the p4/master branch is local and when you do the second clone you will get the p4/master branch.\n\n-Benjamin Meyer"},{"id":"137644","messageId":"B978892CA0FBD142827E74F92AC4BBD429B2444D5C@HQMAIL03.nvidia.com","threadId":"23146","inReplyTo":"4880E32B-7880-40BF-8AFD-AC00DA457CEE@meyerhome.net","subject":"RE: git-p4 and git clone","fromName":"Thomas Kistler","fromEmail":"tkistler@nvidia.com","sentAt":"2010-03-23T15:37:48Z","receivedAt":"2010-03-23T15:37:48Z","isPatch":false,"sender":{"key":"tkistler@nvidia.com","avatar":null},"body":"That doesn't seem to work. With --import-local, I can't even submit back from the original repository.\n\n    $ cd tmp1\n    $ git-p4 clone --import-local //foo/bar\n    $ cd bar\n    $ git checkout p4/master\n    $ git-p4 submit --verbose\n    \nReading pipe: git name-rev HEAD\nReading pipe: git config git-p4.allowSubmit\nReading pipe: git rev-parse --symbolic  --remotes\nReading pipe: git cat-file commit HEAD~0\nReading pipe: git cat-file commit HEAD~1\nfatal: Not a valid object name HEAD~1 \n\n\n-----Original Message-----\nFrom: Benjamin Meyer [mailto:ben@meyerhome.net] \nSent: Monday, March 22, 2010 5:15 PM\nTo: Thomas Kistler\nCc: 'git@vger.kernel.org'\nSubject: Re: git-p4 and git clone\n\n\nOn Mar 22, 2010, at 7:16 PM, Thomas Kistler wrote:\n\n> I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n> \n> First, I'm setting up a git-p4 master repository:\n> \n>    $ cd tmp1\n>    $ git-p4 clone //foo/bar\n> \n> Then I'm cloning it through git:\n> \n>    $ cd tmp2\n>    $ git clone tmp1/bar\n> \n> Finally, I'm trying to submit back to p4:\n> \n>    $ git-p4 submit\n> \n> This now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n> \n> -Thomas\n\nThere is a -import-local option you can use.  Then the p4/master branch is local and when you do the second clone you will get the p4/master branch.\n\n-Benjamin Meyer\n-----------------------------------------------------------------------------------\nThis email message is for the sole use of the intended recipient(s) and may contain\nconfidential information.  Any unauthorized review, use, disclosure or distribution\nis prohibited.  If you are not the intended recipient, please contact the sender by\nreply email and destroy all copies of the original message.\n-----------------------------------------------------------------------------------\n"},{"id":"137654","messageId":"1a6be5fa1003231038h695ebbf2k8a765b4a9b6e274d@mail.gmail.com","threadId":"23146","inReplyTo":"B978892CA0FBD142827E74F92AC4BBD429B2444D5C@HQMAIL03.nvidia.com","subject":"Re: git-p4 and git clone","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2010-03-23T17:38:19Z","receivedAt":"2010-03-23T17:38:19Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Tue, Mar 23, 2010 at 4:37 PM, Thomas Kistler <tkistler@nvidia.com> wrote:\n> That doesn't seem to work. With --import-local, I can't even submit back from the original repository.\n\nHi.\n\nFor me it works in this scenario:\nIf your perforce depot is A, you \"git-p4 clone --import-local\" that\ninto B, then git clone B into C. From C you should be able to do\ngit-p4 submit.\n\nSo, my normal recipe (if anyones interested) is to not use B for\nanything other than importing from p4 and functioning as a clone\nsource. Like so:\n\n$ git-p4 clone --import-local //depot/A@all B\n$ mv B/.git B.git\n$ rm -rf B\n$ cd B.git\n$ git config core.bare true\n$ rm refs/heads/master\n$ echo ref: refs/heads/p4/master > HEAD\n\n(Then I have a script that does \"git-p4 sync --import-local\" every so\noften in this repo)\n\n... And then on my working computer, I do:\n\n$ git clone user@remote:B.git C\n$ cd C\n$ [work, work, work, git commit]\n$ git-p4 submit\n\n...And every so often:\n$ git-p4 sync\n\n(Disclaimer: recipe from memory... might not be 100% correct :-/)\n\n-Tor Arvid-\n\n>    $ cd tmp1\n>    $ git-p4 clone --import-local //foo/bar\n>    $ cd bar\n>    $ git checkout p4/master\n>    $ git-p4 submit --verbose\n>\n> Reading pipe: git name-rev HEAD\n> Reading pipe: git config git-p4.allowSubmit\n> Reading pipe: git rev-parse --symbolic  --remotes\n> Reading pipe: git cat-file commit HEAD~0\n> Reading pipe: git cat-file commit HEAD~1\n> fatal: Not a valid object name HEAD~1\n>\n>\n> -----Original Message-----\n> From: Benjamin Meyer [mailto:ben@meyerhome.net]\n> Sent: Monday, March 22, 2010 5:15 PM\n> To: Thomas Kistler\n> Cc: 'git@vger.kernel.org'\n> Subject: Re: git-p4 and git clone\n>\n>\n> On Mar 22, 2010, at 7:16 PM, Thomas Kistler wrote:\n>\n>> I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n>>\n>> First, I'm setting up a git-p4 master repository:\n>>\n>>    $ cd tmp1\n>>    $ git-p4 clone //foo/bar\n>>\n>> Then I'm cloning it through git:\n>>\n>>    $ cd tmp2\n>>    $ git clone tmp1/bar\n>>\n>> Finally, I'm trying to submit back to p4:\n>>\n>>    $ git-p4 submit\n>>\n>> This now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n>>\n>> -Thomas\n>\n> There is a -import-local option you can use.  Then the p4/master branch is local and when you do the second clone you will get the p4/master branch.\n>\n> -Benjamin Meyer\n> -----------------------------------------------------------------------------------\n> This email message is for the sole use of the intended recipient(s) and may contain\n> confidential information.  Any unauthorized review, use, disclosure or distribution\n> is prohibited.  If you are not the intended recipient, please contact the sender by\n> reply email and destroy all copies of the original message.\n> -----------------------------------------------------------------------------------\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"137657","messageId":"B978892CA0FBD142827E74F92AC4BBD429B2444D66@HQMAIL03.nvidia.com","threadId":"23146","inReplyTo":"1a6be5fa1003231038h695ebbf2k8a765b4a9b6e274d@mail.gmail.com","subject":"RE: git-p4 and git clone","fromName":"Thomas Kistler","fromEmail":"tkistler@nvidia.com","sentAt":"2010-03-23T18:02:28Z","receivedAt":"2010-03-23T18:02:28Z","isPatch":false,"sender":{"key":"tkistler@nvidia.com","avatar":null},"body":"That doesn't work for me. You can't submit from B because there are no remotes in that repository and p4BranchesInGit() is looking for remotes only.\nYou also cannot submit from C because the remotes are named origin/p4/master whereas p4BranchesInGit() is looking for ^p4/.\n\n-Thomas\n\n-----Original Message-----\nFrom: Tor Arvid Lund [mailto:torarvid@gmail.com] \nSent: Tuesday, March 23, 2010 10:38 AM\nTo: Thomas Kistler\nCc: Benjamin Meyer; git@vger.kernel.org\nSubject: Re: git-p4 and git clone\n\nOn Tue, Mar 23, 2010 at 4:37 PM, Thomas Kistler <tkistler@nvidia.com> wrote:\n> That doesn't seem to work. With --import-local, I can't even submit back from the original repository.\n\nHi.\n\nFor me it works in this scenario:\nIf your perforce depot is A, you \"git-p4 clone --import-local\" that\ninto B, then git clone B into C. From C you should be able to do\ngit-p4 submit.\n\nSo, my normal recipe (if anyones interested) is to not use B for\nanything other than importing from p4 and functioning as a clone\nsource. Like so:\n\n$ git-p4 clone --import-local //depot/A@all B\n$ mv B/.git B.git\n$ rm -rf B\n$ cd B.git\n$ git config core.bare true\n$ rm refs/heads/master\n$ echo ref: refs/heads/p4/master > HEAD\n\n(Then I have a script that does \"git-p4 sync --import-local\" every so\noften in this repo)\n\n... And then on my working computer, I do:\n\n$ git clone user@remote:B.git C\n$ cd C\n$ [work, work, work, git commit]\n$ git-p4 submit\n\n...And every so often:\n$ git-p4 sync\n\n(Disclaimer: recipe from memory... might not be 100% correct :-/)\n\n-Tor Arvid-\n\n>    $ cd tmp1\n>    $ git-p4 clone --import-local //foo/bar\n>    $ cd bar\n>    $ git checkout p4/master\n>    $ git-p4 submit --verbose\n>\n> Reading pipe: git name-rev HEAD\n> Reading pipe: git config git-p4.allowSubmit\n> Reading pipe: git rev-parse --symbolic  --remotes\n> Reading pipe: git cat-file commit HEAD~0\n> Reading pipe: git cat-file commit HEAD~1\n> fatal: Not a valid object name HEAD~1\n>\n>\n> -----Original Message-----\n> From: Benjamin Meyer [mailto:ben@meyerhome.net]\n> Sent: Monday, March 22, 2010 5:15 PM\n> To: Thomas Kistler\n> Cc: 'git@vger.kernel.org'\n> Subject: Re: git-p4 and git clone\n>\n>\n> On Mar 22, 2010, at 7:16 PM, Thomas Kistler wrote:\n>\n>> I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n>>\n>> First, I'm setting up a git-p4 master repository:\n>>\n>>    $ cd tmp1\n>>    $ git-p4 clone //foo/bar\n>>\n>> Then I'm cloning it through git:\n>>\n>>    $ cd tmp2\n>>    $ git clone tmp1/bar\n>>\n>> Finally, I'm trying to submit back to p4:\n>>\n>>    $ git-p4 submit\n>>\n>> This now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n>>\n>> -Thomas\n>\n> There is a -import-local option you can use.  Then the p4/master branch is local and when you do the second clone you will get the p4/master branch.\n>\n> -Benjamin Meyer\n> -----------------------------------------------------------------------------------\n> This email message is for the sole use of the intended recipient(s) and may contain\n> confidential information.  Any unauthorized review, use, disclosure or distribution\n> is prohibited.  If you are not the intended recipient, please contact the sender by\n> reply email and destroy all copies of the original message.\n> -----------------------------------------------------------------------------------\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"137659","messageId":"1a6be5fa1003231111pc98bfbbg299ea0f95a7926a7@mail.gmail.com","threadId":"23146","inReplyTo":"B978892CA0FBD142827E74F92AC4BBD429B2444D66@HQMAIL03.nvidia.com","subject":"Re: git-p4 and git clone","fromName":"Tor Arvid Lund","fromEmail":"torarvid@gmail.com","sentAt":"2010-03-23T18:11:47Z","receivedAt":"2010-03-23T18:11:47Z","isPatch":false,"sender":{"key":"torarvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/439758?v=4"},"body":"On Tue, Mar 23, 2010 at 7:02 PM, Thomas Kistler <tkistler@nvidia.com> wrote:\n> That doesn't work for me. You can't submit from B because there are no remotes in that repository and p4BranchesInGit() is looking for remotes only.\n> You also cannot submit from C because the remotes are named origin/p4/master whereas p4BranchesInGit() is looking for ^p4/.\n\nHmm, ok. Submitting from B doesn't work for me either, as I said in my\nprevious mail... Tried my recipe now. I get the same problem with C.\nThe \"solution\" I found was to run a \"git-p4 sync\" from C. Then git-p4\nwill create remotes/p4/master in addition to remotes/origin/*. Then it\nworked for me.\n\n-Tor Arvid-\n\n> -Thomas\n>\n> -----Original Message-----\n> From: Tor Arvid Lund [mailto:torarvid@gmail.com]\n> Sent: Tuesday, March 23, 2010 10:38 AM\n> To: Thomas Kistler\n> Cc: Benjamin Meyer; git@vger.kernel.org\n> Subject: Re: git-p4 and git clone\n>\n> On Tue, Mar 23, 2010 at 4:37 PM, Thomas Kistler <tkistler@nvidia.com> wrote:\n>> That doesn't seem to work. With --import-local, I can't even submit back from the original repository.\n>\n> Hi.\n>\n> For me it works in this scenario:\n> If your perforce depot is A, you \"git-p4 clone --import-local\" that\n> into B, then git clone B into C. From C you should be able to do\n> git-p4 submit.\n>\n> So, my normal recipe (if anyones interested) is to not use B for\n> anything other than importing from p4 and functioning as a clone\n> source. Like so:\n>\n> $ git-p4 clone --import-local //depot/A@all B\n> $ mv B/.git B.git\n> $ rm -rf B\n> $ cd B.git\n> $ git config core.bare true\n> $ rm refs/heads/master\n> $ echo ref: refs/heads/p4/master > HEAD\n>\n> (Then I have a script that does \"git-p4 sync --import-local\" every so\n> often in this repo)\n>\n> ... And then on my working computer, I do:\n>\n> $ git clone user@remote:B.git C\n> $ cd C\n> $ [work, work, work, git commit]\n> $ git-p4 submit\n>\n> ...And every so often:\n> $ git-p4 sync\n>\n> (Disclaimer: recipe from memory... might not be 100% correct :-/)\n>\n> -Tor Arvid-\n>\n>>    $ cd tmp1\n>>    $ git-p4 clone --import-local //foo/bar\n>>    $ cd bar\n>>    $ git checkout p4/master\n>>    $ git-p4 submit --verbose\n>>\n>> Reading pipe: git name-rev HEAD\n>> Reading pipe: git config git-p4.allowSubmit\n>> Reading pipe: git rev-parse --symbolic  --remotes\n>> Reading pipe: git cat-file commit HEAD~0\n>> Reading pipe: git cat-file commit HEAD~1\n>> fatal: Not a valid object name HEAD~1\n>>\n>>\n>> -----Original Message-----\n>> From: Benjamin Meyer [mailto:ben@meyerhome.net]\n>> Sent: Monday, March 22, 2010 5:15 PM\n>> To: Thomas Kistler\n>> Cc: 'git@vger.kernel.org'\n>> Subject: Re: git-p4 and git clone\n>>\n>>\n>> On Mar 22, 2010, at 7:16 PM, Thomas Kistler wrote:\n>>\n>>> I'm probably missing something fairly fundamental but I'm running into problems with cloning a git-p4 repository:\n>>>\n>>> First, I'm setting up a git-p4 master repository:\n>>>\n>>>    $ cd tmp1\n>>>    $ git-p4 clone //foo/bar\n>>>\n>>> Then I'm cloning it through git:\n>>>\n>>>    $ cd tmp2\n>>>    $ git clone tmp1/bar\n>>>\n>>> Finally, I'm trying to submit back to p4:\n>>>\n>>>    $ git-p4 submit\n>>>\n>>> This now fails because the remotes/p4/master seems to get lost when doing the \"git clone\". Is this supposed to work?\n>>>\n>>> -Thomas\n>>\n>> There is a -import-local option you can use.  Then the p4/master branch is local and when you do the second clone you will get the p4/master branch.\n>>\n>> -Benjamin Meyer\n>> -----------------------------------------------------------------------------------\n>> This email message is for the sole use of the intended recipient(s) and may contain\n>> confidential information.  Any unauthorized review, use, disclosure or distribution\n>> is prohibited.  If you are not the intended recipient, please contact the sender by\n>> reply email and destroy all copies of the original message.\n>> -----------------------------------------------------------------------------------\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n>\n"},{"id":"138963","messageId":"B978892CA0FBD142827E74F92AC4BBD429B5EDD0BC@HQMAIL03.nvidia.com","threadId":"23146","inReplyTo":"1a6be5fa1003231111pc98bfbbg299ea0f95a7926a7@mail.gmail.com","subject":"cherry pick into remote / git-p4","fromName":"Thomas Kistler","fromEmail":"tkistler@nvidia.com","sentAt":"2010-04-08T15:55:33Z","receivedAt":"2010-04-08T15:55:33Z","isPatch":false,"sender":{"key":"tkistler@nvidia.com","avatar":null},"body":"Before doing a lot of work I wanted to see whether someone has a simple solution to cherry pick a particular commit into a remote branch (and by that I mean the refs/remote branch in the local repository and not the remote repository).\n\nHere is some more background. In our setup, we periodically bunch git changes up and submit them back to an external perforce repository (using a modified version of git-p4). When those changes come back into the git repository (using git-p4 sync) we see the combined changes rather than the individual ones, which can lead to rebase conflicts. So rather than importing the combined changes, we'd like to replay the individual changes from the master branch if present (we store the git commit ids as part of our perforce commit message so we know which ids to replay). But there doesn't seem to be an easy way to do that.\n\n-Thomas \n\n-----------------------------------------------------------------------------------\nThis email message is for the sole use of the intended recipient(s) and may contain\nconfidential information.  Any unauthorized review, use, disclosure or distribution\nis prohibited.  If you are not the intended recipient, please contact the sender by\nreply email and destroy all copies of the original message.\n-----------------------------------------------------------------------------------\n"}]}