summaryrefslogtreecommitdiff
path: root/git-parse-remote.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-16 00:10:14 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-16 00:10:14 (GMT)
commit48bc2fb0cd9ca05005c2062c3493e62e13593f55 (patch)
tree2c0bccb31f8215ae4b49f3b667e300e824792e0e /git-parse-remote.sh
parent652d5dc6c0aef842eafcd9d2f73a4836d20734e2 (diff)
downloadgit-48bc2fb0cd9ca05005c2062c3493e62e13593f55.zip
git-48bc2fb0cd9ca05005c2062c3493e62e13593f55.tar.gz
git-48bc2fb0cd9ca05005c2062c3493e62e13593f55.tar.bz2
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 4d8a572..32f1085 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