How to repeat:
1) On a D6 site that is already setup with git_deploy, download Webform module (currently 6.11) using Drush:
drush dl webform --package-handler=git_drupalorg
2) visit the modules page, or the update status page. There is no version of Webform module reported.
3) cd sites/all/modules/contrib/webform
4) gitk .
5) Observe the correct version 6.x-3.11

I did some debugging, and
$head_contents = file_get_contents($git_dir . DIRECTORY_SEPARATOR . 'HEAD');
is
c14e45e9b0248de1b95571efcd6fc79a727a9c68

I see two problems:

1) glip reports sha IDs in bin not hex so
if ($githash === $ref) {
should probably be
if ($githash === sha1_hex($ref)) {

2) The above shaID is nowhere to be found in $git_refs. No idea why.

CommentFileSizeAuthor
#3 1181258_git_deploy_no_version.diff1.04 KBdalin

Comments

dalin’s picture

Title: git_deploy does not report a version for some modules checked out with Drush » git_deploy does not report a version for some modules

Further investigation shows that there is _not_ a problem with the way that Drush does checkouts. To show this I did a manual checkout of webform:

~/Sites/dems/trunk/sites/all/modules/contrib dave$ git clone --branch 6.x-3.x http://git.drupal.org/project/webform.git
...
~/Sites/dems/trunk/sites/all/modules/contrib dave$ cd webform
~/Sites/dems/trunk/sites/all/modules/contrib/webform dave$ git status
# On branch 6.x-3.x
nothing to commit (working directory clean)
~/Sites/dems/trunk/sites/all/modules/contrib/webform dave$ git tag -l
...
~/Sites/dems/trunk/sites/all/modules/contrib/webform dave$ git checkout 6.x-3.11
Note: checking out '6.x-3.11'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at c14e45e... Issue #54554: Sanitize file paths and table data.
~/Sites/dems/trunk/sites/all/modules/contrib/webform dave$ git status
# Not currently on any branch.
nothing to commit (working directory clean)
~/Sites/dems/trunk/sites/all/modules/contrib/webform dave$ drush pmi webform
 Project          :  webform                                           
 Type             :  module                                            
 Title            :  Webform                                           
 Description      :  Enables the creation of forms and questionnaires. 
 Version          :                                                    
 Package          :  Webform                                           
 Core             :  6.x                                               
 PHP              :  5.1                                               
 Status           :  enabled                                           
 Path             :  sites/all/modules/contrib/webform                 
 Schema version   :  6327                                              
 Requires         :  none                                              
 Required by      :  none                                              
dalin’s picture

Priority: Normal » Major

I'm still a Git newb, but it appears that there are two sha1 in question. There's the last commit before the tag, and there's the tag.

$ git show c14e45e
commit c14e45e9b0248de1b95571efcd6fc79a727a9c68
Author: Nathan Haug <nate@*********.org>
Date:   Wed May 18 15:07:35 2011 -0600

    Issue #54554: Sanitize file paths and table data.
...
$ git show 4dfa4c26d237c5becd7e9878794182c78ca9edb8
tag 6.x-3.11
Tagger: Nathan Haug <nate@*********.org>
Date:   Wed May 18 15:09:12 2011 -0600

Official Drupal.org release.
commit c14e45e9b0248de1b95571efcd6fc79a727a9c68
Author: Nathan Haug <nate@*********.org>
Date:   Wed May 18 15:07:35 2011 -0600

    Issue #54554: Sanitize file paths and table data.

So that it appears when I do git checkout 6.x-3.11 I actually get the commit right before the tag. Hence the SHA1 doesn't match what glip is reporting for this tag.

dalin’s picture

Status: Active » Needs review
StatusFileSize
new1.04 KB

A bit more work with glip and I managed to pull out the correct SHA1.

fenstrat’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #3 works a treat. It correctly reports version number with git clone or with drush dl.

I've been scratching my head for some time over why git_deploy fails to pick up so many module versions. This appears to fix this.

fenstrat’s picture

This also applies cleanly to 7.x

pfrenssen’s picture

Doesn't this address the same problem as #1007890: Add support for annotated tags?

fenstrat’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Indeed, this is a duplicate of #1007890: Add support for annotated tags

darren oh’s picture

Issue summary: View changes
Related issues: +#1007890: Add support for annotated tags