Skip to content
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

Support symbolic link #156

Open
eungjun-yi opened this issue Apr 21, 2016 · 12 comments
Open

Support symbolic link #156

eungjun-yi opened this issue Apr 21, 2016 · 12 comments

Comments

@eungjun-yi
Copy link

eungjun-yi commented Apr 21, 2016

Sometimes I move document file to another directory in my repository. Unfortunately it breaks the link(url) to the old location. My friends who click the old link I gave before moving the file will see 404 Not Found error.

It would be nice if I add a symlink (old -> new) then Github redirects it to the new location.

@nelsonic
Copy link

nelsonic commented Apr 21, 2016

@npcode are you moving the file using git mv to preserve the file/git history?

@eungjun-yi
Copy link
Author

eungjun-yi commented Apr 21, 2016

@nelsonic Well, yes, but what I want is not preserving history. I have updated my comment to avoid confusion.

@nelsonic
Copy link

nelsonic commented Apr 21, 2016

@npcode ah, ok. you want GitHub to 301 to the new location if someone clicks on an "old" link.
Its possible this would "break" some other functionality though ...
e.g:

# create a file
vi readme.md
# move the file to a sub-directory
mv readme.md subdir/readme.md

You want a link to github.com/npcode/prjoject/readme.md
to redirect to: github.com/npcode/prjoject/subdir/readme.md

But if you then create another file in the project with the same path as the original

# create new readme in root of project
vi readme.md

what would you expect the behaviour to be...?

@eungjun-yi
Copy link
Author

@nelsonic

But if you then create another file in the project with the same path as the original

I assumed I already created a symbolic link 'readme.md' which targets 'subdir/readme.md'. So I can't create another 'readme.md' there.

Here is my example repository: https://github.com/npcode/symlink-test

In the repository, '/hello.txt' is a symbolic link to subdir/hello.txt'. If you click the file in Github Code, Github shows you the contents of the symbolic link. I want that Github redirects it to 'subdir/hello.txt' instead, as Unix-like OS does.

@cassidyjames
Copy link

cassidyjames commented May 2, 2016

GitHub's current behavior is more similar to a Unix-like implementation; as far as the UI is concerned, hello.txt exists as a pointer to the contents of subdir/hello.txt. It doesn't redirect, as it shouldn't; it displays the file as if it existed at hello.txt.

@mcornella
Copy link

Perhaps the symbolic link could be rendered as a link to the target then, instead of a hard redirect.

@firegurafiku
Copy link

@npcode

My friends who click the old link I gave before moving the file will see 404 Not Found error.

That's exactly the reason why you should provide your friends with a link based on a specific revision, not on a moving HEAD. That means that instead of

https://github.com/dear-github/dear-github/blob/master/README.md

you should post your friends something like

https://github.com/dear-github/dear-github/blob/<COMMIT_HASH>/README.md

and expect them to be clever enough to find out a newer revision of the file if they need so.

wking added a commit to wking/openshift-enhancements that referenced this issue Aug 13, 2020
Move the previous operator-dev-doc down into this document as a
README, and drop a reference in the old location for backwards-compat
with existing linkers.  I'd prefer a symlink, but GitHub's tree
browser just renders the link path as an unclickable string [1].

In the spirit of 28c6ca7 (enhancements/update: Consolidate
update-related enhancements, 2020-08-05, openshift#422).

[1]: dear-github/dear-github#156 (comment)
@flyinprogrammer
Copy link

toml_highlight

it would also be nice if their text highlighting stopped using only the file name for guidance on how to highlight the file because for things like toml files, the symbolic link will be highlighted in red to indicate an error, which is just wrong.

@tejasvi
Copy link

tejasvi commented Jul 29, 2021

I not sure if this is the right issue but I wish github UI would redirect symlinks to the actual file (if it exists in the repository) instead of showing location in plain text.

@LordNoteworthy
Copy link

yeah +1 for this issue.

@icy
Copy link

icy commented Oct 26, 2022

Symbolic link can cause a loop. This is true on Linux system

$ ln -s a b
$ ln -s b a
$ cat a
cat: a: Too many levels of symbolic links

I think Github will never support this :)

@jszwedko
Copy link

Symbolic link can cause a loop. This is true on Linux system

$ ln -s a b
$ ln -s b a
$ cat a
cat: a: Too many levels of symbolic links

I think Github will never support this :)

I think Github could handle this in the same way that Linux does and abort after so many redirects (or cyclical redirects).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants