Index: drupalorg_git_gateway/drupalorg_git_gateway.install
===================================================================
RCS file: drupalorg_git_gateway/drupalorg_git_gateway.install
diff -N drupalorg_git_gateway/drupalorg_git_gateway.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ drupalorg_git_gateway/drupalorg_git_gateway.install	21 Jan 2011 06:32:14 -0000
@@ -0,0 +1,77 @@
+<?php
+// $Id$
+/**
+ * @file
+ * Installation, schema, update and uninstall scripts for the d.o Git gateway.
+ */
+
+/**
+ * Implementation of hook_schema().
+ */
+function drupalorg_git_gateway_schema() {
+  $schema = array();
+
+  $schema['users_git'] = array(
+    'description' => 'Custom data for the Git gateway.',
+
+    'fields' => array(
+      'uid' => array(
+        'description' => 'The uid of the person who generated this email.',
+        'not null' => TRUE,
+        'type' => 'int',
+        'unsigned' => TRUE,
+      ),
+      'git_name' => array(
+        'default' => '',
+        'description' => 'The git username associated with this user account.',
+        'length' => 255,
+        'not null' => TRUE,
+        'type' => 'varchar',
+      ),
+    ),
+
+    'primary key' => array('uid'),
+
+    'indexes' => array(
+      'uid'       => array('uid'),
+      'git_name'  => array('git_name'),
+    ),
+  );
+
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function drupalorg_git_gateway_install() {
+  // Install lists tables.
+  drupal_install_schema('drupalorg_git_gateway');
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function drupalorg_git_gateway_uninstall() {
+  // Remove lists tables.
+  drupal_uninstall_schema('drupalorg_git_gateway');
+}
+
+/**
+ * Implementation of hook_update_N().
+ * Add the new 'users_git' table.
+ */
+function drupalorg_git_gateway_update_6101() {
+  $ret = array();
+
+  // Obtain this module's schema.
+  $schema = drupalorg_git_gateway_schema();
+
+  // This is the table to create.
+  $table = 'users_git';
+
+  // Create the table.
+  db_create_table($ret, $table, $schema[$table]);
+
+  return $ret;
+}
Index: drupalorg_git_gateway/drupalorg_git_gateway.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg_git_gateway/Attic/drupalorg_git_gateway.module,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 drupalorg_git_gateway.module
--- drupalorg_git_gateway/drupalorg_git_gateway.module	20 Jan 2011 20:56:20 -0000	1.1.2.8
+++ drupalorg_git_gateway/drupalorg_git_gateway.module	21 Jan 2011 06:32:14 -0000
@@ -1,7 +1,8 @@
 <?php
-
+// $Id$
 /**
  * @file
+ * Git functionality for drupal.org.
  */
 
 /**
@@ -31,7 +32,7 @@ function drupalorg_git_gateway_perm() {
  * Implementation of hook_user().
  */
 function drupalorg_git_gateway_user($op, &$edit, &$account, $category = NULL) {
-  if ($category != 'account') {
+  if ($category != 'account' && in_array($category, array('form', 'insert', 'update'))) {
     return;
   }
 
@@ -57,8 +58,15 @@ function drupalorg_git_gateway_user($op,
       '#title' => t('I agree'),
       '#default_value' => !empty($account->roles[DRUPALORG_GIT_GATEWAY_RID]),
     );
+    $form['drupalorg_git_gateway']['git_name'] = array(
+      '#type' => 'textfield',
+      '#title' => t('Git username'),
+      '#maxlength' => 255,
+      '#default_value' => $account->git_name,
+    );
     return $form;
   }
+
   if (($op == 'insert' || $op == 'update')) {
     if (isset($edit['use_git'])) {
       if (empty($edit['use_git'])) {
@@ -70,6 +78,36 @@ function drupalorg_git_gateway_user($op,
       }
       unset($edit['use_git']);
     }
+
+    // If the git_name field was not submitted, remove any possible value
+    // from the database.
+    if (empty($edit['git_name'])) {
+      db_query("DELETE FROM {users_git} WHERE uid = %d", $account->uid);
+    }
+    // Update the existing record.
+    else {
+      // Value not assigned yet, the first time saving this form.
+      if ($account->git_name === FALSE) {
+        db_query("INSERT INTO {users_git} (uid, git_name) VALUES (%d, '%s')", $account->uid, $edit['git_name']);
+      }
+      // Update the existing record.
+      else {
+        db_query("UPDATE {users_git} SET git_name = '%s' WHERE uid = %d", $edit['git_name'], $account->uid);
+      }
+    }
+    unset($edit['git_name']);
+  }
+
+  if ($op == 'delete') {
+    // Delete the git username record.
+    db_query("DELETE FROM {users_git} WHERE uid = %d", $account->uid);
+  }
+
+  // User object is being loaded.
+  if ($op == 'load') {
+    // Load the git username.  This will be FALSE for users that don't have it
+    // assigned yet.
+    $account->git_name = db_result(db_query("SELECT git_name FROM {users_git} WHERE uid = %d", $account->uid));
   }
 }
 
