Post ATziefQTSQJ2ftHTBQ by simon@fedi.simonwillison.net
(DIR) More posts by simon@fedi.simonwillison.net
(DIR) Post #ATzGBVJjAJZoCyQlaS by simon@fedi.simonwillison.net
2023-03-25T21:50:31Z
0 likes, 0 repeats
Figured out a recipe for getting "git log" output as JSON, by converting null-byte-separated values using "jq" https://til.simonwillison.net/jq/git-log-json
(DIR) Post #ATzH56VcaYEnU3VRBo by mesirii@chaos.social
2023-03-25T22:00:38Z
0 likes, 0 repeats
@simon nice trick also in general for other outputs /cc @markhneedham
(DIR) Post #ATzHMyo1y1Jko0dmiG by sil@mastodon.social
2023-03-25T22:03:54Z
0 likes, 0 repeats
@simon does git log support —porcelain as an option? Might be easier to parse. (I’m on my phone so can’t check easily.)
(DIR) Post #ATzHhIMywILpGzfyU4 by simon@fedi.simonwillison.net
2023-03-25T22:07:45Z
0 likes, 0 repeats
@sil not as far as I can tell
(DIR) Post #ATzIZV6BpQxyOCfWQy by acdha@code4lib.social
2023-03-25T22:17:11Z
0 likes, 0 repeats
@simon can’t you use JC for that? https://github.com/kellyjonbrazil/jc
(DIR) Post #ATzIzKxO9to4Sos784 by aburka@hachyderm.io
2023-03-25T22:19:22Z
0 likes, 0 repeats
@simon Once you've found all the format specifiers to use, it seems simpler to stuff all the formatting into the... format, rather than messing around with NUL splitting?```git log --pretty=format:'{"commit":"%H","author":"%an <%ae>","date":"%ad","message":"%s"}' | jq -s```
(DIR) Post #ATzJwoTo2LUL73OZ2e by simon@fedi.simonwillison.net
2023-03-25T22:32:43Z
0 likes, 0 repeats
@aburka ChatGPT suggested that at first but I didn't like it because of the risk of double quotes in the GitHub values themselves
(DIR) Post #ATzK8Y8MdUtxtMxigy by simon@fedi.simonwillison.net
2023-03-25T22:34:13Z
0 likes, 0 repeats
@acdha I could remember that tool existed but couldn't remember its name to find it!
(DIR) Post #ATzKIhqlMn9ovDZYiu by aburka@hachyderm.io
2023-03-25T22:34:29Z
0 likes, 0 repeats
@simon Good point.
(DIR) Post #ATzKUFeS2AkAwNJpwG by simon@fedi.simonwillison.net
2023-03-25T22:35:17Z
0 likes, 0 repeats
@acdha I also decided I wanted something without any extra dependencies if possible (I want to use it in GitHub Actions without setting up pip caching)
(DIR) Post #ATzKfjhwcqb1LOQgEa by SamJSharpe@mastodon.social
2023-03-25T22:35:57Z
0 likes, 0 repeats
@simon I see someone else has pointed out JC, but I think many of these recipes are based on a fairly well known gist that has been knocking around for a while. https://github.com/context-driven-testing-toolkit/git-log2json
(DIR) Post #ATzKq0Fxx7i5Z5EpYu by acdha@code4lib.social
2023-03-25T22:36:38Z
0 likes, 0 repeats
@simon yeah, it’s not exactly an unused acronym
(DIR) Post #ATzL3tVJr2aAg22kWu by acdha@code4lib.social
2023-03-25T22:41:38Z
0 likes, 0 repeats
@simon yeah, never bad to do that - just wanted to mention an option I you weren’t looking for a new project to maintain 😁
(DIR) Post #ATzW8Ys165rzcr5W1Q by simon@fedi.simonwillison.net
2023-03-26T00:49:24Z
0 likes, 0 repeats
In case anyone's interested, here's the full transcript of my ChatGPT session that helped me figure this out - it's longer than I thought it would be!(I share ChatGPT transcripts in private GitHub gists to avoid them being indexed by search engines)https://gist.github.com/simonw/c3b486fa90d7c32a0e8dfb47e151090a
(DIR) Post #ATziIo02tr34tXUjMu by smy20011@m.cmx.im
2023-03-26T03:05:42Z
0 likes, 0 repeats
@simon But gist is public indexable. Did I miss something?
(DIR) Post #ATziefQTSQJ2ftHTBQ by simon@fedi.simonwillison.net
2023-03-26T03:09:46Z
0 likes, 0 repeats
@smy20011 not if you create it as a secret gist - it's available to people who know the URL but it's served with a meta robots tag that blocks it from being indexed
(DIR) Post #ATzpHBLBqZDENyYdZQ by wwarner@fosstodon.org
2023-03-26T04:23:36Z
0 likes, 0 repeats
@simon all the quoting issues cracked me up. thank you for posting it, i’ve yet to take the plunge
(DIR) Post #ATzpS6DTEwIbg59X1s by smy20011@m.cmx.im
2023-03-26T04:25:36Z
0 likes, 0 repeats
@simon til!
(DIR) Post #AU0pQvZ1YPUXVadSD2 by wiverson@mas.to
2023-03-26T16:00:06Z
0 likes, 0 repeats
@simon reading this I feel like I now know what the rank and file staff on the Enterprise 1701-D do all day 🤔😅
(DIR) Post #AU1Z5rDp68FzqubsAa by tacertain@infosec.exchange
2023-03-27T00:31:57Z
0 likes, 0 repeats
@simon I'm surprised that the map doesn't surround the array manipulation. I would have interpreted what you have as producing just a single item. Clearly need to brush up on my jq!
(DIR) Post #AU7GUwlisbZo79TYmG by zellyn@hachyderm.io
2023-03-29T18:29:31Z
0 likes, 0 repeats
@simon Sometimes I like using the ASCII "record separator" (`"\x1e"`) for things like that, just because it's fun that it exists. It wouldn't show up visibly either, though…
(DIR) Post #AULGzKytAq6CuruHg0 by Kestenb@infosec.exchange
2023-04-05T12:43:12Z
0 likes, 0 repeats
@simon continuing the conversation started on the bird site here. I pulled your sfpublicworks-tree-removal-notifications repo and ran the first user input from the jq transcript and it still worked just fine. I wonder if it's an OS or shell difference?
(DIR) Post #AULMXalPV5Y5TvktxQ by simon@fedi.simonwillison.net
2023-04-05T13:39:52Z
0 likes, 0 repeats
@Kestenb have to admit I've lost track of this conversation now - what's the issue we were figuring out here?
(DIR) Post #AULbWD4Zb0LB1pWA6K by Kestenb@infosec.exchange
2023-04-05T16:31:45Z
0 likes, 0 repeats
@simon No problem. I was asking questions about https://til.simonwillison.net/jq/git-log-json on the bird site. I'm trying to reproduce your 10-page-ish convo with ChatGPT (or was it Playground?). My goal is to re-run some of these chat-whisperings to see how long it takes the model to ingest this new learning and telescope it down from 10 pages to just prompt -> final output.But i'm stuck because everything just works right from the first suggestion from the transcript. I'm not seeing the problematic git log messages that caused the long whisper session