Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Libgit2: a portable linkable library for git
Search
Carlos Martín Nieto
May 22, 2013
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Libgit2: a portable linkable library for git
Carlos Martín Nieto
May 22, 2013
More Decks by Carlos Martín Nieto
See All by Carlos Martín Nieto
libgit2 lighting talk
cmn
0
45
Other Decks in Programming
See All in Programming
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
Next.js: The final boss of Web Performance
guaca
0
260
AmebaブログはKMPから卒業します
kmars0605
0
190
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
150
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
180
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
32k
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
2
720
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
phperだってパンチカードでコーディングしたい
o0h
PRO
0
340
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
490
Featured
See All Featured
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
Typedesign – Prime Four
hannesfritz
42
3.2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
The browser strikes back
jonoalderson
0
1.8k
Designing for Timeless Needs
cassininazir
1
530
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
460
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Transcript
Carlos Martín Nieto <
[email protected]
> May 22 nd, Linux-Tag, Berlin
Hello there • Carlos Martín • Git & libgit2 since
2011 • elego Software Solutions
None
API % ls -l ~/libexec/git-core | wc -l 169
Porcelain
Plumbing
API % git cat-file commit HEAD^{commit} % git show --format=...
libgit.a
libgit.a NOTE: This function isn't used in Git outside graph.c
but it is used by CGit [...] to use HTML for colors.
libgit.a die("foo is barred");
A new hope
Other implementations
Other implementations
A new hope
API
API
A new hope
API git_repository_init(&repo, "projects/foo"); git_repository_open(&repo, "projects/foo.git", 1);
API git_reference_lookup(&ref, repo, "HEAD"); git_reference_lookup_resolved(&ref, repo, "HEAD");
API git_branch_lookup(&ref, repo, "master", GIT_BRANCH_LOCAL); git_branch_lookup(&ref, repo, "origin/master", GIT_BRANCH_REMOTE);
API git_repository_config(&config, repo); git_config_open_level(&cfg, config, GIT_CONFIG_LEVEL_SYSTEM);
API git_repository_config(&config, repo); git_config_open_level(&cfg, config, GIT_CONFIG_LEVEL_SYSTEM); git_config_open_global(&cfg, config);
API git_repository_odb(&odb, repo); git_odb_add_backend(odb, my_fancy_odb, prio);
API git_remote_set_transport(remote, my_cool_transport);
API git_remote_set_callbacks(remote, &callbacks); git_remote_stats(remote);
API git_revparse_single(&obj, repo, "HEAD^2^{tree}"); git_revparse(&spec, repo, "HEAD...HEAD^3");
API git_status_file(&flags, repo, "src/main.c"); git_status_foreach(repo, fun, NULL);
A new hope
Git-based HTTP server repo = Rugged::Repository.new(REPO_PATH) get '*' do |path|
commit = repo.lookup(repo.ref(REF_NAME).target) path.slice!(0) path = 'index.html' if path.empty? entry = commit.tree.path path blob = repo.lookup entry[:oid] content = blob.content halt 404, "404 Not Found" unless content content_type mime_type_for(path) content end
Sightings in the wild
Bindings • Ruby - rugged • Python - pygit2 •
C# - LibGit2Sharp • Objective-C - objective-git • Go - git2go • GLib - libgit2-glib
Future • Merge • Even better API • HFS+ •
Sequencer • Reflog backend
Sources http://en.wikipedia.org/wiki/File:Peter_Behrens_ Porcelain_plate_linear_pattern_1901_BM.jpg http://upload.wikimedia.org/wikipedia/commons/0/ 07/ASU_Turbo-train.jpg
Links • https://libgit2.github.com/ • https://github.com/libgit2/ • https://github.com/libgit2/libgit2sharp/pull/429 • https://github.com/fpco/gitlib/tree/master/gitlib-s3 •
https://github.com/carlosmn/git-httpd