Browse Source

filter "truncate-mac-address-to-24-bits": truncate mac addresses without separators

Some integrations (e.g. Home Assistant's AVM FRITZ!Box Tools) use the
bare MAC address as device identifier and unique ID prefix:

  123456789ABC-firmware_update

Truncate standalone groups of exactly 12 hex digits to the OUI:

  123456…-firmware_update

A preceding "-" is excluded so that the last group of unrelated UUIDs
stays intact; AVM UUIDs are still covered by their dedicated rule.
Longer hex strings (e.g. 32-digit IDs) are not matched. Standalone
12-digit decimal numbers would be truncated as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fabian Peter Hammerle 2 weeks ago
parent
commit
8149580dec
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gitconfig

+ 1 - 1
gitconfig

@@ -43,7 +43,7 @@
 	textconv = od -t x1z --
 
 [filter "truncate-mac-address-to-24-bits"]
-	clean = sed -E     -e 's/(^|[^[:xdigit:]:])([[:xdigit:]]{2}(:[[:xdigit:]]{2}){2})(:[[:xdigit:]]{2}){3}([^[:xdigit:]:]|$)/\\1\\2:…\\5/g'     -e 's/(-[[:xdigit:]]{4}-40e7-(8e6c|9f6c)-[[:xdigit:]]{6})[[:xdigit:]]{6}([^[:xdigit:]]|$)/\\1…\\3/gI'     -e 's/(:[[:xdigit:]]{0,4}:[[:xdigit:]]{0,2}ff:fe)[[:xdigit:]]{2}:[[:xdigit:]]{1,4}([^[:xdigit:]:]|$)/\\1…\\2/gI'
+	clean = sed -E     -e 's/(^|[^[:xdigit:]:])([[:xdigit:]]{2}(:[[:xdigit:]]{2}){2})(:[[:xdigit:]]{2}){3}([^[:xdigit:]:]|$)/\\1\\2:…\\5/g'     -e 's/(-[[:xdigit:]]{4}-40e7-(8e6c|9f6c)-[[:xdigit:]]{6})[[:xdigit:]]{6}([^[:xdigit:]]|$)/\\1…\\3/gI'     -e 's/(:[[:xdigit:]]{0,4}:[[:xdigit:]]{0,2}ff:fe)[[:xdigit:]]{2}:[[:xdigit:]]{1,4}([^[:xdigit:]:]|$)/\\1…\\2/gI'     -e 's/(^|[^[:xdigit:]-])([[:xdigit:]]{6})[[:xdigit:]]{6}([^[:xdigit:]]|$)/\\1\\2…\\3/g'
 	smudge = cat
 	required = true