Re: [PATCH] Follow symlinks when adding changes to git
On Fri, 23 Mar 2018 10:32:41 +0100, Lars Flitterwrote: >+ git -C "$INNER_GIT_DIR" add "$(readlink -f "$1")" || return >+ [[ -n $(git -C "$INNER_GIT_DIR" status --porcelain "$(readlink -f >"$1")") ]] || I'm not saying this patch is bad, but my first thought is to be very careful using readlink and/or realpath. They're very inconsistently implemented across platforms. Even on Linux it's difficult to depend on them as some distros use the GNU coreutils version and some don't. OSX uses a BSD flavor that has different flags. ___ Password-Store mailing list Password-Store@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/password-store
Re: [PATCH] Follow symlinks when adding changes to git
Hello Lars, Lars Flitterwrites: > + git -C "$INNER_GIT_DIR" add "$(readlink -f "$1")" || return Since the patch doesn’t explicitly mention the motivation: I suppose this is meant to cover the case where you are using a symlink as an alias to another pass entry? In that case, running «pass edit foo» will fail to commit the edited file. Good catch, I think I ran into this once or twice. Kind regards, -- Insane cobra split the wood Trader of the lowland breed Call a jittney, drive away In the slipstream we will stay ___ Password-Store mailing list Password-Store@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/password-store
[PATCH] Follow symlinks when adding changes to git
--- src/password-store.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/password-store.sh b/src/password-store.sh index eac5404..fbcc760 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -35,8 +35,8 @@ set_git() { } git_add_file() { [[ -n $INNER_GIT_DIR ]] || return - git -C "$INNER_GIT_DIR" add "$1" || return - [[ -n $(git -C "$INNER_GIT_DIR" status --porcelain "$1") ]] || return + git -C "$INNER_GIT_DIR" add "$(readlink -f "$1")" || return + [[ -n $(git -C "$INNER_GIT_DIR" status --porcelain "$(readlink -f "$1")") ]] || return git_commit "$2" } git_commit() { -- 2.16.2 ___ Password-Store mailing list Password-Store@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/password-store