mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
Allow git cp to create destination folder automatically (#1091)
* Allow `git cp` to create destination folder automatically * Replace subshell command with builtin operation to infer DESTINATION_DIR * Remove destination folder existence check and only create it when the path contains slash(s)
This commit is contained in:
parent
263dcb4a79
commit
90221f2149
12
bin/git-cp
12
bin/git-cp
|
|
@ -38,6 +38,18 @@ else
|
|||
exit 40
|
||||
fi
|
||||
|
||||
if [[ "$DESTINATION_FILENAME" == */ ]]; then
|
||||
echo 1>&2 "$DESTINATION_FILENAME is not a file path."
|
||||
exit 80
|
||||
fi
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
MERGE_OPT=
|
||||
ff=$(git config --get merge.ff)
|
||||
if [[ "$ff" == "only" ]]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue