Skip to content

Changed ref type to GitReferenceType#72

Merged
BarabanovVVl merged 2 commits intomasterfrom
MOB-46674
Mar 6, 2025
Merged

Changed ref type to GitReferenceType#72
BarabanovVVl merged 2 commits intomasterfrom
MOB-46674

Conversation

@BarabanovVVl
Copy link
Copy Markdown
Collaborator

Fixed cloning of the specified branch

Comment on lines +19 to +27
var nameValue: String {
switch self {
case .tag(let name), .branch(let name):
return name

case .commit(let sha):
return sha
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Кажется, это не особо нужно

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

И то правда

Comment on lines +37 to +46
switch ref {
case .tag, .branch:
try shell("git clone --depth 1 -b \(ref.nameValue) \(gitRepositoryURL) \(repositoryPath)")

Log.debug("Checking out \(ref) branch...")
try shell("cd \(repositoryPath) && git checkout \(ref)")
case .commit:
try shell("git clone \(gitRepositoryURL) \(repositoryPath)")

Log.debug("Checking out \(ref.nameValue) branch...")
try shell("cd \(repositoryPath) && git checkout \(ref.nameValue)")
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Потому что здесь можно сразу получить и так значения:

switch ref {
case .tag(let name), .branch(let name):
    try shell("git clone --depth 1 --branch \(name) \(gitRepositoryURL) \(repositoryPath)")

case .commit(let sha):
    try shell("git clone \(gitRepositoryURL) \(repositoryPath)")

    Log.debug("Checking out to \(sha) commit...")
    try shell("cd \(repositoryPath) && git checkout \(sha)")
}

@BarabanovVVl BarabanovVVl requested a review from timbaev March 6, 2025 10:24
@BarabanovVVl BarabanovVVl merged commit 620f91f into master Mar 6, 2025
1 check passed
@BarabanovVVl BarabanovVVl deleted the MOB-46674 branch March 6, 2025 10:46
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.

2 participants