Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@project.repository.tags returns StringIO object if tags are not cached #156

Open
FlorianPommerening opened this issue Mar 23, 2012 · 1 comment

Comments

@FlorianPommerening
Copy link

>> p = Project.find("myproject")
=> #<Project id: 300, name: "myproject", description: "", homepage: "", is_public: false, parent_id: 285, created_on: "2012-02-27 13:51:22", updated_on: "2012-02-27 13:51:22", identifier: "myproject", status: 1, lft: 493, rgt: 494>
>> r = p.repository
=> #<Repository::Git id: 310, project_id: 300, url: "repositories/myproject.git", login: "", password: "", root_url: "repositories/myproject.git", type: "Repository::Git", path_encoding: nil, log_encoding: nil>
>> t = r.tags
=> #<StringIO:0xb5384d60>
>> t.eof?
=> true
>> t = r.tags
=> ["deletethistag", "deletethistag2"]

The method tags does not return @tags explicitly, but relies on the result of the block to be returned

  scm_cmd(*cmd_args) do |io|
    @tags = io.readlines.sort!.map{|t| t.strip}
  end

Line 97 of git_adapter_patch returns the StringIO objects from scm_cmd which can lead to the StringIO to be returned from the tags method. You could either not return retio from scm_cmd or also patch tags to return @tags after the loop.

@FlorianPommerening
Copy link
Author

Originally reported to Chiliproject (Link to issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant