From 6c47489ade78720f065979835c2a266d546eb97b Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 25 Jun 2024 17:54:09 -0700 Subject: [PATCH] Fix git chmod alias This command previously would only work from the root directory of the repository. This commit updates it to work properly when run for files deeper in the directory tree. --- src/.gitconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/.gitconfig b/src/.gitconfig index 071fbf8..48922ed 100644 --- a/src/.gitconfig +++ b/src/.gitconfig @@ -7,7 +7,7 @@ alias = !git config -l | grep '^alias\\.' | cut -d '.' -f '2-' | sed -r -e 's/=/ = /' | sort amend = commit --amend amend-a = commit -a --amend - chmod = "!f() { chmod_flag=$1 && shift && git add --chmod=$chmod_flag $@ && chmod $chmod_flag $@; }; f" + chmod = "!f() { chmod_flag=$1 && shift && cd -- \"${GIT_PREFIX:-.}\"; git add --chmod=\"$chmod_flag\" \"$@\" && chmod \"$chmod_flag\" \"$@\"; }; f" # TODO: fix below; that method is not accurate # check-merge = "!f() { output=$(git format-patch ${1:-master} --stdout | git apply --3way --check - 2>/dev/null); exit_code=$?; if [ $exit_code != '0' ] && [ $exit_code != '128' ]; then echo 'Merge conflicts exist! See `git apply` output below:'; echo; echo $output; fi; }; f" co-pr = "!f() { \