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

Projects
None yet
3 participants
@shijinglu
Copy link
Collaborator

shijinglu commented Nov 9, 2018

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 /.
@bpeabody
Copy link
Contributor

bpeabody left a comment

Looks good!

Show resolved Hide resolved node/lib/util/submodule_util.js Outdated
@@ -38,7 +38,6 @@ const NodeGit = require("nodegit");

const Checkout = require("./checkout");
const CherryPickUtil = require("./cherry_pick_util");
const Commit = require("./commit");

This comment has been minimized.

@shijinglu

shijinglu Nov 9, 2018

Collaborator

removed according to jslint

@novalis

novalis approved these changes Nov 9, 2018

@shijinglu shijinglu merged commit 26f63d7 into twosigma:master Nov 10, 2018

1 check passed

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

@shijinglu shijinglu deleted the shijinglu:fix_rm_overmatch branch Nov 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment