Skip to content

Commit

Permalink
bitbucket-readable-commit-messages: support commits not on a branch
Browse files Browse the repository at this point in the history
Commits not on a branch have an additional <div> added to them with the
message "This commit is not reachable from any branch or tag in this
repository. It may be from a fork outside of this repository." The extra
<div> breaks the selector which uses nth-child pseudo-class in userstyle
bitbucket-readable-commit-messages.user.css.

I noticed that the <div> with commit message doesn't have a `class`
attribute at all.  Rewrite the selector not to rely on the order of
elements.

Examples for tests:

  - Commit on a branch:
    https://bitbucket.org/andreyrybak/atlassian-tweaks/commits/d1ff7b1d2f4f9d6fed7c706f330eaa11c73d264f

  - Commit not on a branch:
    https://bitbucket.org/andreyrybak/atlassian-tweaks/commits/19ca4f537e454e15f4e3bf1f88ebc43c0e9c559a
  • Loading branch information
rybak committed May 5, 2024
1 parent d1ff7b1 commit 40e4295
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bitbucket-readable-commit-messages.user.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* ==UserStyle==
@name Bitbucket: readable commit messages
@namespace https://github.com/rybak/atlassian-tweaks
@version 4
@version 5
@description Make commit messages on Bitbucket Cloud more readable
@license MIT
@homepageURL https://github.com/rybak/atlassian-tweaks
Expand All @@ -16,7 +16,7 @@
==/UserStyle== */

/*
* Copyright (c) 2023 Andrei Rybak
* Copyright (c) 2023-2024 Andrei Rybak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -43,20 +43,20 @@
*/

/* border around the whole commit message */
.css-1120ym1 > div:nth-child(1) > div:nth-child(3):not([data-qa="commit-list-container"]) {
.css-1120ym1 > div:nth-child(1) > div:not([data-qa="commit-list-container"]):not([class]) {
border: borderWidth solid borderColor;
border-radius: borderRadius;
padding: paddingSize;
}
if monospaceEnable {
/* monospace text */
.css-1120ym1 > div:nth-child(1) > div:nth-child(3):not([data-qa="commit-list-container"]) {
.css-1120ym1 > div:nth-child(1) > div:not([data-qa="commit-list-container"]):not([class]) {
font-family: monospace;
}
}

/* make the subject line of commit message bold */
.css-1120ym1 > div:nth-child(1) > div:nth-child(3):not([data-qa="commit-list-container"]) > p:first-child {
.css-1120ym1 > div:nth-child(1) > div:not([data-qa="commit-list-container"]):not([class]) > p:first-child {
font-weight: bold;
}
}

0 comments on commit 40e4295

Please sign in to comment.