-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
build: include commit hash & version #2453
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
b954ff3
repo: add `ipfs repo stat` command
atomgardner 8aa1cc2
`repo stat`: add Type
atomgardner ae7d672
Humanize byte size
atomgardner 5726f29
repo-stat
daviddias ea870a1
t0300: improve docker_build debug message
chriscool 129656e
build: include commit hash & version
595db0a
various bugfixes
d801991
feat: Update the webui to work with the latest changes in 0.4
dignifiedquire aeb1ed2
fix double transfer encoding head problem
whyrusleeping 22937ad
fix whitespace trimming
whyrusleeping d5169e4
Alphabetized subcommands
RichardLitt 53b1681
appveyor fix to make it execute tests again
kalmi 5346331
Edited the grammar for diag
RichardLitt a3357b8
docker: start daemon with --enable-gc
1e7e383
clean up dependencies
whyrusleeping 0f48247
correct import in fuse tests
MichaelMure a65f3c0
clean deprecated Key.Pretty()
MichaelMure 30d8be7
allow users to override the IPFS API address when fetching dependencies
Stebalien fadd9a4
update utp and cleanup more godeps along the way
whyrusleeping 7ebfe81
change `ipfs pin` response field name from `Pinned` to `Pins`
Stebalien 5ef4074
use the builtin option parser to set the default for `ipfs pin ls --t…
Stebalien 8837cb8
Merge branch 'master' into fix/version-commit-hash
74af4c8
Merge branch 'master' into fix/version-commit-hash
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,78 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Calls git describe and extracts SemVer-compatible version and meta info | ||
# Assumes git tags are properly formatted: vX.Y.Z or vX.Y.Z-some-tag | ||
# | ||
# Examples: | ||
# | ||
# $ genversion --version | ||
# 0.4.0-rc2 | ||
# | ||
# or: | ||
# | ||
# $ genversion --commit | ||
# c148.91c6f0f.dirty | ||
# | ||
# (148 commits ahead of the version 0.4.0-rc2, dirty workdir with HEAD at 91c6f0f) | ||
|
||
|
||
PRINT_VERSION=0 | ||
PRINT_COMMIT=0 | ||
|
||
test $# -ge 1 || PRINT_VERSION=1 | ||
|
||
while test $# -gt 0; do | ||
case "$1" in | ||
"--version") | ||
PRINT_VERSION=1 | ||
;; | ||
"--commit") | ||
PRINT_COMMIT=1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
|
||
string_join (){ | ||
local IFS="$1" | ||
shift | ||
echo "$*" | ||
} | ||
|
||
if [[ "$PRINT_VERSION" == "1" ]] || [[ "$PRINT_COMMIT" == "1" ]]; then | ||
DESCRIBE=( $(git describe --always --tags --match 'v*' --dirty --long | tr '-' '\n') ) | ||
|
||
FIELDS=${#DESCRIBE[@]} | ||
if [[ "${DESCRIBE[$FIELDS-1]}" == "dirty" ]]; then | ||
DIRTY=1 | ||
FIELDS=$FIELDS-1 | ||
fi | ||
COMMIT_HASH=${DESCRIBE[$FIELDS-1]} | ||
COMMIT_NO=${DESCRIBE[$FIELDS-2]} | ||
VERSION=$(string_join - ${DESCRIBE[@]:0:$FIELDS-2}) | ||
VERSION=${VERSION:1} | ||
HASH=${DESCRIBE[$FIELDS-1]} | ||
COMMIT=$(printf "c%s.%s" ${DESCRIBE[$FIELDS-2]} ${HASH:1}) | ||
|
||
if [[ "$DIRTY" == "1" ]]; then | ||
COMMIT="$COMMIT.dirty" | ||
fi | ||
|
||
fi | ||
|
||
if [[ "$PRINT_VERSION" == "1" ]]; then | ||
printf $VERSION | ||
fi | ||
|
||
if [[ "$PRINT_VERSION" == "1" ]] && [[ "$PRINT_COMMIT" == "1" ]]; then | ||
printf "+" | ||
fi | ||
|
||
if [[ "$PRINT_COMMIT" == "1" ]]; then | ||
printf $COMMIT | ||
fi | ||
|
||
echo | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,15 @@ import ( | |
"time" | ||
) | ||
|
||
// CurrentVersionNumber and CurrentCommit are normally set via ldflags -X | ||
|
||
// CurrentCommit is the current git commit, this is set as a ldflag in the Makefile | ||
var CurrentCommit string | ||
|
||
// CurrentVersionNumber is the current application's version literal | ||
const CurrentVersionNumber = "0.4.0-dev" | ||
var CurrentVersionNumber = "0.0.0-dev" | ||
|
||
const ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/" | ||
var ApiVersion = "/go-ipfs/" + CurrentVersionNumber + "/" | ||
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. Does this do what expected when changing CurrentVersionNumber via ldflags? In any case the same vN.N.N expectation applies here. |
||
|
||
// Version regulates checking if the most recent version is run | ||
type Version struct { | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
CurrentVersionNumber
should stay as it is and not carry commit information -- it's used in too many places where the assumption is a simple vN.N.N string. Maybe just use CurrentCommit?