path: root/t
diff options
authorMartin von Zweigbergk <>2011-09-02 00:50:34 (GMT)
committerJunio C Hamano <>2011-09-12 04:39:56 (GMT)
commit60e5eee0f1a70e09f28d1e55b3aaddb59eeea887 (patch)
tree288bbe70fc5574c3a21a3de90c53e7cffa4ef2b1 /t
parent28f555f6357ee0706847aff5b476b31b472b325c (diff)
remote: "rename o foo" should not rename ref "origin/bar"
When renaming a remote called 'o' using 'git remote rename o foo', git should also rename any remote-tracking branches for the remote. This does happen, but any remote-tracking branches starting with 'refs/remotes/o', such as 'refs/remotes/origin/bar', will also be renamed (to 'refs/remotes/foorigin/bar' in this case). Fix it by simply matching one more character, up to the slash following the remote name. Signed-off-by: Martin von Zweigbergk <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't')
1 files changed, 10 insertions, 0 deletions
diff --git a/t/ b/t/
index 36c807c..15186c8 100755
--- a/t/
+++ b/t/
@@ -651,6 +651,16 @@ test_expect_success 'rename a remote with name part of fetch spec' '
+test_expect_success 'rename a remote with name prefix of other remote' '
+ git clone one four.three &&
+ (cd four.three &&
+ git remote add o git:// &&
+ git remote rename o upstream &&
+ test "$(git rev-parse origin/master)" = "$(git rev-parse master)")
cat > remotes_origin << EOF
URL: $(pwd)/one
Push: refs/heads/master:refs/heads/upstream