andsens / homeshick

git dotfiles synchronizer written in bash
MIT License
2.11k stars 145 forks source link

Prevent error message from submodule_files.sh #129

Closed sebastianw closed 9 years ago

sebastianw commented 9 years ago

Homeshick sources all lib/*.sh files but lib/submodule_files.sh is not supposed to be sourced and produces an error message when doing "homeshick pull homeshick". To prevent this we move the script to the new lib/utils/ subdirectory.

$ homeshick pull homeshick
/home/sebastian/.homesick/repos/homeshick/lib/submodule_files.sh: line 15: cd: homeshick/: No such file or directory
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
         pull homeshick
andsens commented 9 years ago

Whoa, I am very curious as to how I didn't spot that. I can't reproduce this on any of my machines, but the cause of the error makes perfect sense. What system are you on? I'd like to write a regression test for this.

I am closing this one though, I fixed it in a slightly different manner: 59070bb9d50ed1c0215da4f9d2f05d0d08d6c052

sebastianw commented 9 years ago

I have two Debian Wheezy (amd64) boxes where the error appears. This is the output when I do homeshick pull homeshick with set -x inserted:

+ source /home/sebastian/.homesick/repos/homeshick/lib/submodule_files.sh
++ root=pull
++ toplevel=homeshick
++ path=
++ repo=homeshick/
++ repo=homeshick/
++ [[ homeshick/ =~ ^home ]]
++ cd homeshick/
/home/sebastian/.homesick/repos/homeshick/lib/submodule_files.sh: line 15: cd: homeshick/: No such file or directory
++ git ls-files
++ sed 's#^#homeshick//#'
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
+ exit_status=0

No idea why it isn't reproducible on your machines...

andsens commented 9 years ago

I run some debian machines as well, I guess somehow the error message is swallowed. Regardless, I merged the fixes into master, homeshick pull homeshick should fix the changes :-)