Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion codespeed/commits/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ def getlogs(endrev, startrev):
except Exception:
logger.debug('Failed to get tag', exc_info=True)

tag = stdout.strip() if p.returncode == 0 else ""
# --points-at lists every tag on the commit, one per line
tags = stdout.splitlines() if p.returncode == 0 else []
tag = tags[0].strip() if tags else ""
date = datetime.datetime.utcfromtimestamp(
int(date_t)).strftime("%Y-%m-%d %H:%M:%S")

Expand Down
18 changes: 18 additions & 0 deletions codespeed/migrations/0008_alter_revision_tag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.13 on 2026-11-19 07:20

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('codespeed', '0007_environment_active'),
]

operations = [
migrations.AlterField(
model_name='revision',
name='tag',
field=models.CharField(blank=True, max_length=64),
),
]
2 changes: 1 addition & 1 deletion codespeed/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Meta:
class Revision(models.Model):
# git and mercurial's SHA-1 length is 40
commitid = models.CharField(max_length=42)
tag = models.CharField(max_length=20, blank=True)
tag = models.CharField(max_length=64, blank=True)
date = models.DateTimeField(null=True)
message = models.TextField(blank=True)
project = models.ForeignKey(
Expand Down
6 changes: 6 additions & 0 deletions codespeed/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ def save_result(data, update_repo=True):
rev.message = log['message']
rev.tag = log['tag']

# again, now that the commit log has filled in tag/author/message
try:
rev.full_clean()
except ValidationError as e:
return str(e), True
Comment on lines +130 to +133

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An over-long author name or tag comes from the repo, so the submitter cannot fix it, and every result for that commit is refused. I suggest truncating author/tag to the field length to keep the data.

This can be left to a follow-up, if you prefer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let’s leave as a follow up


rev.save()

exe, created = Executable.objects.get_or_create(
Expand Down
2 changes: 1 addition & 1 deletion codespeed/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ def changes(request):
).order_by('-date')[:revlimit])
# Get lastest revisions for this project and it's "default" branch
lastrevisions = revisionlists.get(defaultexecutable.project.name)
if not len(lastrevisions):
if not lastrevisions:
return no_data_found(request)
selectedrevision = lastrevisions[0]

Expand Down