forked from dropbox/AffectedModuleDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added SpecifiedBranchCommit with git-merge command
- Loading branch information
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...in/kotlin/com/dropbox/affectedmoduledetector/commitshaproviders/SpecifiedBranchCommit2.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.dropbox.affectedmoduledetector.commitshaproviders | ||
|
||
import com.dropbox.affectedmoduledetector.GitClient | ||
import com.dropbox.affectedmoduledetector.Sha | ||
|
||
class SpecifiedBranchCommit2(private val branch: String) : CommitShaProvider { | ||
|
||
override fun get(commandRunner: GitClient.CommandRunner): Sha { | ||
val currentBranch = commandRunner.executeAndParseFirst(CURRENT_BRANCH_CMD) | ||
return commandRunner.executeAndParseFirst("git merge-base $currentBranch $branch") | ||
} | ||
|
||
companion object { | ||
|
||
const val CURRENT_BRANCH_CMD = "git rev-parse --abbrev-ref HEAD" | ||
} | ||
} |