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

return abspath in read_git_file for submodule #675

Merged
merged 1 commit into from
Apr 10, 2017

Conversation

xieofxie
Copy link
Contributor

should return an absolute path if a relative path is in the .git file of a submodule

@@ -67,6 +67,9 @@ def read_git_file(path):
data = core.read(path).strip()
if data.startswith(header):
result = data[len(header):]
if result and not os.path.isabs(result):
path_folder = os.path.dirname(path)
result = os.path.join(path_folder, result)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'd only want to do this inside the same if data.startswith(header) block, since that's the only one which ever sets result, so this seems like it should be indented in two levels as a starting point.

Do you happen to have a reproduction recipe showing the problem? I'd like to test this on a test repo locally, maybe as a starting point for a test case.

The commit message should explain why we would want to return an absolute path rather than echoing what the code is already saying; it's better to say something that the code cannot.

The Ctrl+m amend mode in cola's commit editor can be used to revise the commit.

davvid added a commit to davvid/git-cola that referenced this pull request Apr 10, 2017
* xieofxie/fix-opensubmodule:
  return abspath in read_git_file for submodule

Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit to davvid/git-cola that referenced this pull request Apr 10, 2017
Related-to: git-cola#675
Signed-off-by: David Aguilar <davvid@gmail.com>
davvid added a commit to davvid/git-cola that referenced this pull request Apr 10, 2017
Related-to: git-cola#675
Signed-off-by: David Aguilar <davvid@gmail.com>
@davvid davvid merged commit df84117 into git-cola:master Apr 10, 2017
@xieofxie xieofxie deleted the fix-opensubmodule branch April 13, 2017 14:22
BarrettLowe pushed a commit to BarrettLowe/git-cola that referenced this pull request Apr 16, 2017
Related-to: git-cola#675
Signed-off-by: David Aguilar <davvid@gmail.com>
BarrettLowe pushed a commit to BarrettLowe/git-cola that referenced this pull request Apr 16, 2017
Related-to: git-cola#675
Signed-off-by: David Aguilar <davvid@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants