Giter Site home page Giter Site logo

purpleclay / gitz Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 3.55 MB

Write fluent interactions to Git. Programmatically crafting git commands becomes a breeze!

Home Page: https://docs.purpleclay.dev/gitz/

License: MIT License

Go 99.60% Nix 0.40% Shell 0.01%
fluent fluent-design git go golang testing

gitz's Introduction

Gitz

Write fluent interactions to Git using the gitz library. Programmatically crafting git commands becomes a breeze! Verify your code using the inbuilt testing framework.

Badges

Build status License MIT Go Report Card Go Version DeepSource

Documentation

Check out the latest documentation

gitz's People

Contributors

dependabot[bot] avatar purpleclay avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

gitz's Issues

[Feature]: add support for listing currently staged files

Describe your feature

Add a new method called Staged() that is capable of retrieving a list of the currently staged files within the repository. These are changes that have not currently been pushed back to the remote.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Add basic support for git tag operations

Describe your feature

The gitz library should offer basic Git Tag functionality. Initially support lightweight tags only.

Your potential solution

Provide a basic set of tag functions that can deliver the following set of functionality:

  • Tag creation
  • Pushing of tags to remote
  • Deletion of tags

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add a custom error message that is returned during a git operation error

Describe your feature

Create a custom error that is returned whenever a git operation fails. This error should provide context about the function in question and the plain error and status code returned by the underlying git client. In future, this error can contain links to documentation for faster resolution for users.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Docs]: update code examples to ensure they are executable if copied and pasted

Describe your edit

Current code examples within the documentation are in a pseudo-format and won't compile, let alone run, if copied and pasted. Ensure these samples are updated so that they are runnable.

It would also be worth extracting these samples into a dedicated examples directory. These should be compiled and run to ensure no failures are reported.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Docs]: write the documentation for release 0.4.0

Describe your edit

Write the documentation for the upcoming 0.4.0 release, and incude:

  • Experimental Git Config Support
  • Support for explicit path resolution within the working tree when retrieving logs
  • User-defined filtering of tags
  • Limiting the number of tags returned

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: support the checkout of a different branch

Describe your feature

This issue covers the expansion of the existing Clone command and the introduction of a new dedicated Checkout command. While cloning a repository, a branch other than the default can be checked out immediately after a clone.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: include GPG support

Describe your feature

Include support for the signing of commits and tags within gitz. This can be enabled through git config and on an ad-hoc basis. Also include support for skipping signing of particular commits and tags.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Docs]: fix styling on notification banner

Describe your edit

Add some custom CSS to the docs to correctly style the notification banner. Base this on the existing styling used by mkdocs

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Docs]: write initial documentation for gitz library

Describe your edit

Use Material for MkDocs to generate some initial documentation for gitz. Include examples of how to use the library for different scenarios

Code of Conduct

  • I agree to follow this project's Code of Conduct

[CI]: improve the sonarcloud workflow to scan on the presence of a new tag

Describe your enhancement

It is recommended to configure a New Code Defintion within SonarCloud. In particular, on the creation of a new version. SonarCloud does not currently run as part of a tagged build within the existing base CI workflow. To support this functionality, the sonar-project.properties file will need to be dynamically patched with the tag reference.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Add basic support for git stage operations

Describe your feature

The gitz library should offer basic Git stage functionality.

Your potential solution

Provide a stage function that can be used to stage a single file within a repository

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: restrict the number of tags that are returned to a maximum count

Describe your feature

Add an additional option for limiting the number of tags that are returned by the Tags method. This is designed to make retrieval more predictable, especially when iterating over the results.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[CI]: use uplift to stamp the version within the sonar-project.properties file

Describe your enhancement

It seems SonarCloud only accepts a version if it exists within the sonar-project.properties during a main branch analysis. Attempting to do this while analysing a tag, just results in a short-term branch being created. Stop tag analysis.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Add basic support for git commit operations

Describe your feature

The gitz library should offer basic Git commit functionality.

Your potential solution

Provide a commit function that supports the bespoke setting of a commit message.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: allow tags to be deleted

Describe your feature

Add a new method called DeleteTags() that allows the deletion of tags from a repository. The default behaviour of this method should be to delete tags locally and from the remote. An option should be provided to prevent the delete from being cascaded to the remote.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add support for inspecting and retrieving details about the current repository

Describe your feature

Add a method to the gitz client that supports inspecting the current repository and collating details about its makeup. These details should include, but not be limited to:

  • Does it have a detached head?
  • Is it a shallow clone?
  • The name of the default branch
  • ...

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: dynamic configuration can be set during command execution

Describe your feature

Dynamic configuration is supported by git through the -c flag. This must be specified before any subcommand. Extend the existing commands to allow config to be set at runtime. This config is not permanent and disappears after command execution, supporting a more dynamic behaviour to command execution.

git -c user.name="batman" -c user.email="[email protected]" commit --allow-empty -m "chore: just checking if dynamic config works"

Any additional information?

None

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: support management of global and system level git config

Describe your feature

Presently gitz supports the management of local git config only. This should be extended to include support for Global and System level config. Additional operations, unset and replace should also be supported.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Docs]: write documentation for upcoming 0.5.0 release

Describe your edit

Write documentation for the upcoming 0.5.0 release of gitz. This should include the following:

  • Support for Global and System git config
  • Initial GPG support
  • Push options
  • Support for empty commits

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: when sorting tags by version ensure semantic versions are correctly sorted

What happened?

Sorting tags that contain semantic versions with prereleases is incorrect. For example, if you have the following set of tags, 0.1.0, 0.2.0-beta.1, 0.2.0-beta.2 and 0.2.0, the current tag order is returned when using the git.VersionDesc sort key:

