aboutsummaryrefslogtreecommitdiff
path: root/lib/git/git_test.go
AgeCommit message (Collapse)Author
2026-02-09lib/git: skip test LogFollow when repository is shallow clonedShulhan
In CI, the repository is cloned with depth=1, while test for LogFollow compare the last 3 commits. This cause the test on LogFollow fail in CI environment.
2026-02-09lib/git: fix tests due to missing .git directoryShulhan
In lib/git, we have test data "testdata/Equal" and "testdata/IsIgnored" that require the directory named ".git". Somehow those directory is missing from previous commit, which cause the test failed when run in new clone. After we inspect it, git does not allow adding a file under directory named ".git" (to include it inside the commit), so to fix the test we need to create the ".git" directory manually before running the tests.
2026-01-15all: convert license and copyright to use SPDX identifiersShulhan
With help of spdxconv tool [1], we able to bulk update all files license and copyright format to comply with SPDX formats. [1] https://kilabit.info/project/spdxconv/
2026-01-14lib/git: pass "--" when running LogFollow commandShulhan
The "--" prevent ambiguous argument, to separate a path from revision. While at it, add more test case for LogFollow.
2026-01-13lib/git: add method LogFollowShulhan
The LogFollow method return history of single file `path`, following rename. This method accept second paramter "format", default to '%h,%at,%an,%ae,%s' which print short hash, author commit timestamp, author name, author email, and subject; respectively separated by comma.
2026-01-11lib/git: fix ignore pattern with single wildcard '*'Shulhan
Single wildcard should ignore everything inside it.
2026-01-06lib/git: implement Equaler interface on GitShulhan
The Equaler interface provide the method Equal that when implemented can be used to compare two instances of struct.
2026-01-06lib/git: add Git type with method IsIgnoredShulhan
The Git type is for working with single git repository. The [Git.IsIgnored] method is to check if the `path` is ignored by git. This is processed by matching it with all of the pattern in the ".gitignore" file from the path directory and its parent until the root of Git repository.
2024-03-02all: move the repository to "git.sr.ht/~shulhan/pakakeh.go"Shulhan
There are several reasons that why we move from github.com. First, related to the name of package. We accidentally name the package with "share" a common word in English that does not reflect the content of repository. By moving to other repository, we can rename it to better and unique name, in this "pakakeh.go". Pakakeh is Minang word for tools, and ".go" suffix indicate that the repository related to Go programming language. Second, supporting open source. The new repository is hosted under sourcehut.org, the founder is known to support open source, and all their services are licensed under AGPL, unlike GitHub that are closed sources. Third, regarding GitHub CoPilot. The GitHub Terms of Service [1], allow any public content that are hosted there granted them to parse the content. On one side, GitHub helps and flourish the open source, but on another side have an issues regarding scraping the copyleft license [2]. [1]: https://docs.github.com/en/site-policy/github-terms/github-terms-of-service#4-license-grant-to-us [2]: https://githubcopilotinvestigation.com
2023-09-11lib/git: realign struct in TestListTagShulhan
This reduce the struct in test case from 48 to 40 bytes (-8 bytes).
2023-09-09lib/git: replace lib/test/mock with bytes.BufferShulhan
This changes require changing the internal type of _stdout and _stderr from *os.File to io.Reader. The reason of replacing lib/test/mock is to minimize read/write to file, since mock.Stdin/Stderr is a temporary files.
2022-10-05lib/git: fix test with -count=X, where X>1Shulhan
2021-03-14all: refactoring the test.Assert and test.AssertBench signatureShulhan
Previously, the test.Assert and test.AssertBench functions has the boolean parameter to print the stack trace of test in case its not equal. Since this parameter is not mandatory and its usually always set to "true", we remove them from function signature to simplify the call to Assert and AssertBench.
2021-01-06git: fix test due to changes on exit status on git clientShulhan
To prevent the test error when running with different git client, we use the strings.Contains to compare the error instead of using test.Assert directly.
2020-06-06all: use default linter optionsShulhan
2019-11-15lib/git: fix the test using full path URL and repository directoryShulhan
2019-09-27all: remove unnecessary trailing newlineShulhan
2019-06-14all: fix nolint formatShulhan
The valid syntax to suppress linter warnings is "//nolint:<name>" with no space between comment and "nolint" and between ":". Also, we move the placement of nolint directive to the top of statements for multiple nolint in the same scope. While at it, fix and supress some linter warnings.
2019-03-01all: fix warnings from linterShulhan
Most of the warnings caused by update to linter which cause global variables declared with grouping "( ... )" and that has been suppressed, are become false-positive again.
2019-01-29lib/git: fix testdata and test inputShulhan
Somehow, the bare repository in testdata/beku_test is not detected as repository by git version 2.20.1.495.gaa96b0ce6b.
2018-11-30all: minimize and suppress linter warnings for global variablesShulhan
2018-11-29all: fix warning from lintersShulhan
2018-10-31lib/git: add function to fetch and list tagsShulhan
2018-09-14lib/git: fix test with current gitShulhan
Git error with double quote on remote is not released yet. Patch is on submission by yours truly.
2018-09-12lib/git: new package that wrap common git commands and parse git configShulhan
List of current git commands that are wrapped, - Setting HEAD to specific revision: "git checkout <revision>" - Cloning repository: "git clone <remoteURL>" - Fetch all changes from remote: "git fetch --all" - Get tag on revision: "git describe --tags --exact-match <revision>" - Get latest commit: "git rev-parse --short <ref>" - Get latest tag - Get latest version (combination of get latest commit and tag) - Log revisions: "git --no-pager log --oneline"