Skip to content

[libra] Implement .libraignore for libra, automatically ignore files specified #1256

Description

@AidCheng

[具体描述] The .libraignore feature allows the user to specify files or directories that should be ignored by version control operations like libra add, status, diff, or commit. It is modeled after Git’s .gitignore, supporting glob patterns and negation rules.

This feature improves usability by preventing unwanted files (e.g., build artifacts, logs, system files) from cluttering the staging area or being accidentally committed.

[实现方案]

Goal:
Skip tracking files listed in a .libraignore file (similar to .gitignore) during add, status, and other relevant commands.

Basic Behaviour:
• .libraignore contains line-based glob patterns (e.g. *.log, build/, !keep.txt)
• Ignored files are excluded from staging and status output

Implementation Plan:
1. Read .libraignore from repo root (if present)
2. Parse patterns using globset or similar
3. In commands like add, status, etc., check if each file matches an ignore rule before proceeding

Notes:
• Lines starting with # are comments
• Lines starting with ! cancel previous ignore rules
• Patterns should support *, **, / as in .gitignore

Metadata

Metadata

Assignees

Labels

librapre-taskR2CN 实习项目测试任务

Fields

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions