Currently git_deploy works well with lightweight tags but doesn't do anything with signed or unsigned tags. Support should be added.

Comments

halstead’s picture

Title: Make git_deploy resolve signed and unsigned tags » Make git_deploy resolve annotated (signed and unsigned) tags

I explored a .git directory and didn't find an easy way to get the commit hash referenced by a tag object. The glip library if seen used elsewhere doesn't seem to have any support for tag objects either. The version of glip at https://github.com/Upliner/glip does have a GitTag class but I haven't tested it.

chris.stone’s picture

I've been working with the glip lib to see if we can find a way to have git_deploy pull the correct time for commits. Perhaps to solve both issues and possibly any more that may appear the module should be re-coded using glip to access the repo information?

sdboyer’s picture

Priority: Normal » Critical
Issue tags: +git sprint 10

This does seem pretty important as I do expect we'll start to see a lot of annotated tags.

eliza411’s picture

Assigned: Unassigned » halstead

Assigning this for Sprint 10. If you won't be doing it, please look for someone who will and unassign yourself.

halstead’s picture

Posted in wrong issue. --
I'll start looking at this now.

halstead’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new2.93 KB

I've tested this and it works. Not my most elegant patch but it works. I'd love a review.

halstead’s picture

Here is how I'm testing this:

You will need to tag a release with an annotated tag. So "git checkout 6.x-1.x" then "git tag -a 6.x-1.2". The available updates page before the patch will still show 6.x-1.x even after tagging the release. After the patch you will see 6.x-1.2 on the available updates page.

Tags are supposed to take priority over branches so if a branch tip and a tag both point to the same commit we should use the tag. With the patch this is the behavior I see.

Additional test ideas are welcome.

halstead’s picture

StatusFileSize
new2.8 KB

Here is some minor clean up based on feedback from Freso in IRC.

pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

This works perfect. Reviewed and tested with a real case: the ImageField project which is using annotated tags.

For completeness the _git_deploy_find_tag_for_commit() function could use a description.

dww’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new504 bytes

Works fine in my testing, although it revealed a bug in glip when it's trying to parse repos that have jacobsingh <> ... -- there's an assertion failure since the preg_match() assumes a non-empty email address. I fixed it by adding a single ? to the regexp to handle the case where the email is empty. See attached patch (seems like overkill to handle this 1 byte fix via a github fork). ;)

Anyway, I'm setting this to "needs work" for a few reasons:

A) It's not obvious to me why _git_deploy_find_tag_for_commit() is a separate function. It's only called once. Furthermore, it duplicates all the work of instantiating a Git object, calling revParse(), etc. That seems like a big inefficiency to me for no clear gain.

B) If it's going to remain a separate function, ideally it should be documented. And if it's a separate function since someone else might want to use it some day, it shouldn't use the _ namespace -- it should just be a public function.

pfrenssen’s picture

StatusFileSize
new2.69 KB

I updated the patch from #8 with the suggestions from #10. I chose to remove the code from the private function to avoid making a new instance of the Git object.

pfrenssen’s picture

Status: Needs work » Needs review

status

pfrenssen’s picture

StatusFileSize
new2.66 KB

The patch in #11 is against the master D7 branch, here is the same patch for the D6 version.

pfrenssen’s picture

Category: task » bug

This is a bug, not a task.

fenstrat’s picture

Status: Needs review » Reviewed & tested by the community

#11 works well. Haven't tested the D6 version in #13.

dww's glip regex patch in #10 still needs looking into.

Marked #1181258: git_deploy does not report a version for some modules as a duplicate of this.

pfrenssen’s picture

It seems like some more work needs to be done. I was about to update a website and got different results with the patch in this issue, and the one in #1181258: git_deploy does not report a version for some modules

