Skip to content

Commit

Permalink
git-find-commits-by-file-hash.sh fix repository checks
Browse files Browse the repository at this point in the history
  • Loading branch information
oh2fih committed Apr 8, 2024
1 parent 8ef9902 commit fc6bf8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/git-find-commits-by-file-hash.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
read -r -d '' USAGE << EOM
# ------------------------------------------------------------------------------
# Search Git repository history for commits with SHA-256 hash of a file
# Search Git repository history for commits with SHA-256 checksum of a file
#
# Answers the question "Has this version of this file ever been
# committed as the file on this path of this Git repository?"
Expand All @@ -10,7 +10,7 @@ read -r -d '' USAGE << EOM
# Usage: git-find-commits-by-file-hash.sh sha256sum path
#
# - The working directory should be inside a Git repository work tree.
# - The sha256sum should be an full sha256sum hash of the file.
# - The sha256sum should be an full sha256sum checksum of the file.
# - The path should be relative to the repository root.
#
# Author : Esa Jokinen (oh2fih)
Expand Down Expand Up @@ -56,13 +56,13 @@ fi

git rev-parse --is-inside-work-tree &> /dev/null \
|| {
echo -e "\033[0;31mNot inside a git repository!\033[0m" >&2 \
echo -e "\033[0;31mNot inside a git repository!\033[0m" >&2
exit 1
}

cd "$(git rev-parse --show-toplevel)" \
|| {
echo -e "\033[0;31mUnable to change to the repository root!\033[0m" >&2 \
echo -e "\033[0;31mUnable to change to the repository root!\033[0m" >&2
exit 1
}

Expand Down

0 comments on commit fc6bf8c

Please sign in to comment.