Git Log in HTML, Part Two


The last post explained a technique to [quickly and correctly generate a git log in HTML][].

Things I want to do here:

Recap of the Argument

It generated a lot of discussion, some of which I think missed the point.

Part of it was my fault, because I simplified the problem for exposition, but it ended up being too simple. I didn't clearly state what properties I wanted in the solution. In particular, I don't want to come up with a different technique each time the input data or output format changes. I elaborate on this below.

oversimplification of the problem. I got at least 10 solutions -- why were they bad?

The other problem was that people seemed to argue unreflectively for one extreme or the other.

The argument had this structure, but I may not have emphasized it enough:

(1) There is a naive way to solve this problem.

aka. the quick-but-unsafe way. Someone argued for ignoring escaping, so this is not a strawman.

(2) There is a pedantic way, a.k.a. the correct-but-clunky way.

This isn't a strawman either. Someone said they implemented in Haskell using libgit bindings, and then later switched to shell because of dependency problems. The main problem that I pointed out was dependencies.

(3) NEITHER OF THEM is good.

(4) Here is a middle ground. It is quick and (mostly) correct. I analyzed where it could be incorrect.

(5) How can we do better in the Oil shell? This is still an open question.

So the point is to develop a better shell. To look to how we could do things with new tools, not how we should do things with existing tools.

The Full Problem, or Why The Alternatives Are Bad

These solutions are the worst part of shell! Think of it from the side of the pedantic owners.

Roadmap for This Post

That said, in this post I'm going to focus on the simplest way to do something both quick and correct with existing tools.

One philosophy of Oil is not to reinvent the wheel unnecessarily. See my comment about "Make" -- I'm not just trying to address one pet peeve about shell. I'm trying to replace the entire thing, and that means thoroughly understanding how shell interacts sits in its ecosystem.

This post is a bunch of odds and ends.

My solution doesn't assume any of these things. Moreoever, it checks its assumption.

Grep -- $'\x00' does NOT NOT NOT WORK This is something I Need to fix with the shell. That is a horrible design choice! But it's also a problem with grep.

This was my fault. I oversimplified the problem in the name of having short code snippets.

The real problem was more complicated than people thought. I am not interseted in solutions that assume the format of the git hash, that assume that only one spaces have comma

This is the worst part of shell. It is annoying and error-prone to think about such things.

I don't want to change the format.

Limitation sof the solution: Only one kind of escaping.

Pedantic Solution

This commenter experienced exactly what I thought.

Here's an interesting result: I got at least 10 shell one-liners in response. If you think that the pedantic solution is right, please post it in a comment or Github gist.

The second task for you: Make sure that your friend can clone the gist and run it. The first thing he or she might say is: "oops this version is wrong".