New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blob and tree gfm links to anchors work. #6375

merged 1 commit into from Feb 25, 2014


2 participants

cirosantilli commented Feb 21, 2014

Fixes #6046 bug

Intended Behavior

When on a tree directory such as path/name/tree/branch/dir, in the rendered

[0]() | path/name/tree/branch/dir | current behavior.
[1](#id) | path/name/tree/branch/dir#id | new. Before opened wiki.
[2]( | path/name/blob/branch/dir/ | new

When on a markdown blob such as path/name/blob/branch/dir/

[0]() | path/name/blob/branch/dir/ | current
[1](#id) | path/name/blob/branch/dir/ | new
[2]( | path/name/blob/branch/dir/ | new

This differs slightly from GitHub behavior, in which [empty]() always points to a non existent URL.

I feel that this behavior makes more sense, because if "#a" points to the current file, then "" should too.

The following is the diff for the tests under spec/seed_project.tar.gz. Only the markdown branch was modified with a new commit added. Rationale is explianed on the comments under features/steps/project/project_markdown_render.rb and spec/factories.rb#project.

diff --git a/ b/
index 7577fc5..96c09cf 100644
--- a/
+++ b/
@@ -1,8 +1,11 @@
+This branch is meant to be used with for markdown tests.
+Do not rely on its commit message or SHA being constant.
# Welcome to GitLab [![build status](](

GitLab is a free project and repository management application

## Application details

* rails 3.1
@@ -53,3 +56,15 @@ Email

Want to help - send a pull request.
We'll accept good pull requests.
+# Links with IDs
diff --git a/d/ b/d/
new file mode 100644
index 0000000..78addd3
--- /dev/null
+++ b/d/
@@ -0,0 +1,9 @@

This comment has been minimized.


dzaporozhets commented Feb 25, 2014

@cirosantilli look good. Thank you

dzaporozhets added a commit that referenced this pull request Feb 25, 2014

Merge pull request #6375 from cirosantilli/link-with-id
Blob and tree gfm links to anchors work.

@dzaporozhets dzaporozhets merged commit 9f20580 into gitlabhq:master Feb 25, 2014

1 check passed

default The Travis CI build passed

@cirosantilli cirosantilli deleted the booktree:link-with-id branch Apr 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment