{"thread":{"id":"14086","subject":"[PATCH] Add 'git-p4.allowSubmit' to git-p4","startedAt":"2008-06-22T18:12:39Z","lastAt":"2008-06-26T19:10:49Z","messageCount":3,"participants":["Jing Xue","Simon Hausmann","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"80630","messageId":"20080622181239.GA1855@jabba.hq.digizenstudio.com","threadId":"14086","inReplyTo":null,"subject":"[PATCH] Add 'git-p4.allowSubmit' to git-p4","fromName":"Jing Xue","fromEmail":"jingxue@digizenstudio.com","sentAt":"2008-06-22T18:12:39Z","receivedAt":"2008-06-22T18:12:39Z","isPatch":true,"sender":{"key":"jingxue@digizenstudio.com","avatar":null},"body":"I'm working with a perforce repo using git-p4. There are some config\nfiles which I need to change locally according to my environment. I'm\nusing a 'local' git branch to park these changes. And I want to avoid\naccidentally checking them into p4 just by doing \"git p4 submit\"\nmindlessly without realizing which branch I'm actually on.\n\nThis patch adds a new git config, 'git-p4.allowSubmit', which is a\nwhitelist of branch names. \"git p4 submit\" will only allow submissions\nfrom local branches on the list. Useful for preventing inadvertently\nsubmitting from a strictly local branch.\n\nFor backward compatibility, if this config is not set at all,\nsubmissions from all branches are allowed.\n\nSigned-off-by: Jing Xue <jingxue@digizenstudio.com>\n---\n contrib/fast-import/git-p4 |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\nindex d8de9f6..87ca51e 100755\n--- a/contrib/fast-import/git-p4\n+++ b/contrib/fast-import/git-p4\n@@ -687,6 +687,10 @@ class P4Submit(Command):\n         else:\n             return False\n \n+        allowSubmit = gitConfig(\"git-p4.allowSubmit\")\n+        if len(allowSubmit) > 0 and not self.master in allowSubmit.split(\",\"):\n+            die(\"%s is not in git-p4.allowSubmit\" % self.master)\n+\n         [upstream, settings] = findUpstreamBranchPoint()\n         self.depotPath = settings['depot-paths'][0]\n         if len(self.origin) == 0:\n-- \n1.5.6.13.g2ae4ef\n"},{"id":"81311","messageId":"200806262042.13121.simon@lst.de","threadId":"14086","inReplyTo":"20080622181239.GA1855@jabba.hq.digizenstudio.com","subject":"Re: [PATCH] Add 'git-p4.allowSubmit' to git-p4","fromName":"Simon Hausmann","fromEmail":"simon@lst.de","sentAt":"2008-06-26T18:42:09Z","receivedAt":"2008-06-26T18:42:09Z","isPatch":true,"sender":{"key":"hausmann@kde.org","avatar":"https://gravatar.com/avatar/bc9aad4fb31dce17eb66e690e7b51fe980c62da3c225c785da35dd806b8da778?d=mp&s=160"},"body":"On Sunday 22 June 2008 20:12:39 Jing Xue wrote:\n> I'm working with a perforce repo using git-p4. There are some config\n> files which I need to change locally according to my environment. I'm\n> using a 'local' git branch to park these changes. And I want to avoid\n> accidentally checking them into p4 just by doing \"git p4 submit\"\n> mindlessly without realizing which branch I'm actually on.\n>\n> This patch adds a new git config, 'git-p4.allowSubmit', which is a\n> whitelist of branch names. \"git p4 submit\" will only allow submissions\n> from local branches on the list. Useful for preventing inadvertently\n> submitting from a strictly local branch.\n>\n> For backward compatibility, if this config is not set at all,\n> submissions from all branches are allowed.\n>\n> Signed-off-by: Jing Xue <jingxue@digizenstudio.com>\n\nAcked-By: Simon Hausmann <simon@lst.de>\n\n\nSimon\n\n>  contrib/fast-import/git-p4 |    4 ++++\n>  1 files changed, 4 insertions(+), 0 deletions(-)\n>\n> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4\n> index d8de9f6..87ca51e 100755\n> --- a/contrib/fast-import/git-p4\n> +++ b/contrib/fast-import/git-p4\n> @@ -687,6 +687,10 @@ class P4Submit(Command):\n>          else:\n>              return False\n>\n> +        allowSubmit = gitConfig(\"git-p4.allowSubmit\")\n> +        if len(allowSubmit) > 0 and not self.master in\n> allowSubmit.split(\",\"): +            die(\"%s is not in git-p4.allowSubmit\"\n> % self.master)\n> +\n>          [upstream, settings] = findUpstreamBranchPoint()\n>          self.depotPath = settings['depot-paths'][0]\n>          if len(self.origin) == 0:\n\n\n"},{"id":"81316","messageId":"7v7iccqafa.fsf@gitster.siamese.dyndns.org","threadId":"14086","inReplyTo":"200806262042.13121.simon@lst.de","subject":"Re: [PATCH] Add 'git-p4.allowSubmit' to git-p4","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-26T19:10:49Z","receivedAt":"2008-06-26T19:10:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both.\n"}]}