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

Fix git-meta rm path overmatching issue #687

Merged
merged 2 commits into from Nov 10, 2018

Conversation

shijinglu
Copy link
Collaborator

Currently running git meta rm -rf abc matches following directories which should not have:

abcd/
abcd/api
abcd/service
...

The issue is because getSubmodulesInPath in the submodule_utils.js has a bug: it thinks if x.startsWith(y) than x must be a subdirectory of y. This is not true as abcd/ef/ starts with abc, but it is not a subdirectory of the later.

I changed to logic to:

  1. If y has a trailing '/' then startsWith is sufficient
  2. Otherwise, removing prefix x from y, the rest of y should starts with a leading /.

Copy link
Contributor

@bpeabody bpeabody left a comment

Choose a reason for hiding this comment

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

Looks good!

@@ -38,7 +38,6 @@ const NodeGit = require("nodegit");

const Checkout = require("./checkout");
const CherryPickUtil = require("./cherry_pick_util");
const Commit = require("./commit");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed according to jslint

@shijinglu shijinglu merged commit 26f63d7 into twosigma:master Nov 10, 2018
@shijinglu shijinglu deleted the fix_rm_overmatch branch November 10, 2018 02:44
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

3 participants