Skip to content

Commit

Permalink
Remove destination folder existence check and only create it when the…
Browse files Browse the repository at this point in the history
… path contains slash(s)
  • Loading branch information
weiw005 committed Oct 23, 2023
1 parent 8eb77fc commit b439ed2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/git-cp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ else
echo 1>&2 "$DESTINATION_FILENAME is not a file path."
exit 80
fi
DESTINATION_DIR="${DESTINATION_FILENAME%/*}"
if [ ! -d "$DESTINATION_DIR" ]; then
if [[ "$DESTINATION_FILENAME" == */* ]]; then
DESTINATION_DIR="${DESTINATION_FILENAME%/*}"
if ! mkdir -p "$DESTINATION_DIR"; then
echo 1>&2 "Failed to create destination directory: $DESTINATION_DIR"
exit 160
Expand Down

0 comments on commit b439ed2

Please sign in to comment.