Grit を使用して Git リポジトリに書き込もうとしています。簡単にレポを作成してコミットできます。
repo = Repo.init_bare("grit.git")
index = Index.new(repo)
index.add('myfile.txt', 'This is the content')
index.commit('first commit')
最初のコミットを親として使用して、2 番目のコミットを簡単に作成することもできます。
index.add('myotherfile.txt', 'This is some other content')
index.commit("second commit", [repo.commits.first])
しかし、コミット履歴全体をトラバースせずに、これら 2 つのファイルのコンテンツを取得するにはどうすればよいでしょうか? リポジトリ内のファイルの現在の状態を取得するためのよりスマートな方法はありませんか?