[bug] .gitattributes linguist-language overrides are ignored for files in subdirectories
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 48/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- tooling
Piste de recherche
Start in packages/web/src/lib/gitattributes.ts at resolveLanguageFromGitAttributes and review the existing unit test mentioned in the report. Run the test, then verify that filename-only patterns match files in subdirectories and slash-containing patterns are matched from the repository root, including leading-slash anchors.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the bug
linguist-language overrides in .gitattributes only apply to files at the repository root. resolveLanguageFromGitAttributes in packages/web/src/lib/gitattributes.ts passes the full repo-relative path to micromatch.isMatch(path, pattern). So *.h linguist-language=C does not match src/foo.h, and an anchored pattern like /config.in never matches at all.
Git's rule: a pattern without a slash matches the file name in any directory; a pattern with a slash is matched from the repo root (a leading / just anchors it).
To reproduce
- In an indexed repo, add
*.h linguist-language=Cto.gitattributesand have a header in a subdirectory, e.g.src/foo.h. - Open
src/foo.hin the file viewer. The override is ignored and the default language is used.
Or in code: resolveLanguageFromGitAttributes('src/foo.h', parseGitAttributes('*.h linguist-language=C')) returns undefined.
Sourcebot deployment information
Sourcebot version (e.g. v3.0.1): main @ b4931510 (found reading the source and confirmed with a unit test, not on a deployment)
Additional information
I have a small fix with tests ready and will open a PR that links this issue. (Found by an AI coding agent working for the breken-ai account.)
- Langage dominant
- TypeScript
- Étoiles
- 3.9k
- Forks
- 374
- Merge moyen
- 20 h 5 min
- PR mergées (30 j)
- 38
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de sourcebot-dev/sourcebot
-
bug triage needed
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
sourcebot-dev/sourcebot#1681 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
sourcebot-dev/sourcebot#1633 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
sourcebot-dev/sourcebot#1384 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
ask_sb bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
sourcebot-dev/sourcebot#1137 · 4 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
sourcebot-dev/sourcebot#1689 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de sourcebot-dev/sourcebot
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
openedx/frontend-app-authoring#3274 ·
Les mainteneurs répondent en général sous 1 jour
-
🎙️ task - fix(deployer): deploy --env prep runs deploy:dev where the repo declares deploy:prepOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
area/documentation status/need-triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
google-gemini/gemini-cli#29548 ·
Les mainteneurs répondent en général sous 1 jour
-
sdk-typescript vector-store
Difficulté 2/5 Une demi-journée Accessibilité débutants 82/100
mem0ai/mem0#7495 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Les mainteneurs répondent en général sous 1 jour