Commit 898dc0f
[release/10.0.4xx] Preserve
* Preserve .git suffix in repository names when generating SourceLink URLs
Do not strip the `.git` suffix from repository names in GetSourceLinkUrlGitTask.
Some repositories legitimately include `.git` as part of their name, and removing
the suffix produces incorrect SourceLink URLs and 404 responses.
This change keeps `.git` when it is part of the repository name.
Additionally update the GitWeb provider to avoid appending `.git` when the
suffix is already present, preventing URLs like `repo.git.git`.
Add regression tests for repository names ending with `.git`.
* Update src/SourceLink.AzureRepos.Git.UnitTests/GetSourceLinkUrlTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update src/SourceLink.AzureRepos.Git.UnitTests/GetSourceLinkUrlTests.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* SourceLinkUrl is nullable, but the test asserts it is not null or empty before returning it. The null-forgiving operator is used here to satisfy the nullable analysis.
* Revert change in GetSourceLinkUrlGitTask
The previous change modified the shared Git SourceLink task to preserve the
`.git` suffix in repository names. This introduced regressions in other
providers (e.g. Bitbucket and Common tests).
The fix will be moved to the Azure Repos provider where the exact repository
name is required by the Azure DevOps API, instead of changing the shared
behavior for all providers.
* Refactor Git URL handling in GetSourceLinkUrlGitTask
* Restore GetSourceLinkUrlTests and add tests for Azure Repos repositories ending with .git
Ensure that repository names ending with ".git" are not treated the same
as repositories without the suffix and that the suffix is preserved in
the generated SourceLink URL.
* Remove duplicated Azure Repos .git regression tests
Fix build failure caused by accidentally duplicated test methods
introduced while adding regression tests for repository names
ending with `.git`.
* Enhance GetSourceLinkUrlTests with error assertion
Restore error comment – removal was unintentional.
* Add comment explaining why gitUri.GetPath() is used instead of relativeUrl for AzDO
---------
Co-authored-by: Artur Zegarek <artureales@gmail.com>
Co-authored-by: Eales <46241595+Eales@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>.git suffix in repository names when generating SourceLink URLs (#1658)1 parent 317814b commit 898dc0f
4 files changed
Lines changed: 62 additions & 5 deletions
File tree
- src
- Common/GitProvider
- SourceLink.AzureRepos.Git.UnitTests
- SourceLink.AzureRepos.Git
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| |||
Lines changed: 52 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | 158 | | |
160 | 159 | | |
161 | 160 | | |
| |||
285 | 284 | | |
286 | 285 | | |
287 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
288 | 338 | | |
289 | 339 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| |||
0 commit comments