-
Notifications
You must be signed in to change notification settings - Fork 145
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
Only symlink files that are tracked by git #95
Comments
|
Ostensibly, yes. But you'd have to rewrite large portions of the loop since The advantage of |
That is unfortunate that the loop would have to be rewritten. Luckily we do have unit tests that should help with that task. Is there any reason why we have to pay attention to directories? Could we take a git approach, where we create parent directories for files when necessary, but ignore directories otherwise? It seems to me that I'm going to look into when ls-files was added to git and I'll post the version here. |
I'm definitely over simplifying. I just remembered that there has to be a check if the file already exists. There are probably other things I'm over looking as well since I should just go and read the code. |
Yes. This is where stuff like that really pays off :-)
This might actually work! I was thinking about something along the same lines. It's all about re-implementing the linking table. The directories in the castle are represented through the left column.
Probably, the code is somewhat well-documented. If it's insufficient, please ask, maybe the comments only make sense to me. |
Updated the issue title from "Don't symlink gitignored files in castles" to "Only symlink files that are tracked by git", which makes more sense seeing how our approach has changed. |
It appears that As you can see What is the oldest version of git that homeshick supports? Do I need to do any version checking for this? |
Heh, that is... oold. p.s.: The testing branch I was talking about in #88 is now up and running. I also added some contribution guidelines, but I think you are pretty much following them all anyways :-) |
I figured that it has been around long enough to not worry about backwards compatibility, but just wanted to check before fixing this issue. Your testing docs and CONTRIBUTING.md Looks great. Its nice when a project has clear guidelines like that. Thank you for starting the testing branch. I'll probably point to it when I'm not working on development. I'm hoping to get to work on fixing this issue today :) |
Do you think that |
I do. You can always avoid the symlink by putting it into the root of the castle, outside |
Great point. |
I've run into a big issue when writing a test to allow symlinking items from within a .git folder. It appears that git doesn't let you add a folder named .git to the repo. This makes it so that our solution for managing git hooks won't work. [~] $ git --version
git version 1.8.5.2 (Apple Git-48)
[~] $ git init gittest
Initialized empty Git repository in ~/gittest/.git/
[~] $ cd gittest/
[gittest] $ touch a
[gittest] $ mkdir git
[gittest] $ touch git/a
[gittest] $ mkdir git/.git
[gittest] $ touch git/.git/a
[gittest] $ git add .
[gittest] $ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: a
new file: git/a
[gittest] $ git add -f git/.git/
error: Invalid path 'git/.git/a'
error: unable to add git/.git/a to index
fatal: adding files failed |
Balls. Maybe we should've tried that to begin with? Hehe. I can't see a way around this unless we have a "special" name for custom In #77 I propose adding a separation char to support linking files and folders depending on the system homeshick is running on. Though maybe a doublehash would be better seeing how people might enumerate some foldernames like |
Yeah, should have tested that first. Oh well. #77 is a really nice feature. I've been separating my os dependent files into separate castles. I like the idea that a blank os defaults to all. For example: No matter how we go about this though there is a small chance that we will break some peoples configuration. Does homeshick use semantic versioning? If not, we could create a new issue to discuss it further. In essence we could add code that doesn't auto update homeshick if the version jump is a new major version (breaks backwards compatibility). Instead it would prompt the user, that there are major breaking changes and that they should read the change log before updating. After they've done so they will run |
I'm not exactly sure how #77 would break someone's existing config. Could you give an example? |
Upon more consideration I disagree with my idea I posted earlier:
It is simply not intuitive that the
|
@squaresurf You had mentioned before that you currently use os-specific castles. How would that compare with this proposed feature? |
I agree. The approach you outlined would be my choice as well.
Meh. I think that just makes things complicated when we decide to add more options after the hash (if for example we decide to support things other than the OS, e.g. the hostname). But let's discuss that in #77.
It doesn't yet, but I think the time is ripe for that. Even though I'd like to keep things simple, I can see that removing legacy stuff will be almost impossible to do without it. |
Seeing how I don't didn't touch upon the issue of
|
I agree 👍 |
This resolves #95 : Only symlink files that are tracked by git
👍 |
When a file is ignored by git in a castle, it should not be symlinked into
$HOME
.This would also allow the removal of the
.git
folders and files pruning when listing the castle contents, since those files are ignored by git per default.However:
git check-ignore
was only added in git 1.8.2, the change should only affect that version and upwards.This would also fix #94.
The text was updated successfully, but these errors were encountered: