Skip to content

linguist: Implement wrapper to ignore gitconfig in Rugged

Patrick Steinhardt requested to merge pks-linguist-gitconfig-clean into master

We're using the git-linguist binary to derive programming-language statics for a repository. This binary is using Rugged to read a given commit and analyze all blobs referenced by the root tree so that it can return accumulated lines of counts for every language.

Unfortunately, git-linguist reads in gitconfig files by default with no escape hatch, which sabotages our efforts to get gitconfig-clean in the Gitaly codebase. We are thus forced to implement our own wrapper script around the Linguist Gem that allows us to ignore the gitconfig in Rugged.

Do so and implement a new gitaly-linguist binary that mostly mirrors what git-linguist is doing. This allows us to override the Rugged search path and point it to /dev/null so that it won't read any gitconfig files at all.

Note that we do not use e.g. Gitaly's own gitconfig as computed by the Git command factory. Ultimately, the Linguist Gem does not read any Git configuration that would change its behaviour, so it would be overkill to do so.

Changelog: changed

Part of #4242 (closed)

Merge request reports