[kde-doc-english] [kdesrc-build] /: Add git-user option.

Michael Pyne mpyne at kde.org
Sat Sep 12 20:59:03 UTC 2015


Git commit 21b5eb9371fbb0f5f43f7cba7606c4bdb32fedd4 by Michael Pyne.
Committed on 12/09/2015 at 20:57.
Pushed by mpyne into branch 'master'.

Add git-user option.

This option can be used to setup the user.name and user.email git-config
options within each new git repository cloned or installed from
snapshot, including kde-projects repositories. This can be useful for
KDE developers with multiple Git identities that they use for
development.

Module settings override global settings so you could e.g. have a global
git-user option for KDE modules and then override specific modules or
module-sets with a different git-user setting.

This setting is only applied during the initial git-clone process
though... if there's interest in having kdesrc-build re-apply settings
later that's possible too.

BUG:352478
FIXED-IN:15.09

M  +33   -2    doc/index.docbook
M  +20   -0    modules/ksb/Updater/Git.pm
M  +2    -2    vim/syntax/kdesrc-buildrc.vim

http://commits.kde.org/kdesrc-build/21b5eb9371fbb0f5f43f7cba7606c4bdb32fedd4

diff --git a/doc/index.docbook b/doc/index.docbook
index 6e647ec..7cad9cd 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -110,8 +110,8 @@
 
 <legalnotice>&FDLNotice;</legalnotice>
 
-<date>2015-03-07</date>
-<releaseinfo>1.16</releaseinfo>
+<date>2015-09-12</date>
+<releaseinfo>15.09</releaseinfo>
 
 <abstract>
 <para>&kdesrc-build; is a script which builds and installs &kde; software
@@ -2008,6 +2008,37 @@ different module sets.</para></tip>
 </entry>
 </row>
 
+<row id="conf-git-user">
+<entry>git-user</entry>
+<entry>Module setting overrides global</entry>
+<entry>
+<para>This option is intended for &kde; developers. If set, it will be used to
+automatically setup identity information for the &git; source control software
+for <emphasis>newly downloaded</emphasis> &git; modules (including the vast
+majority of &kde; modules).</para>
+
+<para>Specifically, the user's name and email fields for each new &git; repository are filled
+in to the values set by this option.</para>
+
+<para>The value must be specified in the form <option><replaceable>User
+Name</replaceable> <<replaceable>email at example.com</replaceable>></option>.</para>
+
+<para>
+<informalexample>
+<para>For instance, a developer named <quote>Foo Barbaz</quote> with the
+email address <quote>foo at abc.xyz</quote> would use:</para>
+
+<screen>
+    <symbol>git-user</symbol> <replaceable>Foo Barbaz</replaceable> <<replaceable>foo at abc.xyz</replaceable>>
+</screen>
+</informalexample>
+</para>
+
+<para>This option was introduced in &kdesrc-build; 15.09.
+</para>
+</entry>
+</row>
+
 <row id="conf-http-proxy">
 <entry>http-proxy</entry>
 <entry>Module setting overrides global</entry>
diff --git a/modules/ksb/Updater/Git.pm b/modules/ksb/Updater/Git.pm
index f68d640..af14c16 100644
--- a/modules/ksb/Updater/Git.pm
+++ b/modules/ksb/Updater/Git.pm
@@ -117,6 +117,26 @@ sub clone
         }
     }
 
+    # Setup user configuration
+    if (my $name = $module->getOption('git-user')) {
+        my ($username, $email) = ($name =~ /^([^<]+) +<([^>]+)>$/);
+        if (!$username || !$email) {
+            croak_runtime("Invalid username or email for git-user option: $name".
+                " (should be in format 'User Name <username\@example.net>'");
+        }
+
+        whisper ("\tAdding git identity $name for new git module $module");
+        my $result = (safe_system(qw(git config --local user.name), $username)
+                        >> 8) == 0;
+
+        $result = (safe_system(qw(git config --local user.email), $email)
+                        >> 8 == 0) || $result;
+
+        if (!$result) {
+            warning ("Unable to set user.name and user.email git config for y[b[$module]!");
+        }
+    }
+
     return;
 }
 
diff --git a/vim/syntax/kdesrc-buildrc.vim b/vim/syntax/kdesrc-buildrc.vim
index 8b60c5c..61deb65 100644
--- a/vim/syntax/kdesrc-buildrc.vim
+++ b/vim/syntax/kdesrc-buildrc.vim
@@ -1,7 +1,7 @@
 " Vim syntax file
 " Language: kdesrc-build configuration file
 " Maintainer: Michael Pyne <mpyne at kde.org>
-" Latest Revision: 21 February 2015
+" Latest Revision: 12 September 2015
 
 " Copyright (c) 2014,2015 Michael Pyne <mpyne at kde.org>
 " Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@ syn keyword ksbrcOption contained skipwhite nextgroup=ksbrcStringValue
             \ libpath log-dir make-install-prefix make-options module-base-path
             \ override-build-system override-url prefix qtdir repository
             \ revision source-dir svn-server tag remove-after-install
-            \ qmake-options
+            \ qmake-options git-user
 
 syn keyword ksbrcGlobalOption contained skipwhite nextgroup=ksbrcStringValue
             \ branch-group git-desired-protocol git-repository-base http-proxy


More information about the kde-doc-english mailing list