0.2.0-beta.2
0.2.0-beta.1
0.2.0
0.1.0

Steps to reproduce it

  1. Tag a test repository with the expected set of tags
  2. Run the following code snippet:
package main

import (
	"fmt"
	"log"

	git "github.com/purpleclay/gitz"
)

func main() {
	gc, err := git.NewClient()
	if err != nil {
		log.Fatal(err.Error())
	}

	tags, _ := gc.Tags(git.WithSortBy(git.VersionDesc))
	for _, tag := range tags {
		fmt.Println(tag)
	}
}

Which version?

v0.3.0

Which operating system(s) are you using?

Mac

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: support the use of explicit paths when querying the log of a repository

Describe your feature

When querying the log of a particular directory within the repository, it appears only paths that are relative to the repository root will return results. If an explicit path is provided, no results are returned. By using filepath.Rel the relative path can be resolved against the root of the repository. The root of the repository can be determined using the git command git rev-parse --show-toplevel

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: incorrect truncation of multiline commit messages

What happened?

All commit messages should be returned without modification when retrieving the repository log. Incorrect formatting of the log is truncating multi-line commit messages.

Steps to reproduce it

  1. Create a repository that contains commits with multi-line commit messages
  2. Retrieve the log and print out the raw output

Which version?

v0.3.1

Which operating system(s) are you using?

Mac

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add basic git push support

Describe your feature

Add support for pushing staged changes to the repository remote. Pushing tags will be performed with a separate operation.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add option for staging all outstanding files

Describe your feature

Include a new git stage option that adds all outstanding files ready for a commit. This removes the need to specify each file in turn if many changes have been made.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add support for the retrieval, sorting and filtering of tags

Describe your feature

Introduce a new Tags command to return a raw list of local repository tags. Options should be supported for filtering tags by any custom convention and sorting them by a given order. It might be worthwhile including custom options that impose a predefined type of sort, for example, a semantic versioning sort

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add support for git push options for pushing arbitrary strings to the git server

Describe your feature

Git push options were added to support the arbitrary pushing of strings to the git server. CI providers such as GitLab have leveraged this functionality to support dynamic CI configurations during a push. Add this support to gitz to improve the library's versatility.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[CI]: reinstate support for auto-merging dependabot pull requests

Describe your enhancement

Reinstate support for automatically merging a dependabot pull request that has passed all its status checks. Ensure no other workflow is run by excluding dependabot through if clauses.

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: detect if git is available when creating a new client

Describe your feature

gitz is dependent on the installation of git within the current runtime. Detect if git is installed, capturing the current version. If git cannot be found, throw an error.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add ability to filter the log based on a provided regular expression

Describe your feature

Extend existing git log support to filter commits using regular expression patterns. The git client provides this option through the --grep flag. The --invert-grep flag should also be supported to inverse the filtering.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add basic git pull support

Describe your feature

Add initial support for pulling latest changes from the remote.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: extend git log to return both raw and parsed log output

Describe your feature

Currently, the Log() function will return the log as a raw string that requires further processing by the caller. To improve the developer experience, the log should be accompanied by a slice of parsed log entries. If callers want just the raw output, they should supply the WithRawOnly() option, reducing the processing required.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: filtering out paths at the relative root of a repository prevents querying the log within a sub-directory

What happened?

Removing the path . prevents logs from being retrieved when calling git.Log from within a sub-directory.

Steps to reproduce it

The following test case would fail, as it will currently return all commits:

func TestLogRetrievedForWithinSubDirectory(t *testing.T) {
  gittest.InitRepository(t, gittest.WithFiles("search/main.go"))
  gittest.StageFile(t, "search/main.go")
  gittest.Commit(t, "feat(search): awesome search functionality")
  
  os.Chdir("search")
  gitc, _ := git.NewClient()
  log, _ := gitc.Log(git.WithPaths("."))
  assert.Len(t, log.Commits, 1)
  assert.Equal(t, "feat(search): awesome search functionality", log.Commits[0].Message)
}

Which version?

v0.4.0

Which operating system(s) are you using?

Mac

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: include option for generating an annotated tag

Describe your feature

Extend the existing tag functionality of gitz to support an option for generating an annotated tag. The git documentation states that an annotated tag must be created with a commit message. Provide an option to the Push() method for an optional message.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Add basic support for git log operations

Describe your feature

The gitz library should offer basic Git Log functionality.

Your potential solution

Provide a log function that grabs a complete snapshot of the current repository history. The output should be returned as a raw string

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: ensure a default push is context-aware and is capable of supporting basic options

Describe your feature

Extend the push functionality of gitz to be context-aware and to support additional options. By default, Push should be aware of the active branch and push outstanding changes back to the remote.

In terms of options:

  • Support pushing all outstanding changes back to the remote
  • Support pushing of multiple tags and branches by accepting any number of refspecs as per the documentation

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add basic local git config management support

Describe your feature

Introduce a new Config command that supports the setting of local git config values. Ensure a map of constants exists for easy setting lookup.

Another command should also exist for retrieving the entire config of a repository as a map that can be indexed by setting.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: add options that can configure the size of the repository during a clone

Describe your feature

gitz provides basic clone functionality and pulls the entire working tree from the remote. This can be slow for large repositories and unnecessary in certain conditions. Define a set of options that allows the cloning process only to pull what is needed:

  • Support cloning to a desired depth
  • Cloning at a specific depth (shallow clone)
  • Checking out a specific branch (detached head)
  • Cloning without retrieving any tags

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.