Merge branch 'script-for-current-commit-hash' into 'master'

Add commit-hash.sh for recipe troubleshooting

Closes #1626

See merge request redox-os/redox!1776
This commit is contained in:
Ojus Chugh 2025-12-21 15:21:18 +00:00
commit 919b176a7b

View File

@ -1,6 +1,8 @@
#!/usr/bin/env bash
# This script show the current Git branch and commit of the recipe source
# This script shows the current Git branch and commit of the recipe source
set -e
if [ $# -ne 1 ]
then
@ -9,7 +11,41 @@ then
exit 1
fi
recipe_path="$(target/release/find_recipe $1)"
recipe_name="$1"
cd "$recipe_path"/source
# Find the recipe directory
recipe_dir=$(find recipes -maxdepth 4 -type d -name "$recipe_name" | head -n 1)
if [ -z "$recipe_dir" ]
then
echo "Error: Recipe '$recipe_name' not found"
exit 1
fi
# Check if source directory exists
source_dir="$recipe_dir/source"
if [ ! -d "$source_dir" ]
then
echo "Error: Source directory for recipe '$recipe_name' not found at $source_dir"
echo "Note: The recipe may not have been fetched yet. Try running: make f.$recipe_name"
exit 1
fi
# Check if it's a git repository
if [ ! -d "$source_dir/.git" ]
then
echo "Error: Source directory is not a git repository"
exit 1
fi
# Show git information
echo "Recipe: $recipe_name"
echo "Path: $source_dir"
echo ""
cd "$source_dir"
echo "Branch and commit:"
git branch -v
echo ""
echo "Latest commit:"
git log -1 --pretty=format:"Hash: %H%nAuthor: %an <%ae>%nDate: %ad%nMessage: %s%n" --date=iso