Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot stow ".gitignore" #75

Closed
fenugrec opened this issue Oct 30, 2020 · 13 comments
Closed

cannot stow ".gitignore" #75

fenugrec opened this issue Oct 30, 2020 · 13 comments
Labels

Comments

@fenugrec
Copy link

fenugrec commented Oct 30, 2020

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 :

Using built-in ignore list
    Ignore list regexp for paths:    /(?^:(^|/)(^/README.*|^/LICENSE.*|^/\.stow\-local\-ignore$|^/COPYING)(/|$))/
    Ignore list regexp for segments: /(?^:^(\.hg|CVS|.+,v|\.gitignore|\.svn|#.*#|\.cvsignore|\.#.+|_darcs|.+~|\.git|RCS)$)/

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 and dot-gitignore, so as I said this isn't really an issue.

@aspiers
Copy link
Owner

aspiers commented Apr 4, 2021

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.

@aspiers aspiers closed this as completed Apr 4, 2021
@fenugrec
Copy link
Author

fenugrec commented Apr 5, 2021

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 !

@aspiers
Copy link
Owner

aspiers commented Apr 5, 2021

@fenugrec commented on April 5, 2021 1:09 AM:

and sorry for the slow reply!

Haha no worries I've seen / done worse.

😆 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!

igormp added a commit to igormp/dotfiles that referenced this issue Jul 20, 2021
this allows us to use a global gitignore. See more at aspiers/stow#75
@whompyjaw
Copy link

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?

joech4n added a commit to joech4n/zsh-dotfiles that referenced this issue Jul 28, 2022
@afrid18
Copy link

afrid18 commented Aug 21, 2022

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.

Screenshot 2022-08-21 at 11 34 43 PM

@nineboxes
Copy link

nineboxes commented Dec 21, 2022

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?

@fenugrec
Copy link
Author

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

@FWDekker
Copy link

@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.

benglazer pushed a commit to benglazer/dotfiles that referenced this issue Feb 25, 2024
whargrove added a commit to whargrove/dotfiles that referenced this issue Feb 28, 2024
sarcasticadmin added a commit to sarcasticadmin/dotfiles that referenced this issue Mar 2, 2024
stow has a builtin ignore list:

    Ignore list regexp for paths:
/(?^:(^|/)(^/README.*|^/LICENSE.*|^/\.stow\-local\-ignore$|^/COPYING)(/|$))/

    Ignore list regexp for segments:
/(?^:^(\.hg|CVS|.+,v|\.gitignore|\.svn|#.*#|\.cvsignore|\.#.+|_darcs|.+~|\.git|RCS)$)/

ref: aspiers/stow#75

I thought I was going crazy trying to add a global `.gitignore` and show
kept skipping it. Easiest solution was to place a empty
`.stow-local-ignore` in the same dir as the `.gitingore` to wipe out the
default ignore list for stow.
yangmillstheory added a commit to yangmillstheory/dotfiles that referenced this issue Mar 5, 2024
@1player
Copy link

1player commented Sep 8, 2024

This is still an issue with the --dotfiles option. I understand the rationale of ignoring .gitignore, but dot-gitignore is also skipped which is a bug.

@aspiers
Copy link
Owner

aspiers commented Sep 8, 2024

@1player Did you try this?

@1player
Copy link

1player commented Sep 8, 2024 via email

@aspiers
Copy link
Owner

aspiers commented Sep 8, 2024

I think you are right, because something called dot-gitignore is obviously named that way because it was intended to be stowed. Please could you file a separate issue for that? I have checked the code and it looks like it's probably easy to fix.

@aspiers
Copy link
Owner

aspiers commented Sep 8, 2024

Fix submitted as #116, please can you test?

N0xFF added a commit to N0xFF/dotfiles that referenced this issue Oct 18, 2024
N0xFF added a commit to N0xFF/dotfiles that referenced this issue Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants