Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
41,900
String (int percent) { int objects = 3178 * percent / 100; String speed = "4.18 MiB | 223 KiB/s"; return "Receiving objects: " + percent + "% (" + objects + "/3178), " + speed + doneStr(percent == 100); }
receivingObjects
41,901
String (int percent) { final int total = 1822; int objects = total * percent / 100; return "Resolving deltas: " + percent + "% (" + objects + "/" + total + ")" + doneStr(percent == 100); }
resolvingDeltas
41,902
String (boolean done) { return done ? ", done." : ""; }
doneStr
41,903
void () { fs("C:/Program Files/Git/bin/git.exe"); assertExecutable("C:/Program Files/Git/bin/git.exe"); }
Simple_case
41,904
void () { fs("C:/Program Files/Git/bin/git.exe", "C:/Program Files/Git 1.8/bin/git.exe", "C:/Program Files/Git_1.7.1/bin/git.exe"); assertExecutable("C:/Program Files/Git/bin/git.exe"); }
Prefer_default_Git_without_version_to_versioned_ones
41,905
void () { fs("C:/Program Files (x86)/Git 1.8/cmd/git.exe", "C:/Program Files/Git_1.7.1/bin/git.exe", "C:/Program Files/Git_1.7.5/cmd/git.exe", "C:/Program Files (x86)/Git_1.7.0.2/bin/git.exe"); assertExecutable("C:/Program Files (x86)/Git 1.8/cmd/git.exe"); }
Prefer_the_latest_version
41,906
void () { fs("C:/Program Files (x86)/Git 1.8/bin/git.exe", "C:/Program Files/Git 1.8/bin/git.exe"); assertExecutable("C:/Program Files/Git 1.8/bin/git.exe"); }
Prefer_Program_Files_over_x86
41,907
void () { fs("C:/Program Files (x86)/Git 1.8/bin/git.exe", "C:/Program Files/Git 1.8/cmd/git.exe"); assertExecutable("C:/Program Files/Git 1.8/cmd/git.exe"); }
Prefer_cmd_over_bin_in_newer_versions_of_Git
41,908
void () { fs("C:/Program Files (x86)/Git_1.8.0.2/cmd/git.exe", "C:/Program Files (x86)/Git_1.8.0.2/bin/git.exe", "C:/cygwin/bin/git.exe"); assertExecutable("C:/Program Files (x86)/Git_1.8.0.2/cmd/git.exe"); }
Prefer_msys_over_cygwin
41,909
void () { fs("C:/cygwin/bin/git.exe"); assertExecutable("C:/cygwin/bin/git.exe"); }
Only_cygwin
41,910
void () { fs("C:/Program Files (x86)/Git_1.7.0.2/bin/git.exe", "C:/Program Files (x86)/Git_1.7.0.2/cmd/git.exe", "C:/Program Files (x86)/Git_1.7.8/bin/git.exe", "C:/Program Files (x86)/Git_1.7.8/cmd/git.exe", "C:/Program Files (x86)/Git_1.8/bin/git.exe", "C:/Program Files (x86)/Git_1.8/cmd/git.exe", "C:/Program Files (...
Many_different_versions_real_case
41,911
void () { PATH = "D:/Program Files (x86)/Git_distr/cmd"; fs("D:/Program Files (x86)/Git_distr/cmd/git.exe"); assertExecutable("D:/Program Files (x86)/Git_distr/cmd/git.exe"); }
Find_Git_in_PATH
41,912
void () { PATH = "C:/Ruby193/bin;C:/Users/John.Doe/Documents/Git_1.8.0.2/bin"; fs("C:/Users/John.Doe/Documents/Git_1.8.0.2/bin/git.exe"); assertExecutable("C:/Users/John.Doe/Documents/Git_1.8.0.2/bin/git.exe"); }
Find_Git_in_PATH_not_on_the_first_place
41,913
void () { PATH = "%SystemRoot%/system32;%SystemRoot%;%SystemRoot%/System32/Wbem;%SYSTEMROOT%/System32/WindowsPowerShell/v1.0/;" + "C:/Program Files/Intel/DMIX;C:/Program Files/Mercurial/;C:/Program Files/TortoiseHg/;"; fs("C:/Program Files/Git/bin/git.exe"); assertExecutable("C:/Program Files/Git/bin/git.exe"); }
No_Git_in_PATH_then_look_in_Program_Files
41,914
void () { PATH = "C:/Ruby193/bin;C:/Users/John.Doe/Documents/Git_1.8.0.2/bin"; fs("C:/Program Files/Git/bin/git.exe", "C:/Users/John.Doe/Documents/Git_1.8.0.2/bin/git.exe"); assertExecutable("C:/Users/John.Doe/Documents/Git_1.8.0.2/bin/git.exe"); }
Prefer_PATH_to_Program_Files
41,915
void () { PATH = "C:/Ruby193/bin;D:/Git/cmd;C:/Users/John.Doe/Documents/Git_1.8.0.2/bin;"; fs("D:/Git/cmd/git.exe", "C:/Users/John.Doe/Documents/Git_1.8.0.2/bin/git.exe"); assertExecutable("D:/Git/cmd/git.exe"); }
Prefer_the_first_entry_from_the_PATH
41,916
void () { PATH = "C:/Ruby193/bin;D:/Git/cmd;"; fs("C:/Program Files/Git/bin/git.exe"); assertExecutable("C:/Program Files/Git/bin/git.exe"); }
Dont_use_Git_from_PATH_if_it_doesnt_exist_on_disk
41,917
void (String expected) { // we want to specify unix-like paths in "expected", because they are easier to write :) String detected = detect(); detected = convertBack(detected); Assert.assertEquals("Incorrect executable detected", expected, detected); }
assertExecutable
41,918
String (String detected) { detected = detected.replace(testRoot.getPath() + File.separator, "").replace("\\", "/"); detected = returnDiskColon(detected); return detected; }
convertBack
41,919
void (String... paths) { for (String path : paths) { mkPath(path); } }
fs
41,920
boolean (String path) { File file = new File(convertPath(path)); file.getParentFile().mkdirs(); try { return file.createNewFile(); } catch (IOException e) { throw new RuntimeException(e); } }
mkPath
41,921
String (@NotNull String path) { path = FileUtil.toSystemDependentName(replaceDiskColon(path)); return testRoot.getPath() + File.separator + path; }
convertPath
41,922
String (String path) { if (OSAgnosticPathUtil.startsWithWindowsDrive(path)) { return path.charAt(0) + "_" + path.substring(2); } return path; }
replaceDiskColon
41,923
String (String path) { if (path.charAt(1) == '_') { return path.charAt(0) + ":" + path.substring(2); } return path; }
returnDiskColon
41,924
String () { return new GitExecutableDetector() { private final File TEST_WIN_ROOT = new File(testRoot, "C_"); @NotNull @Override protected File getWinRoot() { return TEST_WIN_ROOT; } @Override protected String getPathEnv() { return StringUtil.join(PATH.split(";"), s -> convertPath(s), ";"); } }.detect(null); }
detect
41,925
File () { return TEST_WIN_ROOT; }
getWinRoot
41,926
String () { return StringUtil.join(PATH.split(";"), s -> convertPath(s), ";"); }
getPathEnv
41,927
Object[][] () { return new Object[][] { { "WORD", "branch" }, { "UNDERSCORED_WORD", "new_branch" }, { "HIERARCHY", "user/branch" }, { "HIERARCHY_2", "user/branch/sub_branch" }, { "NON_CONS_DOTS", "complex.branch.name" }, { "GERRIT_PATTERN", "refs/for/master%topic=my-cool-feature,r=some-reviewer"}, { "CONTAINS_MINUS", "...
createValidData
41,928
Object[][] () { return new Object[][] { { "BEGIN_WITH_DOT", ".branch" }, { "BEGINS_WITH_SLASH", "/branch" }, { "ONLY_DOT", "." }, { "ENDS_WITH_SLASH", "branch/" }, { "ENDS_WITH_DOT", "branch." }, { "ENDS_WITH_LOCK", "branch.lock" }, { "TWO_DOTS_1", "branch..name" }, { "TWO_DOTS_2", "..name" }, { "TWO_DOTS_3", "..branch...
createInvalidData
41,929
Object[][] () { return populateWithIllegalChars(ILLEGAL_CHARS, s -> s); }
createInvalidCharsData
41,930
Object[][] () { return populateWithIllegalChars(CONTROL_CHARS, s -> "\\u00" + Integer.toHexString(s.charAt(0))); }
createInvalidControlCharsData
41,931
Object[][] (String[] illegalChars, Function<String, String> toString) { Object[][] data = new Object[illegalChars.length][]; for (int i = 0; i < illegalChars.length; i++) { data[i] = new Object[]{ toString.fun(illegalChars[i]), "bra" + illegalChars[i] + "nch" }; } return data; }
populateWithIllegalChars
41,932
Collection<Object[]> () { Collection<Object[]> data = new ArrayList<>(); populateData(data, createValidData(), true); populateData(data, createInvalidData(), false); populateData(data, createInvalidCharsData(), false); populateData(data, createInvalidControlCharsData(), false); return data; }
data
41,933
void (Collection<Object[]> data, Object[][] source, boolean valid) { for (Object[] testCase : source) { data.add(new Object[] {testCase[0], testCase[1], valid}); } }
populateData
41,934
void () { if (myIsExpectedValid) { assertValid(myRefNameToTest); } else { assertInvalid(myRefNameToTest); } }
testAll
41,935
void (String branchName) { assertTrue("Should be valid", GitRefNameValidator.getInstance().checkInput(branchName)); assertTrue("Should be valid", GitRefNameValidator.getInstance().canClose(branchName)); }
assertValid
41,936
void (String branchName) { assertFalse("Should be invalid", GitRefNameValidator.getInstance().checkInput(branchName)); assertFalse("Should be invalid", GitRefNameValidator.getInstance().canClose(branchName)); }
assertInvalid
41,937
void () { check("origin/139", given("origin/139", "139")); }
test_tracked_remote_branch_is_more_important_than_its_local_branch
41,938
void () { check("origin/139", given("feature", "origin/139", "139")); }
test_tracked_remote_branch_is_more_important_than_any_local_branch
41,939
void () { check("origin/139", given("feature", "origin/139")); }
test_untracked_remote_branch_is_more_important_than_any_local_branch
41,940
void () { check("master", given("feature", "master")); }
test_master_is_more_important_than_other_local_branches
41,941
void () { check("origin/master", given("origin/139", "master", "139", "origin/master", "origin/135")); }
test_origin_master_is_more_important_than_other_remote_branches
41,942
void () { check("feature", given("refs/tags/v1", "feature", "refs/tags/v2")); }
test_local_branch_is_more_important_than_tag
41,943
void () { check("feature", given("zoo", "feature")); }
test_two_local_non_tracking_branches_are_compared_lexicographically
41,944
void () { Collection<VcsRef> refs = given("zoo", "origin/zoo", "feature"); refs = ContainerUtil.filter(refs, ref -> !ref.getName().equals("origin/zoo")); assertEquals("feature", getTheMostPowerfulRef(refs).getName()); }
test_tracked_local_branch_is_not_special
41,945
void () { check("origin/feature", given("origin/feature", "origin/zoo", "zoo")); }
test_remote_branches_are_compared_lexicographically
41,946
void () { check("feature", given("feature", "HEAD")); }
test_local_branch_is_more_important_than_HEAD
41,947
void () { check("refs/tags/v1", given("refs/tags/v1", "HEAD")); }
test_tag_is_more_important_than_HEAD
41,948
void (@NotNull String expectedBest, @NotNull Collection<? extends VcsRef> givenBranches) { VcsRef actualBest = getTheMostPowerfulRef(givenBranches); assertEquals(expect(expectedBest).get(0), actualBest); }
check
41,949
VcsRef (@NotNull Collection<? extends VcsRef> givenBranches) { Comparator<VcsRef> comparator = new GitRefManager(myProject, repositoryManager).getBranchLayoutComparator(); return ContainerUtil.sorted(givenBranches, comparator).get(0); }
getTheMostPowerfulRef
41,950
void () { check(Collections.emptyList(), Collections.emptyList()); }
testEmpty
41,951
void () { check(given("HEAD"), expect("HEAD")); }
testSingle
41,952
void () { check(given("master", "HEAD"), expect("HEAD", "master")); }
test_HEAD_is_at_left_from_branch
41,953
void () { check(given("release", "feature"), expect("feature", "release")); }
testLocalBranchesAreComparedAsStrings
41,954
void () { check(given("refs/tags/v1", "origin/master"), expect("origin/master", "refs/tags/v1")); }
test_tag_is_to_the_right_of_remote_branch
41,955
void () { check(given("feature", "master"), expect("master", "feature")); }
test_master_is_to_the_left_of_other_local_branches
41,956
void () { check(given("origin/master", "origin/aaa"), expect("origin/master", "origin/aaa")); }
test_origin_master_is_to_the_left_of_other_remote_branches
41,957
void () { check(given("feature", "origin/aaa", "origin/feature"), expect("feature", "origin/aaa", "origin/feature")); }
test_remote_tracking_branch_is_not_special
41,958
void () { check(given("refs/tags/v1", "feature", "HEAD", "master"), expect("HEAD", "master", "feature", "refs/tags/v1")); }
test_complex_1
41,959
void () { check(given("origin/master", "origin/great_feature", "refs/tags/v1", "release", "HEAD", "master"), expect("HEAD", "master", "origin/master", "release", "origin/great_feature", "refs/tags/v1")); }
test_complex_2
41,960
void () { check(given("master", "master"), expect("master", "master")); }
testTwoMasters
41,961
void () { git("checkout -b zzz"); check(given("xxx", "zzz", "yyy"), expect("zzz", "xxx", "yyy")); }
test_current_branch_first
41,962
void (Collection<? extends VcsRef> unsorted, List<? extends VcsRef> expected) { // for the sake of simplicity we check only names of references List<VcsRef> actual = sort(unsorted); assertEquals("Collections size don't match", expected.size(), actual.size()); for (int i = 0; i < actual.size(); i++) { assertEquals("Inco...
check
41,963
List<VcsRef> (@NotNull final Collection<? extends VcsRef> refs) { return ContainerUtil.sorted(refs, new GitRefManager(myProject, repositoryManager).getLabelsOrderComparator()); }
sort
41,964
void () { check(given("HEAD", "master", "origin/master"), Arrays.asList("HEAD"), Pair.create("Local", Arrays.asList("master")), Pair.create("origin/...", Arrays.asList("origin/master"))); }
test_single_tracked_branch
41,965
void () { check(given("HEAD", "master"), Arrays.asList("HEAD"), Pair.create("Local", Arrays.asList("master"))); }
test_single_local_branch
41,966
void () { check(given("HEAD", "master", "origin/master", "origin/remote_branch", "local_branch"), Arrays.asList("HEAD"), Pair.create("Local", Arrays.asList("master", "local_branch")), Pair.create("origin/...", Arrays.asList("origin/master", "origin/remote_branch"))); }
test_local_tracked_and_remote_branch
41,967
void (@NotNull Collection<? extends VcsRef> actual, @NotNull List<String> expectedSingleGroups, Pair<String, List<String>>... expectedOtherGroups) { List<RefGroup> actualGroups = new GitRefManager(getProject(), repositoryManager).groupForBranchFilter(actual); List<SingletonRefGroup> singleGroups = ContainerUtil.findAll...
check
41,968
void () { super.setUp(); myVcsLogUserFilterTest = new VcsLogUserFilterTest(GitTestUtil.findGitLogProvider(myProject), myProject) { @Override @NotNull protected String commit(@NotNull VcsUser user) { return makeCommit(GitUserFilterTest.this, user, "file.txt"); } }; }
setUp
41,969
String (@NotNull VcsUser user) { return makeCommit(GitUserFilterTest.this, user, "file.txt"); }
commit
41,970
void () { Assume.assumeTrue("Not testing: filtering by several users does not work on mac os with git prior to 1.7.4", LOG_AUTHOR_FILTER_SUPPORTS_VERTICAL_BAR.existsIn(vcs.getVersion()) || vcs.getVersion().isLaterOrEqual(LOG_AUTHOR_FILTER_SUPPORTS_MULTIPLE_AUTHORS)); }
assumeMultipleUserFiltersWork
41,971
void () { myVcsLogUserFilterTest = null; super.tearDown(); }
tearDown
41,972
void () { super.setUp(); myLogProvider = GitTestUtil.findGitLogProvider(myProject); myObjectsFactory = myProject.getService(VcsLogObjectsFactory.class); }
setUp
41,973
void () { VcsUser user = myLogProvider.getCurrentUser(getProjectRoot()); assertNotNull("User is not defined", user); VcsUser expected = getDefaultUser(); assertEquals("User name is incorrect", expected.getName(), user.getName()); assertEquals("User email is incorrect", expected.getEmail(), user.getEmail()); }
test_get_current_user
41,974
void () { assumeTrue("Not testing: --regexp-ignore-case does not affect grep" + " or author filter when --fixed-strings parameter is specified prior to 1.8.0", vcs.getVersion().isLaterOrEqual(FIXED_STRINGS_WORKS_WITH_IGNORE_CASE)); }
assumeFixedStringsWorks
41,975
List<String> (boolean takeAllUsers, boolean allBranches) { List<String> hashes = new ArrayList<>(); hashes.add(last(repo)); GitTestUtil.setupUsername(myProject, "bob.smith", "bob.smith@example.com"); if (takeAllUsers) { String commitByBob = tac(repo, "file.txt"); hashes.add(commitByBob); } GitTestUtil.setupDefaultUsern...
generateHistoryForFilters
41,976
void () { tac(repo, "a.txt"); git("tag ATAG"); tac(repo, "b.txt"); }
prepareSomeHistory
41,977
void (int size) { for (int i = 0; i < size; i++) { String file = "a" + (i % 10) + ".txt"; if (i < 10) { tac(repo, file); } else { modify(repo, file); } } }
prepareLongHistory
41,978
void () { String hash = last(repo); tac(repo, "c.txt"); tac(repo, "d.txt"); tac(repo, "e.txt"); git("tag poor-tag"); git("reset --hard " + hash); }
createTaggedBranch
41,979
VcsUser () { return new VcsUserImpl(GitTestUtil.USER_NAME, GitTestUtil.USER_EMAIL); }
getDefaultUser
41,980
List<VcsCommitMetadata> () { String output = git("log --all --date-order --full-history --sparse --pretty='%H|%P|%ct|%s|%B'"); final VcsUser defaultUser = getDefaultUser(); final Function<String, Hash> TO_HASH = s -> HashImpl.build(s); return ContainerUtil.map(StringUtil.splitByLines(output), record -> { String[] items...
log
41,981
Collection<VcsRef> (String @NotNull ... refs) { Collection<VcsRef> result = new ArrayList<>(); cd(getProjectRoot()); Hash hash = HashImpl.build(git("rev-parse HEAD")); for (String refName : refs) { if (isHead(refName)) { result.add(ref(hash, "HEAD", GitRefManager.HEAD)); } else if (isRemoteBranch(refName)) { git("updat...
given
41,982
List<VcsRef> (String @NotNull ... refNames) { final Set<VcsRef> refs = GitTestUtil.readAllRefs(this, getProjectRoot(), myProject.getService(VcsLogObjectsFactory.class)); return ContainerUtil.map(refNames, refName -> { VcsRef item = ContainerUtil.find(refs, ref -> ref.getName().equals(GitBranchUtil.stripRefsPrefix(refNa...
expect
41,983
boolean (String name) { return name.equals("HEAD"); }
isHead
41,984
boolean (String name) { return name.startsWith("refs/tags/"); }
isTag
41,985
boolean (String name) { return name.startsWith("origin/"); }
isRemoteBranch
41,986
VcsRef (Hash hash, String name, VcsRefType type) { return new VcsRefImpl(hash, name, type, getProjectRoot()); }
ref
41,987
void (@NotNull Collection<? extends VcsRef> refs) { cd(getProjectRoot()); for (final VcsRef ref : refs) { if (ref.getType() == GitRefManager.LOCAL_BRANCH) { final String localBranch = ref.getName(); if (ContainerUtil.exists(refs, remoteRef -> remoteRef.getType() == GitRefManager.REMOTE_BRANCH && remoteRef.getName().rep...
setUpTracking
41,988
void () { super.setUp(); git("config core.autocrlf false"); }
setUp
41,989
GitCrlfProblemsDetector (VirtualFile file) { return GitCrlfProblemsDetector.detect(myProject, git, Collections.singleton(file)); }
detect
41,990
void () { ourProject = null; super.tearDown(); }
tearDown
41,991
void () { GitPushResultNotification notification = notification(singleResult(SUCCESS, "master", "origin/master", 1)); assertPushNotification(NotificationType.INFORMATION, "Pushed 1 commit to origin/master", "", notification); }
test_single_success
41,992
void () { GitPushResultNotification notification = notification(singleResult(NEW_REF, "feature", "origin/feature", -1)); assertPushNotification(NotificationType.INFORMATION, "Pushed feature to new branch origin/feature", "", notification); }
test_pushed_new_branch
41,993
void () { GitPushResultNotification notification = notification(singleResult(FORCED_UPDATE, "feature", "origin/feature", -1)); assertPushNotification(NotificationType.INFORMATION, "Force pushed feature to origin/feature", "", notification); }
test_force_pushed
41,994
void () { GitPushResultNotification notification = notification(new HashMap<>() {{ put(repo("ultimate"), repoResult(SUCCESS, "master", "origin/master", 1)); put(repo("community"), repoResult(ERROR, "master", "origin/master", "Permission denied")); }}); assertPushNotification(NotificationType.ERROR, "Push partially fail...
test_success_and_fail
41,995
void () { GitPushResultNotification notification = notification(new HashMap<>() {{ put(repo("ultimate"), repoResult(SUCCESS, "master", "origin/master", 1)); put(repo("community"), repoResult(REJECTED, "master", "origin/master", -1)); }}); assertPushNotification(NotificationType.WARNING, "Push partially rejected", "ulti...
test_success_and_reject
41,996
void () { GitPushResultNotification notification = notification(singleResult(SUCCESS, "master", "origin/master", 2, GitUpdateResult.SUCCESS)); assertPushNotification(NotificationType.INFORMATION, "Pushed 2 commits to origin/master", "", notification); }
test_success_with_update
41,997
void () { GitPushResultNotification notification = notification(new HashMap<>() {{ put(repo("community"), repoResult(REJECTED, "master", "origin/master", -1, GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS)); put(repo("contrib"), repoResult(REJECTED, "master", "origin/master", -1, GitUpdateResult.SUCCESS_WITH_RESOLVED_...
test_success_and_resolved_conflicts
41,998
void () { GitPushNativeResult branchResult = new GitPushNativeResult(SUCCESS, "refs/heads/master"); GitPushNativeResult tagResult = new GitPushNativeResult(NEW_REF, "refs/tags/v0.1"); GitPushResultNotification notification = notification(convertFromNative(branchResult, singletonList(tagResult), 1, from("master"), to("o...
test_commits_and_tags
41,999
void () { GitPushNativeResult branchResult = new GitPushNativeResult(UP_TO_DATE, "refs/heads/master"); GitPushResultNotification notification = notification(convertFromNative(branchResult, Collections.emptyList(), 0, from("master"), to("origin/master"))); assertPushNotification(NotificationType.INFORMATION, "Everything...
test_nothing