diff --git a/CHANGELOG.txt b/CHANGELOG.txt
new file mode 100644
index 0000000..4893a25
--- /dev/null
+++ b/CHANGELOG.txt
@@ -0,0 +1,24 @@
+Project Git instructions 6.x-1.x, 2011-04-20
+- Default direction updates
+ * Issue #1128070 by eliza411: Fixed Update Git instructions to include only the basic patch recommendation
+
+Project Git instructions 6.x-1.x, 2011-03-24
+--------------------------------------------
+- Default direction updates
+ * Issue #1080860: Updated commit message directions to explicitly recommend against starting messages with #.
+ * Issue #1092226: Updated command for creating patches from git format-patch to git diff
+ * Issue #1104302: Added directions for applying patches and abandoning local changes.
+
+Project Git instructions 6.x-1.x, 2011-xx-xx
+--------------------------------------------
+- Default direction updates
+ * Issue #1075982 by helmo, David_Rothstein: Fixed 'Troubleshooting Git clone' link does not appear for projects you maintain.
+
+- Module updates
+ * Issue #1074220 by EclipseGc, helmo: Fixed Numerically Named Branches can result in bad instructions.
+ * Issue #1073394 by drumm: Set project breadcrumb.
+
+Project Git instructions 6.x-1.0, 2011-02-24
+--------------------------------------------
+* Initial release
+* This release marks the transition of drupal.org to Git.
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..da6afee
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,10 @@
+Project Git Instructions
+------------------------
+
+This module adds the "Git instructions" tab to certian pages on Drupal.org. This includes modules, themes and installation profiles.
+
+This modules is specifically build for use on drupal.org.
+
+If you are hosting Git repositories yourself and make use of the versioncontrol API modules in drupal then maybe this module can be of service. It has however not been extensively tested on other installations.
+
+See: http://drupal.org/project/project_git_instructions
diff --git a/project_git_instructions.module b/project_git_instructions.module
index b38f1d2..1119d96 100644
--- a/project_git_instructions.module
+++ b/project_git_instructions.module
@@ -34,12 +34,12 @@ function project_git_instructions_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($node->type == 'project_project') {
$src = 'node/' . $node->nid . '/git-instructions';
if ($op == 'delete') {
- db_query('DELETE FROM {url_alias} WHERE src = "%s"', $src);
+ db_query("DELETE FROM {url_alias} WHERE src = '%s'", $src);
}
elseif (($op == 'update' || $op == 'insert') && !empty($node->project['uri'])) {
$dst = 'project/' . drupal_urlencode($node->project['uri']) . '/git-instructions';
- db_query('DELETE FROM {url_alias} WHERE src = "%s"', $src);
- db_query('INSERT INTO {url_alias} (src, dst) VALUES ("%s", "%s")', $src, $dst);
+ db_query("DELETE FROM {url_alias} WHERE src = '%s'", $src);
+ db_query("INSERT INTO {url_alias} (src, dst) VALUES ('%s', '%s')", $src, $dst);
}
elseif ($op == 'view' && $a4) {
if ($node->project['sandbox']) {
@@ -89,16 +89,17 @@ function project_git_instructions_visibility($node) {
* @return array Default replacements formatted for t().
*/
function project_git_instructions_get_defaults($node, $version = NULL) {
-
global $user;
+ project_project_set_breadcrumb($node, TRUE);
+
$project_url_name = check_plain(drupal_urlencode($node->project['uri'] . '.git'));
// Make the most common set of default replacement variables we can.
$defaults = array('@project_name' => $project_url_name,
'@uri' => $node->project['uri'],
'%title' => $node->title,
- '@project_fullname' => strtr(drupal_strtolower($node->title), array(' ' => '_'))
+ '@project_fullname' => preg_replace('#\W#', '_', drupal_strtolower($node->title)),
);
if ($version) {
$defaults['@branch'] = check_plain($version);
@@ -141,7 +142,6 @@ function project_git_instructions_get_defaults($node, $version = NULL) {
* Produce html code for the instructions tab.
*/
function project_git_instructions_project_tab($node, $version = NULL, $do_nonmaintainer = NULL) {
-
global $user;
if (empty($node->versioncontrol_project['repo']->vcs)) {
@@ -362,15 +362,22 @@ function project_git_instructions_project_promote_sandbox($project) {
*/
function project_git_instructions_maintainer() {
$default = << Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details. Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details. Once you've pushed the properly formed tag or branch, see Creating a project release for directions to actually create the release node. Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details. You will be prompted to enter your Drupal.org password after the
first and last step if you have not uploaded an SSH Key or if your SSH
key fails. See Authenticating with Git on
@@ -511,18 +574,24 @@ EOT;
function project_git_instructions_sandbox_maintainer() {
$default = << You will be prompted to enter your Drupal.org password after the
-first step (and any time you make requests from Drupal.org) if you
-have not uploaded an SSH key or if your SSH key fails. See Authenticate with Git on Drupal.org for
-details. Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details. Note: When patching in response to an issue from your issue queue, the format for the commit message takes the form
-of: Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details.
+Abandon changes to a specific file:
+
One-Time Only
-Setting up this repository in your local environment for the first time:
+Setting up this repository in your local environment for the first time
If you have just created a project or you already have a local repository, skip this step.
git clone --branch @branch @auth_project_url
cd @uri
Associating your copy of the repository with your Drupal.org account
-If you have NOT already identified yourself to Git globally, do so now. Although it is standard practice to use a functional address, you can also use the pre-configured address @git_username@@uid-no-reply.drupal.org
. See Manage your Git identity for details.
+If you have NOT already identified yourself to Git globally, do so now. Although it is standard practice to use a functional address, you can also use the pre-configured address @git_username@@uid.no-reply.drupal.org
. See Identifying yourself to Git for details.
git config user.email "@email"
git checkout [branchname]
-Commiting all changes locally
-Committing all changes locally
+After making changes, add and commit them. Do not begin commit messages with the # symbol. See Commit messages for details.
git add .
+git add -A
git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
Pushing your code back to the repository on Drupal.org
git push origin @branch
Patching
+Getting ready to create or apply patches
+If you have not already cloned the repository, follow the directions above for setting up this repository in your local environment. Be sure you are on the branch you wish to patch, then ensure it is up-to-date with the following command:
+git pull origin @branch
+Creating a patch
-For a discussion of this recommend patch sequence, see the Patch contributor guide.
+For most improvements, use the following command after making your changes:
git checkout -b [description]-[issue-number]
+git diff > [description]-[issue-number]-[comment-number].patch
Applying a patch
+Download the patch to your working directory. Apply the patch with the following command:
git add -A
-git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
+git apply -v [patchname.patch]
git status
-git fetch origin
-git rebase origin/@branch
-git format-patch origin/@branch --stdout > [description]-[issue-number]-[comment-number].patch
+rm [patchname.patch]
+When you're done: Reverting uncommited changes
+Revert changes to a specific file:
+git checkout [filename]
+git reset --hard
Creating Releases
+See the naming conventions for a complete description of how to name branches and tags so you can create releases.
+Branch for a dev release
+This creates and checks out a new branch in one command.
+git checkout -b 7.x-1.x
+git push origin 7.x-1.x
+Tag for a stable release
+git checkout 7.x-1.x
+git tag 7.x-1.0
+git push origin 7.x-1.0
+
+
One-Time Only
-Setting up repository for the first time:
+Setting up repository for the first time
git clone --branch @branch @anon_project_url
cd @uri
@@ -446,23 +492,40 @@ When you clone the repository you have access to all the branches and tags. The
git branch -a
git checkout [branchname]
Patching
+Getting ready to create or apply patches
+If you have not already cloned the repository, follow the directions above for setting up this repository in your local environment. Be sure you are on the branch you wish to patch, then ensure it is up-to-date with the following command:
+git pull origin @branch
+Creating a patch
-For a discussion of this recommend patch sequence, see the Patch contributor guide.
+For most improvements, use the following command after making your changes:
git checkout -b [description]-[issue-number]
+git diff > [description]-[issue-number]-[comment-number].patch
Applying a patch
+Download the patch to your working directory. Apply the patch with the following command:
git add -A
-git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
+git apply -v [patchname.patch]
git status
-git fetch origin
-git rebase origin/@branch
-git format-patch origin/@branch --stdout > [description]-[issue-number]-[comment-number].patch
+rm [patchname.patch]
+When you're done: Reverting uncommited changes
+Revert changes to a specific file:
+git checkout [filename]
+git reset --hard
Setting up this repository for the first time:
+Setting up this repository for the first time
+
One-Time Only
-Setting up this repository in your local environment for the first time:
-Setting up repository for the first time
git clone --branch @branch @auth_sandbox_url @project_fullname
-
cd @project_fullname
Associating your copy of the repository with your Drupal.org account
+If you have NOT already identified yourself to Git globally, do so now. Although it is standard practice to use a functional address, you can also use the pre-configured address @git_username@@uid-no-reply.drupal.org
. See Identifying yourself to Git for details.
+git config user.email "@email"
+Routinely
The headings below are not sequential. What you choose to do depends on where you are in your process.
Checking your repository status
@@ -530,63 +599,70 @@ To see what you will commit by running git commit
and what you coul
git status
Switching to a different branch
-When you clone the repository you have access to all the branches and tags. The first command shows your choices. The second command makes the switch. See branching and tagging for details.
+When you clone the repository you have access to all the branches and tags. The first command shows your choices. The second command makes the switch. See branching and tagging for details.
git branch -a
git checkout [branchname]
Committing all changes locally
-git add .
-git commit -m "Message about your changes"
-
-git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
-Pushing your code back to the repository on Drupal.org
-git diff origin/@branch
-git push origin @branch
-Creating a patch
For a discussion of this recommend patch sequence, see the Patch contributor guide.
git checkout -b [branchname]
+git checkout -b [description]-[issue-number]
git add .
+git add -A
git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
git status
git fetch origin
git rebase origin/@branch
-git format-patch origin/@branch --stdout > [description]-[issue-number]-[comment-number].patch
+git diff origin/@branch > [description]-[issue-number]-[comment-number].patch
Applying a patch
+If you have not already cloned the repository, follow the directions above for setting up this repository in your local environment. Be sure you are on the branch you wish to patch and that it is up-to-date using the following commands:
+git checkout --track origin/@branch
+git pull origin @branch
+git apply [patch.name]
rm [patch.name]
Abandoning your local changes
+
+git checkout [filename]
+Abandon changes to the whole working tree:
+
git reset --hard
git clone --branch @branch @anon_sandbox_url @project_fullname
cd @project_fullname
git commit
and what you coul
git status
git branch -a
git checkout [branchname]
git pull origin @branch
git checkout -b [branchname]
+git diff > [description]-[issue-number]-[comment-number].patch
Make your changes. Note the change in syntax for issue-related commit messages. See the Commit messages page for details.
+For more complex improvements that require adding/removing files, work over the course of multiple days, or collaboration with others, see the Advanced patch workflow. + +git add .
git commit -m "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
git apply -v [patchname.patch]
git fetch origin
git rebase origin/@branch
git format-patch origin/@branch --stdout > [description]-[issue-number]-[comment-number].patch
rm [patchname.patch]
git checkout [filename]
git reset --hard
You will be prompted to enter your Drupal.org password after the last step (and any time you make requests from Drupal.org) if you have not uploaded an SSH key or if your SSH key fails. See Authenticate with Git on Drupal.org for details.
mkdir @project_fullname