aboutsummaryrefslogtreecommitdiff

git-permalink

Git extension to generate web permalinks of files in a repository.

It knows about many of the existing code forges, but allows for URL template overrides to be used on custom domains or deployments via git config.

Usage

# setup example "remembering" repository
$ git clone git://euandreh.xyz/remembering
$ cd remembering/

Now inside the repository folder, running git permalink will try build the web URL of the given file use xdg-open to launch the browser (or whatever is configured):

$ git permalink tests/ranking.sh
Opening https://git.euandreh.xyz/remembering/tree/tests/ranking.sh?id=44533e2df144e7749a382e298aea53ca11a2239e
$ git permalink tests/ranking.sh 23
Opening https://git.euandreh.xyz/remembering/tree/tests/ranking.sh?id=44533e2df144e7749a382e298aea53ca11a2239e#n23

Or if you just want to output the link without invoking xdg-open, you can use the -p flag:

$ git permalink -p tests/ranking.sh 23
https://git.euandreh.xyz/remembering/tree/tests/ranking.sh?id=44533e2df144e7749a382e298aea53ca11a2239e#n23

Installation

Get the latest tarball and install it:

wget https://git.euandreh.xyz/git-permalink/snapshot/git-permalink-main.tar.gz
pax -rzf git-permalink-main.tar.gz # or similarly: tar xf git-permalink-main.tar.gz
cd git-permalink-main/
make
[sudo] make install

There are no dependencies or requirements, only standard tools such as sed, mkdir, etc.

Documentation

The documentation is available via installed manpages or online: [git-permalink.1].

Contributing

Extratools used for development are: - ShellCheck for validating scripts; - pandoc, troff and Perl for generating the documentation HTML and website.

For running the extra development-only checks, run:

$ make dev-check

and for generating the documentation HTML and website, run:

$ make public

Releases

  • version v0.1.0 (sig), released in 2021-06-13

License

The code is licensed under GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later).