Lazarus Lazaridis
Lazarus Lazaridis

Reputation: 6029

ruby - git search by commit message

I am developing an application for issue tracking in which I want to provide the ability to view revision information related to an issue. So, I need to search the git repository for commit with messages containing the issue key.

Currently, the only gem I found that could help me is rugged but it doesn't provide this functionality. You can search only by the sha1.

Any ideas?

Upvotes: 0

Views: 358

Answers (1)

phoet
phoet

Reputation: 18845

my idea would be to just embrace the powers of your command line.

it's super easy to do this in ruby and the git executable plays nice with calling into it:

`git log --oneline --grep=fail`.split("\n")
=> ["a9c6cf1 allow dashes in github names and show errors on failed validations, closes #54", "e140ed6 update friendly_id and fix failing spec", "871b06a remove failing test", "eff0c4b simplify failing test", "f72889f add production env, otherwise asset task will fail, wtf...", "daee196 first step of migrating to rails 3.1"]

this example searches for fail in the commit messages

Upvotes: 1

Related Questions