forked from 777genius/claude-code-source-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitpretty-apply.sh
More file actions
43 lines (31 loc) · 1.09 KB
/
gitpretty-apply.sh
File metadata and controls
43 lines (31 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
set -euo pipefail
# Apply gitpretty's per-file beautification so GitHub file history shows
# readable, themed commit messages for each file.
REPO_PATH="${1:-.}"
INSTALL_HOOKS="${2:-}"
GITPRETTY_HOME="${HOME}/.gitpretty"
if ! command -v git >/dev/null 2>&1; then
echo "git is required but was not found on PATH"
exit 1
fi
if [ ! -d "${REPO_PATH}/.git" ]; then
echo "Target is not a git repository: ${REPO_PATH}"
echo "Usage: $0 [repo-path] [--hooks]"
exit 1
fi
if [ ! -d "${GITPRETTY_HOME}" ]; then
echo "Installing gitpretty into ${GITPRETTY_HOME} ..."
git clone https://github.com/nirholas/gitpretty.git "${GITPRETTY_HOME}"
fi
chmod +x "${GITPRETTY_HOME}"/*.sh "${GITPRETTY_HOME}"/scripts/*.sh
if [ "${INSTALL_HOOKS}" = "--hooks" ]; then
echo "Installing gitpretty hooks in ${REPO_PATH} ..."
(
cd "${REPO_PATH}"
"${GITPRETTY_HOME}"/scripts/emoji-hooks.sh install
)
fi
echo "Running per-file beautify commits in ${REPO_PATH} ..."
"${GITPRETTY_HOME}"/emoji-file-commits.sh "${REPO_PATH}"
echo "Done. Review with: git -C ${REPO_PATH} log --oneline -n 20"