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

Some fixes for action behavior #65

Merged
merged 2 commits into from Aug 25, 2019
Merged

Conversation

mhkeller
Copy link
Contributor

Per #38, this will now only stash files on your first clone. I'll walk through how this works with an example. The README should be more clear as well so if this seems like sound logic, I'll update that language in this PR.

You are using degit to initialize a repo that has three files:

degit.json
HELLO.md

Where degit.json looks like this:

[
  { action: 'clone', src: 'foo/bar' },
  { action: 'remove', files: [ 'baz.md' ] },
  { action: 'clone', src: 'bar/foo' },
]
  1. Download the repo
  2. Read in the degit.json file
  3. When it gets to the first clone action, stash the current working directories files – in this case HELLO.md and degit.json – and then do the clone. The current working directory now only contains the repo specified in this action, foo/bar
  4. If you have a remove action here, that proceeds normally on the currently working directory.
  5. If you have a second clone, that will be degited with --force and clobber any existing files in the working directory if their paths are the same.
  6. Since we're all done with our actions, unstash the original working directory, excluding the degit.json file, since we don't need it any more. In this example, that means bringing back HELLO.md, which will clobber any existing HELLO.md in the root folder.

The reason for stashing and unstashing is it's how you can add files on top of any repos you are cloning.

Does that make sense?

@YogliB
Copy link
Collaborator

YogliB commented Aug 25, 2019

Yeah, I think it makes sense.
Thanks for the clarification!

@YogliB YogliB merged commit 3b7760f into Rich-Harris:master Aug 25, 2019
@mhkeller mhkeller deleted the fix-actions branch August 25, 2019 23:39
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