Skip to content

Instantly share code, notes, and snippets.

@weliveindetail
Created July 2, 2023 12:27
Show Gist options
  • Save weliveindetail/ed984e0a5ae4b357418dd6045e0e2575 to your computer and use it in GitHub Desktop.
Save weliveindetail/ed984e0a5ae4b357418dd6045e0e2575 to your computer and use it in GitHub Desktop.
git-baobab-me-test

Checkout repo with git-baobab-me script:

➜ cd /path/to/test-dir
➜ git clone https://github.com/weliveindetail/git-baobab.git git-baobab
Cloning into 'git-baobab'...
remote: Enumerating objects: 223, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 223 (delta 19), reused 26 (delta 12), pack-reused 187
Receiving objects: 100% (223/223), 7.04 MiB | 5.98 MiB/s, done.
Resolving deltas: 100% (123/123), done.
➜ git -C git-baobab log --oneline -3
d2453c4 (HEAD -> main, origin/main, origin/HEAD) Initial git baobab-me script
48b6592 (tag: v0.4) Update artifact versions for v0.4
b93e589 Highlight arcs on hover

Run the script with Python 3 on its own repo:

➜ cd /path/to/test-dir/git-baobab
➜ python3 --version
Python 3.11.3
➜ python3 git-baobab-me stefan.graenitz@gmail.com
First commit was on 2019-05-25: 5fef7bffc7534335dc22d57f8d1b86090eb65df6
Analyzing commit range 5fef7bffc753..d2453c4ff4da
Authored 44 commits with a total of 30447 line changes
Export chart to /var/folders/2k/myk8kt8d4f52dzr19331wtxr0000gn/T/tmp1xqa4sic.html
Show in browser? [Y/n] y
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://weliveindetail.github.io/git-baobab/baobab-me-static.v0.5.css">
<title>git baobab-me stefan.graenitz@gmail.com</title>
</head>
<body>
<svg id="baobab"></svg>
<p>git baobab-me stefan.graenitz@gmail.com</p>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script>
const baobab_author = "stefan.graenitz@gmail.com";
const baobab_hash_since = "5fef7bffc7534335dc22d57f8d1b86090eb65df6";
const baobab_hash_head = "d2453c4ff4dabbe9ce276bf0cfbb28bf57dab318";
const baobab_age_min = 0;
const baobab_age_max = 1;
const baobab_data = {n: "git-baobab", t: 2532, m: 30447, c: 44, w: 0.0, a: 0, children: [
{n: "README.md", t: 203, m: 261, c: 7, w: 4.533333333333334, a: 1},
{n: "baobab-me-static.css", t: 32, m: 32, c: 1, w: 0.3333333333333333, a: 0},
{n: "baobab-me-static.js", t: 476, m: 476, c: 1, w: 0.3333333333333333, a: 0},
{n: "baobab-static.css", t: 32, m: 40, c: 5, w: 1.8333333333333333, a: 3},
{n: "baobab-static.js", t: 416, m: 767, c: 17, w: 11.333333333333336, a: 1},
{n: "git-baobab", t: 770, m: 2772, c: 32, w: 24.03333333333333, a: 1},
{n: "git-baobab-me", t: 603, m: 603, c: 1, w: 0.3333333333333333, a: 0},
{n: "examples", t: 0, m: 25496, c: 2, w: 0.0, a: 3, children: [
{n: "llvm9-cpp-sources.html", t: 0, m: 25496, c: 2, w: 0.5333333333333333, a: 3}
]}
]};
</script>
<script src="https://weliveindetail.github.io/git-baobab/baobab-me-static.v0.5.min.js"></script>
<script>
function showOnGithub(d) {
const url = "https://github.com/weliveindetail/git-baobab/commits/d2453c4ff4dabbe9ce276bf0cfbb28bf57dab318/";
const relPath = concatPath(d).slice(10 + 1); // account for slash
window.open(url + relPath + '?author=stefan.graenitz@gmail.com', '_blank');
}
baobab.arcShapes
.filter(d => !d.children)
.style("cursor", "pointer")
.on("click", d => showOnGithub(d));
</script>
<script>
(function() {
var regex = /[?&]([^=#]+)=([^&#]*)/g,
url = window.location.href,
params = {},
match;
while(match = regex.exec(url)) {
params[match[1]] = match[2];
}
if (params["path"]) {
var path = params["path"].split("/");
var select = baobab.root;
for (var i = 1; i < path.length; i++) {
const child = select.children.find(node => node.data["n"] == path[i]);
if (child && child["children"])
select = child
else
break;
}
selectAsNewRoot(select);
}
})();
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment