Skip to content

Conversation

@docoleman
Copy link
Contributor

Allow gitless to track, untrack and resolve on files that start with
.git EXCEPT for the very specific directory at the top level of the repo
.git. For example, gl track .gitignore is fine, gl track .git/HEAD
is not allowed. Another, gl track .gitdir/some_file is allowed, gl track .git will not be allowed.

Fixes #178 .

Made changes to the path processor and wrote unit tests against the path processor. Factored argparser out to a function so unit testing is easier.

The only issue(?) with this approach is that there is no error messaging. Gitless will ALWAYS silently drop the paths and do nothing. Git fatals and reports on the first path if all the paths are under .git/, otherwise it will silently drop the paths under .git/.

E.g.

$ git add .git/HEAD
error: invalid path '.git/HEAD'
error: unable to add '.git/HEAD' to index
fatal: adding files failed
$ git add .git/HEAD .git/index
error: invalid path '.git/HEAD'
error: unable to add '.git/HEAD' to index
fatal: adding files failed
$ git add .gitignore .git/HEAD #works with no error message!

Darcy Coleman added 2 commits October 5, 2019 16:24
Allow gitless to track, untrack and resolve on files that start with
.git EXCEPT for the very specific directory at the top level of the repo
.git. For example, `gl track .gitignore` is fine, `gl track .git/HEAD`
is not allowed. Another, `gl track .gitdir/some_file` is allowed, `gl
track .git` will not be allowed.
@spderosso
Copy link
Member

Thanks for fixing this bug!

The only issue(?) with this approach is that there is no error messaging. Gitless will ALWAYS silently drop the paths and do nothing.

In some cases we use skip_dir_cb to output a warning if you ask to e.g., track files that are ignored. We could add another callback to PathProcessor in the future if we want to.

@spderosso spderosso merged commit 520f896 into gitless-vcs:master Oct 7, 2019
@spderosso
Copy link
Member

hmm for some strange reason test_path_processor_track_git_file fails on Windows. It's not immediately obvious to me what the problem is. If you have no idea either, I can take a look at it (I have a windows VM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gl track .gitignore (or any file starting with .git) fails with a complaint about paths

2 participants