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

"Edit" function in tree and diff view opens the wrong path under certain conditions in submodules #781

Closed
h3xx opened this issue Feb 12, 2018 · 3 comments

Comments

@h3xx
Copy link
Contributor

h3xx commented Feb 12, 2018

Part One

When the git repo you're viewing is cloned as a submodule, e opens the wrong file path for editing, but only if your working directory isn't the top directory of the submodule if that makes any sense.

Steps to reproduce:

  1. Run these shell lines:

    $ mkdir temp ; cd temp
    $ git init
    $ git submodule add https://github.com/jonas/tig.git
    $ cd tig/src
    $ tig

  2. Then in the resulting tig window, press enter on a commit, then use j/k to highlight a diff-stat line and press e. It will give the error "Failed to open file: ..."

Expected behavior: Open the file in $EDITOR from the highlighted line in the diff view.

Part Two

Likewise, pressing e on a file when in tree view results in the editor opening a non-existent file, but only sometimes. It seems to have to do with it being both a submodule, and trying to open a file using tree view two levels above the directory where you started tig.

Steps to reproduce, part 2:

$ mkdir temp ; cd temp
$ git init
$ git submodule add https://github.com/jonas/tig.git
$ cd tig/tests/graph
$ tig
  1. Press t to enter tree view, then press enter on .. twice, so you're at the top level for the submodule.
  2. Highlight a file in that directory like INSTALL.adoc and press e.

I find it will open temp/INSTALL.adoc which doesn't exist, instead of temp/tig/INSTALL.adoc.

Tested under 58aa1d4 running on Slackware Linux x86_64 with git-2.16.1.

@h3xx
Copy link
Contributor Author

h3xx commented Feb 13, 2018

See f99d2af for a test that proves it's an issue.

jonas added a commit that referenced this issue May 20, 2018
Add tests for simple use of submodules and worktrees together with
editors from subdirectories.

Closes #783
Closes #508
jonas added a commit that referenced this issue May 20, 2018
Add tests for simple use of submodules and worktrees together with
editors from subdirectories.

Closes #783
Closes #508
@h3xx
Copy link
Contributor Author

h3xx commented May 21, 2018

Confirmed fixed. Thanks!

@h3xx h3xx closed this as completed May 21, 2018
@jonas
Copy link
Owner

jonas commented May 21, 2018

Thanks for testing.

rolandwalker pushed a commit to rolandwalker/tig that referenced this issue May 21, 2018
Add tests for simple use of submodules and worktrees together with
editors from subdirectories.

Closes jonas#783
Closes jonas#508
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

2 participants