Skip to content

Commit

Permalink
Remove the hasCheckout check
Browse files Browse the repository at this point in the history
  • Loading branch information
merks committed Jan 29, 2024
1 parent edb623a commit 152a741
Showing 1 changed file with 1 addition and 13 deletions.
Expand Up @@ -864,19 +864,13 @@ public boolean isNeeded(final SetupTaskContext context) throws Exception
String checkoutBranch = getCheckoutBranch();
String remoteName = getRemoteName();
String pushURI = getPushURI();
boolean hasCheckout = hasCheckout(repository, checkoutBranch);

Map<String, GitConfigurationTask> configurations = new LinkedHashMap<>();
boolean changed = configureRepository(context, configurations, true, repository, false, isRecursive(), false, checkoutBranch,
isRestrictToCheckoutBranch(), remoteName, remoteURI, pushURI, getConfigSections(), getGerritPatterns(context));

getConfigurations().addAll(configurations.values());

if (!hasCheckout)
{
return true;
}

bypassCloning = true;

// Even though cloning isn't needed, return true if the repository needs to be configured or added to the repositories view.
Expand Down Expand Up @@ -921,7 +915,6 @@ private static void perform(SetupTaskContext context, IProgressMonitor monitor,
MonitorUtil.create(monitor, 50));)
{
Repository repository = git.getRepository();
boolean hasCheckout = hasCheckout(repository, checkoutBranch);
Set<String> gerritPatterns = getGerritPatterns(context);

configureRepository(context, null, root, repository, true, isRecursive, !bypassCloning, checkoutBranch, isRestrictToCheckoutBranch, remoteName,
Expand All @@ -933,7 +926,7 @@ private static void perform(SetupTaskContext context, IProgressMonitor monitor,
// because then we can't determine what's wrong with the current state.
workDirExisted = true;

if (!bypassCloning || !hasCheckout)
if (!bypassCloning)
{
Ref branchRef = findRef(repository, Constants.R_REMOTES + remoteName + "/" + checkoutBranch); //$NON-NLS-1$
Ref tagRef = findRef(repository, Constants.R_TAGS + checkoutBranch);
Expand Down Expand Up @@ -1671,11 +1664,6 @@ private static boolean hasWorkTree(Git git) throws Exception
}
}

private static boolean hasCheckout(Repository repository, String checkoutBranch) throws IOException
{
return findRef(repository, Constants.R_HEADS + checkoutBranch) != null;
}

@Deprecated
private static final Ref findRef(Repository repository, String name) throws IOException
{
Expand Down

0 comments on commit 152a741

Please sign in to comment.