Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Ensure tickets.txt exists
- if [[ ! -f tickets.txt ]]; then
- echo "❌ Error: tickets.txt not found!"
- exit 1
- fi
- # Output file
- OUTPUT_FILE="commit_report.txt"
- > "$OUTPUT_FILE" # Clear the output file before writing
- # Loop through each ticket number (trim whitespace)
- while IFS= read -r ticket || [[ -n "$ticket" ]]; do
- ticket=$(echo "$ticket" | tr -d '\r') # Remove potential Windows CR characters
- if [[ -z "$ticket" ]]; then
- continue # Skip empty lines
- fi
- echo "🔹 Commits for: $ticket" | tee -a "$OUTPUT_FILE"
- # Find commits matching the ticket number
- commits=$(git log drattack --grep="$ticket" --format="%H")
- if [[ -n "$commits" ]]; then
- for commit in $commits; do
- echo "➡ Commit: $commit" | tee -a "$OUTPUT_FILE"
- git show --stat --name-only "$commit" | tee -a "$OUTPUT_FILE"
- echo "--------------------------------------" | tee -a "$OUTPUT_FILE"
- done
- else
- echo "❗ No commits found for $ticket" | tee -a "$OUTPUT_FILE"
- echo "--------------------------------------" | tee -a "$OUTPUT_FILE"
- fi
- done < tickets.txt
- echo "✅ Report generated: $OUTPUT_FILE"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement