Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:02:31 +08:00
commit 866f3dbf18
34 changed files with 8341 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# repo_check.sh - Determine whether to use jj or git for this repository
# Outputs to stdout: "jj", "git", or "no-repo"
# Always exits with 0 on success
#
# Detection priority:
# 1. .jj folder exists → "jj" (even if git repo also present)
# 2. Git repository detected → "git"
# 3. Neither found → "no-repo"
set -e
# Check for jj repository - priority 1
# Note: jj often operates atop git, so check .jj first
# Use `jj root` to detect jj workspace from any subdirectory
if jj root > /dev/null 2>&1; then
echo "jj"
exit 0
fi
# Check for git repository - priority 2
if git rev-parse --git-dir > /dev/null 2>&1; then
echo "git"
exit 0
fi
# Neither found - user needs to initialize
echo "no-repo"
exit 0