summaryrefslogtreecommitdiff
path: root/bin/git-unshallow
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-07-21 13:20:08 +0100
committerSean Whitton <spwhitton@spwhitton.name>2019-07-21 13:20:08 +0100
commit1e50e30c48c4fb464fece61dbf97270697a75c37 (patch)
treed5d7af118b675c875506d0f194c7f42b4c8cddc4 /bin/git-unshallow
parente8e1389422aea4f5a0a4710f71e98779f9ca8f32 (diff)
downloaddotfiles-1e50e30c48c4fb464fece61dbf97270697a75c37.tar.gz
git-{unbare,unshallow}: use git-rev-parse --is-* options
Diffstat (limited to 'bin/git-unshallow')
-rwxr-xr-xbin/git-unshallow11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/git-unshallow b/bin/git-unshallow
index d0126c3d..f829a8aa 100755
--- a/bin/git-unshallow
+++ b/bin/git-unshallow
@@ -2,6 +2,11 @@
# assumes remote named origin
-git fetch --unshallow
-git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
-git fetch origin
+if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
+ git fetch --unshallow
+ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
+ git fetch origin
+else
+ echo >&2 "fatal: repository is not shallow"
+ exit 1
+fi