Skip to content

Commit bbb5576

Browse files
authored
Allow git operations when LFS isn't functioning (github#20569)
* Allow git operations when LFS isn't functioning * Update to be easier to read
1 parent 48f9718 commit bbb5576

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

.husky/post-checkout

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/sh
22
[ -n "$CI" ] && exit 0
3-
command -v git-lfs >/dev/null 2>&1 && git lfs post-checkout "$@" || { echo >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"; }
3+
if command -v git-lfs >/dev/null 2>&1
4+
then
5+
if ! (git lfs post-checkout "$@")
6+
then
7+
printf >&2 "\nGitHub Docs requires Git LFS but using the 'git-lfs' on your path failed.\n"
8+
fi
9+
else
10+
printf >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"
11+
fi

.husky/post-commit

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/sh
22
[ -n "$CI" ] && exit 0
3-
command -v git-lfs >/dev/null 2>&1 && git lfs post-commit "$@" || { echo >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"; }
3+
if command -v git-lfs >/dev/null 2>&1
4+
then
5+
if ! (git lfs post-commit "$@")
6+
then
7+
printf >&2 "\nGitHub Docs requires Git LFS but using the 'git-lfs' on your path failed.\n"
8+
fi
9+
else
10+
printf >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"
11+
fi

.husky/post-merge

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
#!/bin/sh
22
[ -n "$CI" ] && exit 0
3-
command -v git-lfs >/dev/null 2>&1 && git lfs post-merge "$@" || { echo >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"; }
3+
if command -v git-lfs >/dev/null 2>&1
4+
then
5+
if ! (git lfs post-merge "$@")
6+
then
7+
printf >&2 "\nGitHub Docs requires Git LFS but using the 'git-lfs' on your path failed.\n"
8+
fi
9+
else
10+
printf >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"
11+
fi

.husky/pre-push

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/sh
22
[ -n "$CI" ] && exit 0
3-
command -v git-lfs >/dev/null 2>&1 && git lfs pre-push "$@" || { echo >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"; }
3+
if command -v git-lfs >/dev/null 2>&1
4+
then
5+
if ! (git lfs pre-push "$@")
6+
then
7+
printf >&2 "\nGitHub Docs requires Git LFS but using the 'git-lfs' on your path failed.\n"
8+
fi
9+
else
10+
printf >&2 "\nGitHub Docs requires Git LFS but 'git-lfs' was not found on your path.\nLearn how to install Git LFS at <https://git.io/JBCId>.\n"
11+
fi
412

513
. "$(dirname "$0")/_/husky.sh"
614

0 commit comments

Comments
 (0)