From 27b05c7d719754427a97c141b44bec7de3acb8db Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 23 Mar 2017 18:20:08 +0100 Subject: [PATCH] Consistently use 'path' for the path to a subrepo in RepoCommand Signed-off-by: Han-Wen Nienhuys Change-Id: I79ea7eb7b4d319e0100e3121aca5ef82eb8ad92a --- .../org/eclipse/jgit/gitrepo/RepoCommand.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index dd68f60108..31dd51b4fc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -96,8 +96,8 @@ import org.eclipse.jgit.util.FileUtils; * If called against a bare repository, it will replace all the existing content * of the repository with the contents populated from the manifest. * - * repo manifest allows projects overlapping, e.g. one project's path is - * "foo" and another project's path is "foo/bar". This won't + * repo manifest allows projects overlapping, e.g. one project's manifestPath is + * "foo" and another project's manifestPath is "foo/bar". This won't * work in git submodule, so we'll skip all the sub projects * ("foo/bar" in the example) while converting. * @@ -105,7 +105,7 @@ import org.eclipse.jgit.util.FileUtils; * @since 3.4 */ public class RepoCommand extends GitCommand { - private String path; + private String manifestPath; private String uri; private String groupsParam; private String branch; @@ -244,7 +244,7 @@ public class RepoCommand extends GitCommand { * @return this command */ public RepoCommand setPath(String path) { - this.path = path; + this.manifestPath = path; return this; } @@ -452,11 +452,11 @@ public class RepoCommand extends GitCommand { throw new IllegalArgumentException( JGitText.get().uriNotConfigured); if (inputStream == null) { - if (path == null || path.length() == 0) + if (manifestPath == null || manifestPath.length() == 0) throw new IllegalArgumentException( JGitText.get().pathNotConfigured); try { - inputStream = new FileInputStream(path); + inputStream = new FileInputStream(manifestPath); } catch (IOException e) { throw new IllegalArgumentException( JGitText.get().pathNotConfigured); @@ -473,7 +473,7 @@ public class RepoCommand extends GitCommand { git = new Git(repo); ManifestParser parser = new ManifestParser( - includedReader, path, branch, uri, groupsParam, repo); + includedReader, manifestPath, branch, uri, groupsParam, repo); try { parser.read(inputStream); for (RepoProject proj : parser.getFilteredProjects()) { @@ -504,7 +504,7 @@ public class RepoCommand extends GitCommand { Config cfg = new Config(); StringBuilder attributes = new StringBuilder(); for (RepoProject proj : bareProjects) { - String name = proj.getPath(); + String path = proj.getPath(); String nameUri = proj.getName(); ObjectId objectId; if (ObjectId.isId(proj.getRevision()) @@ -520,7 +520,7 @@ public class RepoCommand extends GitCommand { } if (recordRemoteBranch) { // can be branch or tag - cfg.setString("submodule", name, "branch", //$NON-NLS-1$ //$NON-NLS-2$ + cfg.setString("submodule", path, "branch", //$NON-NLS-1$ //$NON-NLS-2$ proj.getRevision()); } @@ -530,14 +530,14 @@ public class RepoCommand extends GitCommand { // depth in the 'clone-depth' field, while // git core only uses a binary 'shallow = true/false' // hint, we'll map any depth to 'shallow = true' - cfg.setBoolean("submodule", name, "shallow", //$NON-NLS-1$ //$NON-NLS-2$ + cfg.setBoolean("submodule", path, "shallow", //$NON-NLS-1$ //$NON-NLS-2$ true); } } if (recordSubmoduleLabels) { StringBuilder rec = new StringBuilder(); rec.append("/"); //$NON-NLS-1$ - rec.append(name); + rec.append(path); for (String group : proj.getGroups()) { rec.append(" "); //$NON-NLS-1$ rec.append(group); @@ -545,11 +545,11 @@ public class RepoCommand extends GitCommand { rec.append("\n"); //$NON-NLS-1$ attributes.append(rec.toString()); } - cfg.setString("submodule", name, "path", name); //$NON-NLS-1$ //$NON-NLS-2$ - cfg.setString("submodule", name, "url", nameUri); //$NON-NLS-1$ //$NON-NLS-2$ + cfg.setString("submodule", path, "path", path); //$NON-NLS-1$ //$NON-NLS-2$ + cfg.setString("submodule", path, "url", nameUri); //$NON-NLS-1$ //$NON-NLS-2$ // create gitlink - DirCacheEntry dcEntry = new DirCacheEntry(name); + DirCacheEntry dcEntry = new DirCacheEntry(path); dcEntry.setObjectId(objectId); dcEntry.setFileMode(FileMode.GITLINK); builder.add(dcEntry); @@ -636,17 +636,17 @@ public class RepoCommand extends GitCommand { } } - private void addSubmodule(String url, String name, String revision, + private void addSubmodule(String url, String path, String revision, List copyfiles, Set groups, String recommendShallow) throws GitAPIException, IOException { if (repo.isBare()) { - RepoProject proj = new RepoProject(url, name, revision, null, groups, recommendShallow); + RepoProject proj = new RepoProject(url, path, revision, null, groups, recommendShallow); proj.addCopyFiles(copyfiles); bareProjects.add(proj); } else { SubmoduleAddCommand add = git .submoduleAdd() - .setPath(name) + .setPath(path) .setURI(url); if (monitor != null) add.setProgressMonitor(monitor); @@ -658,7 +658,7 @@ public class RepoCommand extends GitCommand { .call(); } subRepo.close(); - git.add().addFilepattern(name).call(); + git.add().addFilepattern(path).call(); } for (CopyFile copyfile : copyfiles) { copyfile.copy(); -- 2.39.5