From 0e10c2a0a46def950dc204ef6dda0424f39466cc Mon Sep 17 00:00:00 2001 From: bupd Date: Fri, 10 May 2024 01:31:46 +0530 Subject: [PATCH] add: script file for poc Signed-off-by: bupd --- POC_script.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 POC_script.sh diff --git a/POC_script.sh b/POC_script.sh new file mode 100755 index 0000000..b2aef20 --- /dev/null +++ b/POC_script.sh @@ -0,0 +1,59 @@ + +#!/bin/bash + +# Function to check if the directory is a git repository +check_git_repo() { + if [ -d .git ]; then + echo "This directory is a git repository." + else + echo "This directory is not a git repository." + exit 1 + fi +} + +# Function to check if there are any unstaged changes +check_unstaged_changes() { + if ! git diff --quiet; then + echo "There are unstaged changes in this repository." + fi +} + +# Function to check if there are any staged but uncommitted changes +check_staged_changes() { + if ! git diff --cached --quiet; then + echo "There are staged but uncommitted changes in this repository." + fi +} + +# Function to check if there are any committed but not pushed changes +check_unpushed_commits() { + if [ $(git rev-list --count @{u}..HEAD) -gt 0 ]; then + echo "There are committed but not pushed changes in this repository." + fi +} + +# Function to check for untracked changes +check_untracked_changes() { + if [ $(git ls-files --others --exclude-standard | wc -l) -gt 0 ]; then + echo "There are untracked changes in this repository." + fi +} + +# Function to check for any other potential problems +check_other_problems() { + # Add additional checks here if needed + echo "No other problems found." +} + +# Main function to call all checks +main() { + check_git_repo + check_unstaged_changes + check_staged_changes + check_untracked_changes + check_unpushed_commits + check_other_problems +} + +# Call the main function +main