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

Support a mirror consisting of a single file #64

Closed
mattmccutchen opened this issue Jun 6, 2017 · 1 comment
Closed

Support a mirror consisting of a single file #64

mattmccutchen opened this issue Jun 6, 2017 · 1 comment
Assignees

Comments

@mattmccutchen
Copy link
Collaborator

mattmccutchen commented Jun 6, 2017

If the remote path for a mirror points to a single file, Braid should create a mirror consisting of the single file at the specified local path.

The use case that came up for me today: applying a gitignore file from https://github.com/github/gitignore to one's own repository. (The GitHub new repository wizard has an option to copy the gitignore file. The coup would be if I can get GitHub to add a checkbox to create .braids.json; it would be a great way to advertise a tool that I think a lot more people could benefit from using.)

This is mostly a matter of changing all the spots in the code that assume that Mirror::versioned_path returns a tree to also handle blobs. (Arguably, it's unfortunate that this is a special case at all, but that's beside the point.) The only interesting issue I see is what filenames braid diff should output. The current code that calls git diff --relative=MIRROR_PATH produces just a/ and b/, which makes sense in a way but might break tools. It's probably reasonable to use the basename of the file, but the upstream or downstream basename? They might differ, as in the gitignore use case above. [Thoughts, @realityforge?] Edit: My proposal: use a/UPSTREAM_NAME and b/DOWNSTREAM_NAME.

@mattmccutchen mattmccutchen self-assigned this Jun 6, 2017
mattmccutchen added a commit to mattmccutchen/braid that referenced this issue Jun 7, 2017
Fixes cristibalan#64.

- Remove the non-integration tests of Mirror::diff.  I've removed the
  line of code they were testing, and I don't think it's worth writing
  new ones; we can rely on the integration tests.
mattmccutchen added a commit to mattmccutchen/braid that referenced this issue Jun 7, 2017
Fixes cristibalan#64.

- Remove the non-integration tests of Mirror::diff.  I've removed the
  line of code they were testing, and I don't think it's worth writing
  new ones; we can rely on the integration tests.
mattmccutchen added a commit to mattmccutchen/braid that referenced this issue Jun 7, 2017
Fixes cristibalan#64.

- Remove the non-integration tests of Mirror::diff.  I've removed the
  line of code they were testing, and I don't think it's worth writing
  new ones; we can rely on the integration tests.
@realityforge
Copy link
Collaborator

Seems fairly reasonable to me. It seems like something that could get broken a long the way if we don't have have good test coverage but as long as we have that then I think we are good.

mattmccutchen added a commit to mattmccutchen/braid that referenced this issue Jan 1, 2018
update".

This is in preparation for supporting single-file mirrors, which will
have a different data structure in place of the tree ID.

- The check if the mirror is already up to date: I believe the change
  makes no difference because the only way to get here with switching ==
  false and was_locked == true is if the old and new upstream revision
  are equal (it's not enough if they have equal content at the remote
  path).  I'd like to clean up this code, but that becomes an invasive
  change that I don't want to block cristibalan#64 and cristibalan#66 on.
- The label in conflict markup: This seems to make sense.
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