Skip to content

Commit e5554ea

Browse files
committed
Use the current branch instead of always using master
1 parent a899f0a commit e5554ea

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

git-wiki.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ def self.find_all
2828

2929
def self.find_or_create(name, rev=nil)
3030
path = name + GitWiki.extension
31-
tree = rev ? GitWiki.repository.commit(rev).tree : GitWiki.repository.tree
32-
blob = tree/path || Grit::Blob.create(GitWiki.repository, :name => path)
33-
new(blob)
31+
commit = GitWiki.repository.commit(rev || GitWiki.repository.head.commit)
32+
blob = commit.tree/path
33+
new(blob || Grit::Blob.create(GitWiki.repository, :name => path))
3434
end
3535

3636
def self.wikify(content)
@@ -75,7 +75,8 @@ def to_html
7575
end
7676

7777
def log
78-
GitWiki.repository.log('master', @blob.name).map {|commit| commit.to_hash }
78+
head = GitWiki.repository.head.name
79+
GitWiki.repository.log(head, @blob.name).map {|commit| commit.to_hash }
7980
end
8081

8182
def save!(data, msg)

0 commit comments

Comments
 (0)