-
Notifications
You must be signed in to change notification settings - Fork 175
update_tags.sh: make UPDATED_SOURCE relative to tags file #71
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
Conversation
|
Hi, thanks but I don't want a dependency on Python so we'll have to find a different implementation... When the cache dir is not set (i.e. when we store the |
|
I am using the script itself also outside of Vim, e.g. from a Git hook - so it should be done in the script. |
| # This is required for consistent naming. | ||
| # See https://github.com/ludovicchabant/vim-gutentags/issues/70. | ||
| relpath() { | ||
| python -c "import os.path; print(os.path.relpath('$1', '${2}'))" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not going to work if path contains backslash, single quote or some of the control characters. Should be
A="$1" B="$2" python -c 'import os; print(os.path.relpath(os.environ["A"], os.environ["B"]))'
(you may also pass this as an argument after -c command, but this would require two imports).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, but we need something without Python anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know only one way so far: ln --relative --symbolic with readlink. But this is GNU-coreutils-specific, BSD ln seems to not have this argument. I am wondering why you want exactly relative path? It seems that absolute path is easier to construct:
abspath() {(
test "x$2" '!=' "x" && cd "$2"
cd "$(dirname "$1")"
printf '%s/%s\n' "$(pwd)" "$(basename "$1")"
)}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember.. but it will be shorter at least.
|
I did what I said (make the file path relative in Vimscript) with commit 09fbdfc. If you run the script from a git hook you shouldn't have problems passing that path to the script in a relative way, no? (since the hook itself runs in the git repo AFAIK). |
Fixes #70.
TODO:
plat/win32/update_tags.cmd