apache / apache/buildstream-plugins

git source: bst show --format %{source-info} crashes with BUG 'NoneType' object has no attribute 'rsplit' on untracked source

Offen Anfängerfreundlich
#110 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
8
Forks
16
Ø Merge
36 Min.
Gemergte PRs (30 T.)
2

Beschreibung

**Environment**
- BuildStream 2.7.0
- buildstream-plugins 2.5.0 (git source)
- Python 3.11

**Steps to reproduce**
Create a project with an element having a git source WITHOUT a ref(never tracked):
``` project.con
name: project
min-version: 2.6
element-path: elements
ref-storage: project.refs
aliases:
my:
plugins:
- origin: pip
package-name: buildstream-plugins
sources:
- git
```

```elements/target.bst
kind: import
sources:
- kind: git
url: my:one/.git
track: master
```
**Run:**
`bst show target.bst --format '%{source-info}'`

**Actual result**

```
BUG 'NoneType' object has no attribute 'rsplit'
buildstream_plugins/sources/git.py, line 1084, in _guess_version
main_split = string.rsplit("-g", 1)
```

**Expected result**
source-info should render (version=None or omit) without crashing —
bst show must not fail because one source is not yet tracked.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start in buildstream_plugins/sources/git.py at _guess_version around line 1084, then reproduce the issue with the provided untracked git source and bst show target.bst --format '%{source-info}'. Ensure source-info renders when the source has no ref, with version=None or omitted, and that bst show no longer crashes.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
git, python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
88/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.