summaryrefslogtreecommitdiff
path: root/git-parse-remote.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-13 18:57:39 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-15 11:23:39 -0700
commitd8a1deecc6ef37728b951eaba051deb7e0a38af8 (patch)
tree46880218861d52fb0c30d520030a70cd32bca163 /git-parse-remote.sh
parent03feddd6e8e779086ac2d131ded325f8e5601653 (diff)
downloadgit-d8a1deecc6ef37728b951eaba051deb7e0a38af8.tar.gz
Refuse to create funny refs in clone-pack, git-fetch and receive-pack.
Using git-check-ref-format, make sure we do not create refs with funny names when cloning from elsewhere (clone-pack), fast forwarding local heads (git-fetch), or somebody pushes into us (receive-pack). Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-parse-remote.sh')
-rwxr-xr-xgit-parse-remote.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 5e75e15a7e..aea7b0e549 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -94,6 +94,12 @@ canon_refs_list_for_fetch () {
heads/* | tags/* ) local="refs/$local" ;;
*) local="refs/heads/$local" ;;
esac
+
+ if local_ref_name=$(expr "$local" : 'refs/\(.*\)')
+ then
+ git-check-ref-format "$local_ref_name" ||
+ die "* refusing to create funny ref '$local_ref_name' locally"
+ fi
echo "${dot_prefix}${force}${remote}:${local}"
dot_prefix=.
done