Closed fenugrec closed 3 years ago
The point is that typically when stowing from a package which is a git repo, the .gitignore at the top of that repo is intended only for use within the git repo, and should not be stowed into ~
or /usr/local
or wherever the stow target directory is. The only exception is when you want to use Stow to manage ~/.gitignore
(say) as a symlink pointing to a file version-controlled with git. In that case, you can set up a .stow-local-ignore
just for that git repo which overrides Stow's default ignore list and allows the .gitignore
to be stowed. In fact I do exactly that myself: https://github.com/aspiers/git-config/blob/master/.stow-local-ignore
Hope that makes sense, and sorry for the slow reply! Closing for now, but happy to reopen if anything is unclear.
and sorry for the slow reply!
Haha no worries I've seen / done worse.
Thanks for the alternate solution, I wasn't aware of .stow-local-ignore. I still think it's an interesting edge case / typical scenario; next time someone asks it may need to be added to the FAQ !
@fenugrec commented on April 5, 2021 1:09 AM:
and sorry for the slow reply!
Haha no worries I've seen / done worse.
:laughing: Thanks for your patience!
Thanks for the alternate solution, I wasn't aware of .stow-local-ignore. I still think it's an interesting edge case / typical scenario; next time someone asks it may need to be added to the FAQ !
Yep, fair point. We don't actually have a FAQ yet, but there is a section on Ignore Lists in the manual. If you have any ideas for how to improve that, I'd be happy to hear them!
Hmm.. I must not be as savvy as OP, but can't seem to understand the issue. I wonder if I am doing something wrong?
I put my .gitconfig
and .gitignore
in ~/.dotfiles/git
which is vc'd using a normal git repo that makes ~/
as my work-tree (have an alias, similar to the "bare" concept, just not a bare repo basically). This seems to work fine. I think because I set my work-tree to $HOME. So it pulls the gitignore from home. Not my dotfiles. Does that make sense?
I don't have .gitignore file in the .stow-global-ignore and yet I am unable to stow it.
Here is my verbose output:
dotfiles/git/.stow-local-ignore didn't exist
/Users/imamkhaja/.stow-global-ignore didn't exist
Using built-in ignore list
Ignore list regexp for paths: /(?^:(^|/)(^/\.stow\-local\-ignore$|^/COPYING|^/LICENSE.*|^/README.*)(/|$))/
Ignore list regexp for segments: /(?^:^(\.git|.+~|_darcs|.+,v|RCS|\.gitignore|#.*#|CVS|\.cvsignore|\.svn|\.#.+|\.hg)$)/
Ignoring path segment .gitignore
It seems that segments ignore list is the reason, that .gitignore isn't stowing, if I am not worng.
Hello there. I also can't stow the .gitignore
by eliminating it from the .stow-local-ignore
file on the macOS.
@aspiers sorry for bothering you, could you please take a look?
quoting the first post :
just add --dotfiles in .stowrc , and rename files to dot-gitconfig and dot-gitignore, so as I said this isn't really an issue.
that's how I solved it
@afrid18 @nineboxes Just create an empty .stow-local-ignore
in ~/.dotfiles/git
. The point is not to override your global ignore file, but to override Stow's internal default ignore file.
Heh, I just figured it out while writing this (is there a "rubberduck" label ?). So it's not really a bug report anymore, but I'd like to discuss it anyway - feel free to close at any time.
I was trying to stow
~/.gitconfig
and~/.gitignore
. The first worked, but I just could not make it work with .gitignore !Turning on -vvvvv revealed the explanation :
I understand the reason for ignoring those in the root of the "stow directory", but I'm not sure when they would be a problem coming from within a package ? Unless those regexp are mainly so that --adopt doesn't pick up all that trash ?
I know how to work around this ; just add --dotfiles in .stowrc , and rename files to
dot-gitconfig
anddot-gitignore
, so as I said this isn't really an issue.