Drush up without git_deploy:

 Entity API          7.x-1.0-beta8   7.x-1.0-beta10  Nieuwe versie beschikbaar                
 EVA: Entity Views   7.x-1.x-dev     7.x-1.x-dev     Nieuwe versie beschikbaar                
 Attachment                                                                                   
 Feeds               7.x-2.0-alpha3  7.x-2.0-alpha4  Nieuwe versie beschikbaar                
 Feeds XPath Parser  7.x-1.0-beta2   7.x-1.0-beta2   Actueel                                  
 Global Redirect     7.x-1.3         7.x-1.3         Actueel                                  
 Google Analytics    7.x-1.2         7.x-1.2         Actueel                                  
 Features            Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module                 
 Feeds Multinode     Unknown         Unknown         Project was not packaged by drupal.org   
 Processor                                           but obtained from git. You need to       
                                                     enable git_deploy module                 
 Pathauto            Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module                 
 Search API          Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module                 
 Solr search         Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module                 
 Transliteration     Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module                 
 XML sitemap         Unknown         Unknown         Project was not packaged by drupal.org   
                                                     but obtained from git. You need to       
                                                     enable git_deploy module

With unpatched git_deploy 7.x-1.x:

 IMCE             7.x-1.3         7.x-1.4           Nieuwe versie beschikbaar                
 IMCE Wysiwyg     7.x-1.x-dev     7.x-1.x-dev       Actueel                                  
 bridge                                                                                      
 Job Scheduler    7.x-2.0-alpha2  7.x-2.0-alpha2    Actueel
 Link             7.x-1.x-dev     7.x-1.x-dev       Nieuwe versie beschikbaar
 Meta tags quick  7.x-1.8         7.x-1.9           Nieuwe versie beschikbaar

With the patch in this issue:

 Module Filter  7.x-1.4         7.x-1.4           Actueel                                  
 MultiBlock     7.x-1.0         7.x-1.0           Actueel                                  
 References     7.x-2.x-dev     7.x-2.x-dev       Nieuwe versie beschikbaar                
 Token          7.x-1.0-beta1   7.x-1.0-beta2     Nieuwe versie beschikbaar                
 Views          7.x-3.0-beta3   7.x-3.0-rc1       Nieuwe versie beschikbaar                
 Webform        7.x-3.11        7.x-3.11          Actueel

With the patch in #1181258: git_deploy does not report a version for some modules:

 AddThis           7.x-2.1-beta1   7.x-2.1-beta1     Actueel                                  
 Drupal core       7.0             7.4               SECURITY UPDATE available                
 Chaos tool suite  7.x-1.0-alpha4  7.x-1.0-beta1     Nieuwe versie beschikbaar                
 Wysiwyg           7.x-2.0         7.x-2.1           Nieuwe versie beschikbaar                
 NineSixty (960    7.x-1.0         7.x-1.0           Actueel                                  
 Grid System)

These results differ greatly. Many modules and Drupal core itself are not recognized depending on which patch is used.

Anonymous’s picture

The d6 patch in #13 works fine for me.

I had a problem with the annotated tag for admin_menu 6.x-1.8, but now all is fine for that module.

Freso’s picture

Re: #17:
The problem with admin_menu lies (or lay, it seems) with admin_menu and not git_deploy: #1251232: Unable to show correct version at admin/reports/updates if managed by Git

darrell_ulm’s picture

Question has the patch in http://drupal.org/node/1007890#comment-4560538 been applied to the D6 dev branch? Some of the patches to get the D6 (or D7) version working seem to apply easily, and it would be awesome to have them in the releases.

Thank you.

chris.stone’s picture

The patch from http://drupal.org/node/1007890#comment-4560538 has not been committed as of yet. Considering that the 2.x branches have removed support for the glip library and gone to using the git binary directly I do not think that it will be committed.

fearlsgroove’s picture

Status: Reviewed & tested by the community » Needs work

So then definitely not RTBC

darren oh’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: halstead » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -git phase 2, -git sprint 10
darren oh’s picture

Issue tags: +Needs reroll

  • Darren Oh committed f7dd85f on 7.x-1.x authored by pfrenssen
    Issue #1007890 by halstead, pfrenssen, dww: Add support for annotated...
darren oh’s picture

Title: Make git_deploy resolve annotated (signed and unsigned) tags » Add support for annotated tags
Status: Needs review » Fixed
Issue tags: -Needs reroll +Needs backport to D6

  • Darren Oh committed 1a3f852 on 6.x-1.x authored by pfrenssen
    Issue #1007890 by halstead, pfrenssen, dww: Add support for annotated...
dww’s picture

Issue tags: -Needs backport to D6

@Darren Oh: Wow, blast from the past! This had completely fallen off my radar. Thanks for fixing it! ;)

#26 looks like you did the backport already, so removing that tag.

Thanks again,
-Derek

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.