惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
S
Schneier on Security
Forbes - Security
Forbes - Security
Cisco Talos Blog
Cisco Talos Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
I
InfoQ
量子位
NISL@THU
NISL@THU
C
Cisco Blogs
云风的 BLOG
云风的 BLOG
P
Privacy & Cybersecurity Law Blog
The Register - Security
The Register - Security
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
AWS News Blog
AWS News Blog
T
Troy Hunt's Blog
M
MIT News - Artificial intelligence
B
Blog
T
Tor Project blog
有赞技术团队
有赞技术团队
Hacker News: Ask HN
Hacker News: Ask HN
Y
Y Combinator Blog
L
LangChain Blog
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LINUX DO - 热门话题
Schneier on Security
Schneier on Security
Cloudbric
Cloudbric
H
Hacker News: Front Page
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
V
V2EX
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
O
OpenAI News
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗
宝玉的分享
宝玉的分享
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Scott Helme
Scott Helme
Recorded Future
Recorded Future
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
I
Intezer
美团技术团队

Hacker News: Front Page

SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads GitHub - GainSec/AutoProber: Hardware hacker’s flying probe automation stack for agent-driven target discovery, microscope mapping, safety-monitored CNC motion, probe review, and controlled pin probing. Introducing Claude Opus 4.7 Qwen Studio The Future of Everything is Lies, I Guess: Where Do We Go From Here? GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Virginia Bans Sale of Geolocation Data Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Ancient DNA reveals pervasive directional selection across West Eurasia [pdf] AI cybersecurity is not proof of work Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. A Better Ludum Dare; Or, How to Ruin a Legacy GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Unexpected €54k billing spike in 13 hours: Firebase browser key without API restrictions used for Gemini requests Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent Pakistan hospital at centre of child HIV outbreak caught reusing syringes in BBC film Codex Hacked a Samsung TV Tech Valuations Back to Pre-AI Boom Levels A perfectable programming language — Soter GitHub - halfwhey/claudraband: Claude Code for the Power User Partnership through Play: Investigating How Long-Distance Couples Use Digital Games to Facilitate Intimacy Textbooks and Methods of Note-Taking in Early Modern Europe (2008) Eternity in six hours: Intergalactic spreading of intelligent life (2013) Seven countries now generate 100% of their electricity from renewable energy Tell HN: OpenAI silently removed Study Mode from ChatGPT Pro Max 5x Quota Exhausted in 1.5 Hours Despite Moderate Usage Show HN: Oberon System 3 runs natively on Raspberry Pi 3 (with ready SD card) Tell HN: docker pull fails in spain due to football cloudflare block Bring Back Idiomatic Design No one owes you supply-chain security GitHub - xsawyerx/curl-doom: DOOM, played over cURL Apple update turns Czech mate for locked-out iPhone user The Grand Line Cache TTL silently regressed from 1h to 5m around early March 2026, causing quota and cost inflation Building a Z-Machine in the worst possible language The peril of laziness lost Iran war: We spoke to the man making Lego-style AI videos that experts say are powerful propaganda AI Will Be Met With Violence, and Nothing Good Will Come of It GitHub - duguyue100/midnight-captain: Inspired by Midnight Commander, tailored to my taste. Center for Responsible, Decentralized Intelligence at Berkeley The Local Universe’s Expansion Rate Is Clearer Than Ever, but Still Doesn’t Add Up - A new synthesis of astronomical measurements confirms a persistent mismatch that could point to physics beyond current models The disturbing white paper Red Hat is trying to erase from the internet – OSnews NetBlocks (@netblocks@mastodon.social) The Future of Everything is Lies, I Guess: Annoyances ‘Abhorrent’: the inside story of the Polymarket gamblers betting millions on war Productive procrastination — Max van IJsselmuiden maps, territory and LMs 447 Terabytes per Square Centimetre at Zero Retention Energy: Non-Volatile Memory at the Atomic Scale on Fluorographane Show HN: Pardonned.com – A searchable database of US Pardons 20 Years on AWS and Never Not My Job The Seasons are Wrong The FAA wants gamers to apply for air traffic control jobs Artemis II crew splashes down near San Diego after historic moon mission Why weekends are under threat We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs How a dancer with ALS used brainwaves to perform live On filing the corners off my MacBooks Installing every* Firefox extension OpenClaw’s memory is unreliable, and you don’t know when it will break Steve Blank Nowhere Is Safe Chimpanzees in Uganda locked in vicious 'civil war', say researchers watgo - a WebAssembly Toolkit for Go linux/Documentation/process/coding-assistants.rst at master · torvalds/linux GitHub - callumlocke/json-formatter: Makes JSON easy to read. Founding Product Engineer at Bild AI | Y Combinator A compelling title that is cryptic enough to get you to take action on it GitHub - Keychron/Keychron-Keyboards-Hardware-Design: Industrial design files for Keychron keyboards and mice. 100+ models with CAD assets in STEP, DXF, DWG, and PDF. Source-available, with commercial use allowed for original compatible accessories within the license terms. [ANNOUNCE] WireGuardNT v0.11 and WireGuard for Windows v0.6 Released 1D-Chess Helium Is Hard to Replace Keeping a Postgres queue healthy — PlanetScale Serenity Forge (@serenityforge.com) Our response to the Axios developer tool compromise Do Americans read print books, e-books or audiobooks more? Uncharted island soon to appear on nautical charts The Problem That Built an Industry Fragments: April 2 Python Release Python install manager 26.1 Bitcoin miners are losing $19,000 on every BTC produced as difficulty drops 7.8% God sleeps in the minerals Harness engineering: leveraging Codex in an agent-first world Apple Silicon and Virtual Machines: Beating the 2 VM Limit What have been the greatest intellectual achievements? The APL Programming Language Source Code
How to build a `git diff` driver · Jamie Tanna | Software Engineer
Jamie Tanna · 2026-04-11 · via Hacker News: Front Page

