-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default value for scmInfo #117
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,7 +117,18 @@ object SbtGit { | |
gitDescribedVersion := gitReader.value.withGit(_.describedVersion).map(v => git.gitTagToVersionNumber.value(v).getOrElse(v)), | ||
gitCurrentTags := gitReader.value.withGit(_.currentTags), | ||
gitCurrentBranch := Option(gitReader.value.withGit(_.branch)).getOrElse(""), | ||
gitUncommittedChanges in ThisBuild := gitReader.value.withGit(_.hasUncommittedChanges) | ||
gitUncommittedChanges in ThisBuild := gitReader.value.withGit(_.hasUncommittedChanges), | ||
scmInfo := { | ||
val remote = """origin[ \t]+git@([^:]*):(.*)\.git[ \t]+\(fetch\)""".r | ||
Process("git remote -v").lines_!.collect { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you just want the URL for origin There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, but it does not work for older versions of Git. I, for example, have 1.9.1 and the get-url subcommand is not available. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, then how about using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough. I made a commit to change this and also refactored the code a bit, because the regex started to look quite ugly. |
||
case remote(domain, repo) => | ||
ScmInfo( | ||
url(s"https://$domain/$repo"), | ||
s"scm:git:https://$domain/$repo.git", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the I would also suggest to leave out the Finally, avoiding to hard-code the supported URLs would be nice, but I don't know what the goal of the plugin is in terms of what Git workflows should be supported. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly it seems like this needs to be specified in this way to generate the pom properly. I couldn't make my Sonatype work otherwise. Regarding the supported URLs, I do agree, though this change is only meant to offer a sane default. Any special cases can still be set manually. |
||
Some(s"scm:git:git@$domain:$repo.git") | ||
) | ||
}.headOption | ||
} | ||
) | ||
val projectSettings = Seq( | ||
// Input task to run git commands directly. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to also support at least
http[s]://
andgit://
remotes? SSH remotes can also start withssh://
but I don't know if that is common.