Replace the mangled commit message with the full patch, which is in general more useful to the experienced git user than the web UI, where you have to change views multiple time to see the contents of a commit and it's impossible to get the raw patch (other than appending .patch to the URL).
Versione datata
// ==UserScript==
// @name Gitlab raw commit adder
// @description Replace the mangled commit message with the full patch, which is in general more useful to the experienced git user than the web UI, where you have to change views multiple time to see the contents of a commit and it's impossible to get the raw patch (other than appending .patch to the URL).
// @version 1.0
// @include /^https://gitlab.com/.*/commit/[0-9A-Fa-f]{6}[0-9A-Fa-f]*$/
// @icon https://git-scm.com/favicon.ico
// @grant none
// @namespace de.hostalia.user-scripts
// @license GPL-2.0
// ==/UserScript==
// Copyright 2022 Marcus Müller <[email protected]>
// SPDX-License-Identifier: GPL-2.0
var url = document.documentURI + '.patch';
var storedText;
fetch(url)
.then(function(response) {
response.text().then(function(text) {
storedText = text;
done();
});
});
function done() {
var elem = document.querySelector(".commit-description");
if(elem !== undefined) {
elem = document.createElement("pre");
elem.classList.add("commit-description");
document.querySelector(".commit-box").appendChild(elem);
var elem = document.querySelector(".commit-description");
}
var commitdesc = elem.textContent =
storedText;
}