Coder Social home page Coder Social logo

Comments (6)

rmuslimov avatar rmuslimov commented on May 24, 2024

I don't think it is possible, since in standard flow (from editor to ui) we can call git commands to retrieve required information. In reverse flow information is not enough to locate file or even branch.

from browse-at-remote.

verhovsky avatar verhovsky commented on May 24, 2024

What do you mean? All the information is there, the file is at git checkout 1a9392e9d1fad4e1aafb25b68b4e6857fde8f564 (or there could be a branch name in that part of the URL, git checkout should just work) and the absolute file path is $(git rev-parse --show-toplevel)/browse-at-remote.el on line 39.

from browse-at-remote.

rmuslimov avatar rmuslimov commented on May 24, 2024

Can you please explain how git root path can be found from URL in clipboard?

from browse-at-remote.

verhovsky avatar verhovsky commented on May 24, 2024

Can you get the directory of the buffer where the "inverse browse-at-remote" command was called and then you do git rev-parse --show-toplevel in that directory and append everything after the blob name to it to get the path?

from browse-at-remote.

rmuslimov avatar rmuslimov commented on May 24, 2024

@verhovsky How to get right location of git root folder?

from browse-at-remote.

verhovsky avatar verhovsky commented on May 24, 2024

You can't get it from the URL. You would get it from the location of the buffer I have open in Emacs when I run the inverse command. Just as you do now for the regular browse-at-remote commands.

If I have repositories a and b and I try to open a URL that is from a remote of repo a while I'm looking at a file in repo b, then you'll get the root location of repo b, extract the relative path from the url and then try to look up a file path that doesn't exist (it might exist by coincidence sometimes) and show me an error message like "This file doesn't exist. You might've opened a link from the wrong repo: {link I tried to open}". This would also happen if the file was created on the remote but I don't have it (just as I get 404 errors now if I try to browse-at-remote a file that the remote doesn't have, or try to look at a file that was deleted on the remote).

Additionally, if the remote url I'm trying to open doesn't exist in the .git/config file of the repo that I'm running the command from, you can guess that I'm probably running the command from the wrong repo. But that's not necessarily the case, I might just not have a remote configured as a remote, so this check isn't really necessary. Could just help you improve the error message.

from browse-at-remote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.