Greasy Fork is available in English.

Gitlab raw commit adder

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).

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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.2
// @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
/*
 * CHANGELOG
 * 1.0: initial release
 * 1.2: shorten to message by default, allow display of full commit on clicking
 */
var url = document.documentURI + '.patch';

fetch(url)
  .then(function(response) {
      response.text().then(function(text) {
      done(text);
    });
  });

function done(text) {
    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 position = text.indexOf("\n---\n");
    var shorttext = text;
    var fulltext = text;
    if(position !== -1) {
        shorttext = text.substring(0, position);
    }
    elem.textContent = shorttext;
    elem.onclick = function(event) {
        elem.textContent = fulltext;
    }
}