git-porcelain-parsing

Parse git status --porcelain output into structured file paths and status tokens.

1|Updated Sep 20, 2025
One-click install
npx skills add https://github.com/Alex1980Alex/1C-Enterprise_Framework --skill git-porcelain-parsing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-porcelain-parsing
Source: https://github.com/Alex1980Alex/1C-Enterprise_Framework/tree/main/.claude/skills/git-porcelain-parsing
Command: npx skills add https://github.com/Alex1980Alex/1C-Enterprise_Framework --skill git-porcelain-parsing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Parsing git status --porcelain output to reliably extract file paths and their index/work tree statuses, including tricky edge cases such as leading dots, spaces, quoted paths, and non-ASCII characters. It documents how to avoid common pitfalls (e.g., the line[2:] vs line[3:] issue) and ensures compatibility across platforms by using per-command core.quotepath=false to preserve Cyrillic paths.

Core Features & Use Cases

  • Accurate extraction of file paths from porcelain lines for both staged and unstaged changes, including renamed paths (e.g., R old -> new) and untracked files.
  • Robust handling of quotes and unicode in paths, with Windows path normalization (backslashes to slashes).
  • Guidance for integrating the parser into audits, CI checks, pre-commit hooks, and automation pipelines that rely on precise change data.

Quick Start

Run the parser against a repository root to obtain a structured representation of changed files.

Frequently Asked Questions about git-porcelain-parsing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse git status porcelain output to extract file paths?

To parse git status porcelain output reliably, you extract status tokens and file paths while handling edge cases like leading spaces, dots, and renamed paths. This Skill processes the raw format into a consistent, machine-parseable structure.

Why does parsing git porcelain output fail with non-ASCII file names?

Parsing git porcelain output fails with non-ASCII names because git defaults to quoting unicode paths. This Skill prevents the issue by applying per-command core.quotepath=false to preserve Cyrillic and other unicode characters.

What is the correct way to parse renamed files in git status porcelain?

The correct way to parse renamed files in git status porcelain is to detect the 'R' status token and split the path string to separate old and new file names. This Skill handles the extraction of renamed paths automatically.

Can I use git porcelain parsing for pre-commit hooks and CI workflows?

Yes, you can use git porcelain parsing for pre-commit hooks and CI workflows. This Skill provides precise change data for staged, unstaged, and untracked files, making it suitable for repository auditing and automation tasks.

Does git porcelain parsing handle Windows path normalization?

Yes, git porcelain parsing handles Windows path normalization by converting backslashes to forward slashes. This ensures the extracted file paths remain consistent and compatible across different operating systems.

What are common pitfalls when parsing git status --porcelain output in Python?

Common pitfalls when parsing git status --porcelain output in Python include using incorrect string slicing like line[2:] instead of line[3:], which breaks on paths with leading spaces. This Skill documents these issues and provides reliable extraction logic.