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

Projects
None yet
2 participants
@xieofxie

xieofxie commented Mar 25, 2017

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)

This comment has been minimized.

@davvid

davvid Apr 2, 2017

Member

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

davvid Apr 2, 2017

Member

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

Merge pull request git-cola#675 from xieofxie/fix-opensubmodule
* 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

git: indent abspath handling
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

git: normalize paths returned by read_git_file()
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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@xieofxie xieofxie deleted the xieofxie:fix-opensubmodule branch Apr 13, 2017

BarrettLowe added a commit to BarrettLowe/git-cola that referenced this pull request Apr 16, 2017

git: indent abspath handling
Related-to: git-cola#675
Signed-off-by: David Aguilar <davvid@gmail.com>

BarrettLowe added a commit to BarrettLowe/git-cola that referenced this pull request Apr 16, 2017

git: normalize paths returned by read_git_file()
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