-
Notifications
You must be signed in to change notification settings - Fork 1
/
POC_script.sh
executable file
·59 lines (51 loc) · 1.54 KB
/
POC_script.sh
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
## THIS SCRIPT SERVES AS A PROOF OF CONCEPT OF THE GIT DONKEY PROJECT. ##
# 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