| Project: | Drush |
| Version: | All-versions-5.x-dev |
| Component: | Make |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
This is a related issue to what a02 describes in http://drupal.org/node/745224 comments 110, 115 are the pertinent details.
Basically when an install profile is tracked in a git repository patching fails on a sub-directory if the '--working-copy' flag is used.
I was able to reproduce this issue manually with just git. From reading the git documentation the GIT_WORK_TREE as defined should resolve the issue however this is not the case for me. I attempted passing the --work-tree=. command as well. On both versions of this command git returns success but fails to apply the patch even though PATCHES.txt is cleanly generated referencing that the patch is applied. The interesting thing for me is that using the '--bare' flag worked perfectly for me.
Below is my shell output from the above discovery. Note that '/srv/www/html/profiles/PROFILE' is a git checkout of an install profile with the name PROFILE used to protect sensitive informaiton.
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ diff -u scribdfield.module.org scribdfield.module
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ cp /home/jeff/scribdfield-undefined-index-warning-1274418-1.patch .
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ GIT_WORK_TREE=. && git apply -p1 ./scribdfield-undefined-index-warning-1274418-1.patch --verbose
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ diff -u scribdfield.module.org scribdfield.module
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ GIT_WORK_TREE=. && git apply -p1 ./scribdfield-undefined-index-warning-1274418-1.patch --verbose
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ echo $?
0
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ diff -u scribdfield.module.org scribdfield.module
jeff@ubuntu:/srv/www/jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ git --work-tree=. apply -p1 ./scribdfield-undefined-index-warning-1274418-1.patch --verbose
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ echo $?
0
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ diff -u scribdfield.module.org scribdfield.module
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ git --bare apply -p1 ~/scribdfield-undefined-index-warning-1274418-1.patch --verbose
Checking patch scribdfield.module...
Applied patch scribdfield.module cleanly.
jeff@ubuntu:/srv/www/html/profiles/PROFILE/modules/scribdfield$ diff -u scribdfield.module.org scribdfield.module
--- scribdfield.module.org 2011-09-12 12:39:24.302284074 -0700
+++ scribdfield.module 2011-09-12 12:41:37.642430471 -0700
@@ -173,7 +173,7 @@
function _scribdfield_node_presave(&$node, $field) {
// Upload each file to Scribd.
foreach ($node->{$field['field_name']} as $field_delta => $field_value) {
- if (($field_value['filepath'])
+ if (!empty($field_value['filepath'])
&& ($field_delta == 'field_scribd')
&& !($field_value['data']['scribd_doc_id']
&& file_exists($node->{$field['field_name']}[$field_delta]['filepath'])) ){From testing this scenario locally I am using the following;
http://ftp.drupal.org/files/projects/scribdfield-6.x-1.1-beta1.tar.gz
with the following patch;
http://drupal.org/files/issues/scribdfield-undefined-index-warning-12744...
git version: 1.7.0.4
drush: 4.5
drush make: 2.3
Also related as I think changing the order could resolve this issue as applying the patches prior to moving to the __build__ dir would prevent any potential nested git directories.
http://drupal.org/node/1212834
Comments
#1
To clarify using '--bare' rather than 'GIT_WORK_TREE=.' resolves the issue for me.
#2
Attached patch resolves the described issue for me.
#3
Subscribing.
#4
Do you have any documentation about what the --bare option does for git apply?
#5
Since kernel.org is still down http://schacon.github.com/git/git.html
There is obviously a difference between setting GIT_DIR to '.' versus using '--bare'. From reading the git documentation I initially thought the behaviour would be the same but in practice it was definitely not.
So '--bare' sets GIT_DIR to '.' and then treats the repository as a "bare repository". In this scenario I think the important detail is that it doesn't traverse up the directory structure looking for a .git dir.
An alternate solution, which I think would be better, is just changing the order when patches are applied covered in #1212834
#6
Subscribing, to see where this end up :)
#7
I have now seen this with one of my repos, but not sure that --bare is the answer here.
#8
I'm seeing this issue with git 1.7.0.4, but not with git 1.7.5.4, odd.
#9
[ Powered by #1115636: Issue Macros and Templates - Drush Make]
Drush make is being merged into drush core (discussed in issue:#1310130: Put drush make in drush core)
This means that the issue queue is also moving. The drush queue has a component 'Make' especially for drush_make.
More information will be posted on the drush_make and drush project pages.
#10
Similar problem for us. Patches do not actually apply, although there are no reported build errors, and PATCHES.txt is still generated. Very very problematic, as the only way to tell if your build is actually complete is to manually check if every single patch has been applied. It also means that unless you are aware of this issue, you can very easily end up with a platform build with missing patches. So, I'm upping this to Major priority.
Here is a revised patch against latest code, based on #2
#11
#12
I ran into the same thing described in #10. Patches were reported to apply successfully but code actually went untouched. Updated to Git 1.7.9.4 and the problem is resolved. Not sure now which version I was running before.
#13
milesw - We were having this issue with very latest code in git, from a clone of the drush repo made just a couple of hours ago. We are using git 1.7.0.4 for the record - latest version available through apt on Ubuntu LTS.
#14
@mrfelton Indeed, that version of git exhibits this bug, sadly.
#15
ok, we'll I suspect this is the version that the majority of people will have, since it's what you get with LTS Ubuntu.
#16
Agreed, the use of
--bareis a bit lame IMHO, but I guess that it will solve the issue. We should document why we are using it though, because it's weird.#17
fyi, I am seeing this bug with git version 1.7.2.5