Giter VIP home page Giter VIP logo

go-gitignore's People

Contributors

crackcomm avatar faiq avatar falconandy avatar phanirithvij avatar sabhiram avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

go-gitignore's Issues

Could you add a tag?

First of all thanks for the great work ๐Ÿ‘

I'll use go-gitignore in one of my projects and would be nice if the project follows semver tagging style.

Merge two GitIgnore structs

Is it possible to append more lines to a GitIgnore struct?

Could be solved by adding a function to merge multiple GitIgnore structs

func MergeGitIgnores(gitIgnores ...*GitIgnore) *GitIgnore

Asterisk * matches past path separator /

Hi! Quoting the gitignore spec:

An asterisk "*" matches anything except a slash.

Currently, the * walks right over any slashes. See the following example, which uses the common .* pattern to ignore dotfiles (used, for example, by the linux source). None of the paths should match.

package main

import (
	"fmt"

	"github.com/sabhiram/go-gitignore"
)

func main() {
	ign := ignore.CompileIgnoreLines(".*")
	paths := []string{
		"/a/b/.c/",
		"/.foo/a",
	}
	for _, p := range paths {
		matches := ign.MatchesPath(p)
		fmt.Printf("%q - %v\n", p, matches)
	}

	ign2 := ignore.CompileIgnoreLines("/.*")
	paths2 := []string{
		".foo/a",
		".asd/"}
	for _, p := range paths2 {
		matches := ign2.MatchesPath(p)
		fmt.Printf("%q - %v\n", p, matches)
	}
}

@sabhiram do you still maintain this project? Will pull requests be reviewed? I'd be happy to help out with this problem.

Question: is there support for multiple layers of ignore files?

๐Ÿ‘‹๐Ÿป

I'm trying to support .gitignore from the current directory as well as the user's global git ignore (which I'm parsing from ~/.gitconfig's core.excludesfile field).

Specifically I want to support whatever is defined in the local .gitignore and also whatever is in the global one.

The only way I think I'll be able to do that is by using CompileIgnoreFileAndLines and passing in the local file for the first argument, and then doing a ReadFile/Split for the global git ignore file and passing the individual lines.

Would that sound like the right approach to take or would you suggest any other way to achieve this?

Thanks!

migrate to github actions?

Looks like travis ci is no longer free since a month (june 15 2021)
Move to something like github actions or circle ci etc?

#16

update ioutil to os and update go version

"io/ioutil" is deprecated: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details.deprecated(default)

Remove extraneous error return

In CompileIgnoreLines (here), the function includes an error, when there is no actual error case returned. That then forces following methods (like CompileIgnoreFile) to also return a possible error, when none is possible.

Shouldn't the function call be:

func CompileIgnoreLines(lines ...string) *GitIgnore {

?

[suggestion] return reason for ignore

So I'm suggesting one more sibling method for MatchesPath which should kind of function like

git check-ignore -v filename

i.e. It would be cool if it can return

  • Which of the patterns matches with it (should be easy to implement right now)
  • Where the pattern was defined in the .gitignore file (needs a lot of work I assume)

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.