Skip to content

git_submodule_lookup should allow backslashes #1845

Description

@Yogu

This issue is related to libgit2sharp; however, I think it is located in libgit2.

If you have a submodule in a subdirectory, e.g. "modules\themodule" and use Windows, git_status_foreach returns the path with a backslash.

If you then want to stage the change, you (at least libgit2sharp does it that way) lookup the submodule (git_submodule_lookup) path and stage it (git_submodule_add_to_index).

Now the problem is that git_submodule_lookup returns null because the path contains a backslash instead of a slash.

I see three possibilities:

  • Change git_status_foreach so that it returns submodule changes with slashes (makes it inconsistent with file changes)
  • Change git_submodule_lookup, so that it replaces backslashes with slashes
  • Replace backslashes with slashes on your own (e.g. in libgit2sharp)

The first one is rubbish. I think we should go with the second possibility because it is not intrusive and makes the function more robust.

If you don't aggree on this, I hand over this issue to libgit2sharp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions