Skip to content

Commit

Permalink
Changed the display format of the Git commit hash in the version display
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Jun 23, 2024
1 parent 254d717 commit e8a1979
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
12 changes: 8 additions & 4 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@

echo "--- Make commit hash file -------"

SHORTHASH="unknown"
SHORTHASH=""
if command -v git > /dev/null 2>&1 && test -d .git; then
if RESULT=$(git rev-parse --short HEAD); then
SHORTHASH="${RESULT}"
fi
if SHORTHASH=$(git rev-parse --short HEAD); then
echo " -> Git commit hash : ${SHORTHASH}"
else
echo " -> Not get git commit hash"
fi
else
echo " -> Not found git command or .git directory"
fi
echo "${SHORTHASH}" > default_commit_hash

Expand Down
17 changes: 14 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,22 @@ AS_IF([test -d .git], [DOTGITDIR=yes], [DOTGITDIR=no])

AC_MSG_CHECKING([github short commit hash])
if test "x${GITCMD}" = "xyes" -a "x${DOTGITDIR}" = "xyes"; then
GITCOMMITHASH=`git rev-parse --short HEAD`
TMP_GITCOMMITHASH=`git rev-parse --short HEAD`
UNTRACKED_FILES=`git status -s --untracked-files=no`
if test -n "${UNTRACKED_FILES}"; then
GITCOMMITHASH="(commit:${TMP_GITCOMMITHASH} +untracked files)"
else
GITCOMMITHASH="(commit:${TMP_GITCOMMITHASH})"
fi
elif test -f default_commit_hash; then
GITCOMMITHASH=`cat default_commit_hash`
TMP_GITCOMMITHASH=`cat default_commit_hash`
if test -n "${TMP_GITCOMMITHASH}"; then
GITCOMMITHASH="(base commit:${TMP_GITCOMMITHASH})"
else
GITCOMMITHASH=""
fi
else
GITCOMMITHASH="unknown"
GITCOMMITHASH=""
fi
AC_MSG_RESULT([${GITCOMMITHASH}])

Expand Down
2 changes: 1 addition & 1 deletion src/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,7 @@ static void s3fs_exit_fuseloop(int exit_status)

static void* s3fs_init(struct fuse_conn_info* conn)
{
S3FS_PRN_INIT_INFO("init v%s(commit:%s) with %s, credential-library(%s)", VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name(), ps3fscred->GetCredFuncVersion(false));
S3FS_PRN_INIT_INFO("init v%s%s with %s, credential-library(%s)", VERSION, COMMIT_HASH_VAL, s3fs_crypt_lib_name(), ps3fscred->GetCredFuncVersion(false));

// cache(remove cache dirs at first)
if(is_remove_cache && (!CacheFileStat::DeleteCacheFileStatDirectory() || !FdManager::DeleteCacheDirectory())){
Expand Down
4 changes: 2 additions & 2 deletions src/s3fs_help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ void show_help()
void show_version()
{
printf(
"Amazon Simple Storage Service File System V%s (commit:%s) with %s\n"
"Amazon Simple Storage Service File System V%s%s with %s\n"
"Copyright (C) 2010 Randy Rizun <[email protected]>\n"
"License GPL2: GNU GPL version 2 <https://gnu.org/licenses/gpl.html>\n"
"This is free software: you are free to change and redistribute it.\n"
Expand All @@ -663,7 +663,7 @@ void show_version()

const char* short_version()
{
static constexpr char short_ver[] = "s3fs version " VERSION "(" COMMIT_HASH_VAL ")";
static constexpr char short_ver[] = "s3fs version " VERSION "" COMMIT_HASH_VAL;
return short_ver;
}

Expand Down

0 comments on commit e8a1979

Please sign in to comment.