Written by Jamie Tanna
on 
CC-BY-NC-SA-4.0 Apache-2.0
3 mins

Something I've been meaning to write about since November 2024 is how to create an external command for diffing between files with git diff.

I found that while I was implementing renovate-packagedata-diff that there seemed to be a lack of documentation around how to do it, so it would be worthwhile me blogging about it.

(I've since found that there is some documentation in the Git Diffs man page, but it wasn't exactly well discoverable)

It's been at the back of my mind as a TODO for some time, and then I was nudged about it fairly recently by Andrew Nesbitt's good post on Git Diff Drivers, and this week looking at diffing OpenAPI specs with oasdiff.

I thought I'd use this as an opportunity for blogging about how this works, as well as adding a separate for oasdiff as a diff driver.

Note that this is a case where we want to expose more information in our output, and can't rely on the textconv method to convert a (binary) file to a more diff-able textual format.

In a lot of cases, using textconv is likely sufficient!

What arguments do we need to handle?

Although many tools would work out-of-the-box if they expect to be run as tool [before] [after], git diff passes 7 arguments to the external tool it's calling.

Although surprising, this does provide some richer data that is useful to have.

To give a more "worked example", let's look at what this looks like for updating an existing file, or adding/deleting a file:

# newlines added for readability purpose only

# when an existing file is updated
renovate-packagedata-diff
  renovate/github-co-cddo-api-catalogue.json             # 1: filename in the repo
  /tmp/git-blob-shryRa/github-co-cddo-api-catalogue.json # 2: "before"
  f0a1311ae439fff36f994a3be5d5a7eb7d7a34dc               # 3: SHA-1 hash of the "before" file
  100644                                                 # 4: octal mode of the "before" file
  /tmp/git-blob-y2mrZp/github-co-cddo-api-catalogue.json # 5: "after"
  e39975894a72f706e6a59bccf31120ffaa219ff3               # 6: SHA-1 hash of the "after" file
  100644                                                 # 7: octal mode of the "after" file

# when a net-new file is created
renovate-packagedata-diff
  renovate/github-co-cddo-api-catalogue.json             # 1: filename in the repo
  /dev/null                                              # 2: "before"
  .                                                      # 3: SHA-1 hash of the "before" file
  .                                                      # 4: octal mode of the "before" file
  /tmp/git-blob-iAbnMD/github-co-cddo-api-catalogue.json # 5: "after"
  5c55e5b99b21db68c360419d44dac906c336bec6               # 6: SHA-1 hash of the "after" file
  100644                                                 # 7: octal mode of the "after" file

# when a file is deleted
renovate-packagedata-diff
  renovate/github-co-cddo-api-catalogue.json             # 1: filename in the repo
  /tmp/git-blob-aBldZ4/github-co-cddo-api-catalogue.json # 2: "before"
  6b24e38aa4aac8e00e44ab68e156744138ef6afc               # 3: SHA-1 hash of the "before" file
  100644                                                 # 4: octal mode of the "before" file
  /dev/null                                              # 5: "after"
  .                                                      # 6: SHA-1 hash of the "after" file
  .                                                      # 7: octal mode of the "after" file

Note that /dev/null is used when a file was created/deleted, and that arguments that aren't relevant in these cases are provided as a ..

It can also be useful to see if the environment variable GIT_PAGER_IN_USE is set, if you'd like your command to be able to handle regular arguments and the git diff arguments.

Example with oasdiff

As noted in my separate post about this, with this information it's straightforward to write a lightweight wrapped script around the oasdiff tool for comparing OpenAPI specs.

For instance, the most basic implementation we can add is:

#!/usr/bin/env bash

# Via https://www.jvt.me/posts/2026/04/11/oasdiff-driver/
# A diff driver for `git diff` to provide a human-readable changelog for a given OpenAPI spec

if [[ "$2" == "/dev/null" ]]; then
	echo "$1 was added"
	exit 0
elif [[ "$5" == "/dev/null" ]]; then
	echo "$1 was deleted"
	exit 0
fi

# I prefer to have colour always reported
oasdiff changelog "$2" "$5" --color always

This doesn't handle any changes in permissions - which may be useful to report - and it may be worth using the SHA-1 checksums of the files to cache the resulting diffs.