-
Notifications
You must be signed in to change notification settings - Fork 79
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
dh-make-golang make: directly use the user preferred tag specified in "-git_revision" option #227
base: master
Are you sure you want to change the base?
Conversation
… "-git_revision" option When a user specifies a valid tag when using dh-make-golang make -git_revision {some valid tag} if there is another tag pointing to the same commit as the specified tag, then dh-make-golang might use the other tag to determine the package version. This patch modifies the behavior of "dh-make-golang make" such that, if the user specifies a valid tag in "-git_revision" option, "dh-make-golang make" will always use the specified tag to determine the upstream package version. This patch also trivially changes the tests written in version_test.go so that the tests adjusts to the new function signature of version.go:pkgVersionFromGit(). Signed-off-by: William Lyu <William.Lyu@windriver.com>
This patch attempts to fix #226 . |
goto FoundLatestTag | ||
} | ||
} | ||
|
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.
These are some comments regarding why I use a goto
statement. Please let me know if there are better alternatives.
I want to use the git describe
heuristics as a fallback in case I cannot verify if the user specified git revision is valid or not.
The logic I want to implement is:
if (u.rr is valid (which makes u.rr.VCS.Tags meaningful) and the user specified tag exists as a valid tag) {
set the latest tag to this user specified tag
} else {
the fallback heuristics
}
However, to implement the "if" part of the above pseudocode, I cannot find a way to implement it as a single if clause. This will result in the "else" part being written out twice, and I want to avoid such duplication.
In other words, I am trying to deal with the problem in this post: https://stackoverflow.com/questions/13197425/multiple-if-with-one-else
William
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.
Wouldn't it be better to set a foundTag
flag or reusing the if len(latestTag) > 0
test?
Does @n-peugnet or @Maytha8 want to review/approve this? |
Closes #226 |
When a user specifies a valid tag when using
if there is another tag pointing to the same commit as the specified tag, then dh-make-golang might use the other tag to determine the package version.
This patch modifies the behavior of "dh-make-golang make" such that, if the user specifies a valid tag in "-git_revision" option, "dh-make-golang make" will always use the specified tag to determine the upstream package version.
This patch also trivially changes the tests written in version_test.go so that the tests adjusts to the new function signature of version.go:pkgVersionFromGit().