iankelling.org
/
git
/
small-misc-bash
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fa314fa
)
fix/simplify gitget, dunno what i was thinking
author
Ian Kelling
<iank@fsf.org>
Wed, 7 Mar 2018 21:57:53 +0000
(16:57 -0500)
committer
Ian Kelling
<iank@fsf.org>
Wed, 7 Mar 2018 21:57:53 +0000
(16:57 -0500)
gitget
patch
|
blob
|
history
diff --git
a/gitget
b/gitget
index a61c11479b850f9b2642e14a67ec38edf387f1e2..51998984f5972820654000e2ce6d01ed4feab545 100755
(executable)
--- a/
gitget
+++ b/
gitget
@@
-38,23
+38,11
@@
REPO_DIR is, or will become the root of the repo."
local workingdir
local orig_dir="$PWD"
local ret
local workingdir
local orig_dir="$PWD"
local ret
- if [[ $1 == *[^/].git ]]; then
- if [[ $2 ]]; then
- workingdir="$2"
- else
- workingdir="${1##*/}"
- workingdir="${workingdir%.git}"
- fi
- elif (( $# == 2 )); then
- echo error: 2 arguments given but the first does not end in .git
- echo "$help"
- return 1
+ if [[ $2 ]]; then
+ workingdir="$2"
else
else
- workingdir="$1"
- if [[ ! -d $workingdir/.git ]]; then
- echo "error: expected $workingdir/.git to exist"
- return 1
- fi
+ workingdir="${1##*/}"
+ workingdir="${workingdir%.git}"
fi
[[ -d $workingdir ]] || mkdir -p "$workingdir"
cd "$workingdir"
fi
[[ -d $workingdir ]] || mkdir -p "$workingdir"
cd "$workingdir"