@@ -20,6 +20,10 @@ mod remote_at {
20
20
) ;
21
21
assert_eq ! ( remote. url( Direction :: Fetch ) . unwrap( ) . to_bstring( ) , fetch_url) ;
22
22
23
+ let new_fetch_url = "https://host.xz/byron/gitoxide" ;
24
+ remote = remote. with_url ( new_fetch_url) ?;
25
+ assert_eq ! ( remote. url( Direction :: Fetch ) . unwrap( ) . to_bstring( ) , new_fetch_url) ;
26
+
23
27
for ( spec, direction) in [
24
28
( "refs/heads/push" , Direction :: Push ) ,
25
29
( "refs/heads/fetch" , Direction :: Fetch ) ,
@@ -57,6 +61,18 @@ mod remote_at {
57
61
"push is the same as fetch was rewritten"
58
62
) ;
59
63
64
+ let remote = remote. with_url ( "https://github.com/foobar/gitoxide" ) ?;
65
+ assert_eq ! (
66
+ remote. url( Direction :: Fetch ) . unwrap( ) . to_bstring( ) ,
67
+ rewritten_fetch_url,
68
+ "fetch was rewritten"
69
+ ) ;
70
+ assert_eq ! (
71
+ remote. url( Direction :: Push ) . unwrap( ) . to_bstring( ) ,
72
+ rewritten_fetch_url,
73
+ "push is the same as fetch was rewritten"
74
+ ) ;
75
+
60
76
let remote = repo
61
77
. remote_at ( "https://github.com/foobar/gitoxide" . to_owned ( ) ) ?
62
78
. push_url ( "file://dev/null" . to_owned ( ) ) ?;
@@ -87,6 +103,18 @@ mod remote_at {
87
103
"push is the same as fetch was rewritten"
88
104
) ;
89
105
106
+ let remote = remote. with_url_without_url_rewrite ( "https://github.com/foobaz/gitoxide" ) ?;
107
+ assert_eq ! (
108
+ remote. url( Direction :: Fetch ) . unwrap( ) . to_bstring( ) ,
109
+ "https://github.com/foobaz/gitoxide" ,
110
+ "fetch was rewritten"
111
+ ) ;
112
+ assert_eq ! (
113
+ remote. url( Direction :: Push ) . unwrap( ) . to_bstring( ) ,
114
+ "https://github.com/foobaz/gitoxide" ,
115
+ "push is the same as fetch was rewritten"
116
+ ) ;
117
+
90
118
let remote = repo
91
119
. remote_at_without_url_rewrite ( "https://github.com/foobar/gitoxide" . to_owned ( ) ) ?
92
120
. push_url_without_url_rewrite ( "file://dev/null" . to_owned ( ) ) ?;
@@ -96,6 +124,19 @@ mod remote_at {
96
124
"file://dev/null" ,
97
125
"push-url rewrite rules are not applied"
98
126
) ;
127
+
128
+ let remote = remote
129
+ . with_url_without_url_rewrite ( "https://github.com/foobaz/gitoxide" . to_owned ( ) ) ?
130
+ . push_url_without_url_rewrite ( "file://dev/null" . to_owned ( ) ) ?;
131
+ assert_eq ! (
132
+ remote. url( Direction :: Fetch ) . unwrap( ) . to_bstring( ) ,
133
+ "https://github.com/foobaz/gitoxide"
134
+ ) ;
135
+ assert_eq ! (
136
+ remote. url( Direction :: Push ) . unwrap( ) . to_bstring( ) ,
137
+ "file://dev/null" ,
138
+ "push-url rewrite rules are not applied"
139
+ ) ;
99
140
Ok ( ( ) )
100
141
}
101
142
}
0 commit comments