Skip to content

Commit

Permalink
CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrens committed Sep 28, 2018
1 parent 45111e4 commit 0ef5d11
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions include/spl/sys/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/zfs_gitrev.h
1 change: 0 additions & 1 deletion module/spl/spl-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include <sys/zfs_gitrev.h>

char spl_gitrev[64] = ZFS_META_GITREV;
EXPORT_SYMBOL(spl_gitrev);

/* BEGIN CSTYLED */
unsigned long spl_hostid = 0;
Expand Down
17 changes: 12 additions & 5 deletions scripts/make_gitrev.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
#!/bin/sh

#
# Generate zfs_gitrev.h. Note that we need to do this for every
# invocation of `make`, including for incremental builds. Therefore we
# can't use a zfs_gitrev.h.in file which would be processed only when
# `configure` is run.
#

file=include/spl/sys/zfs_gitrev.h

#
# Set default file contents in case we bail.
#
rm -f $file
echo "#define\tZFS_META_GITREV \"unknown\"" >>$file
/bin/echo -e "#define\tZFS_META_GITREV \"unknown\"" >>$file

#
# Check if we are in a git repo.
# Check if git is installed and we are in a git repo.
#
git rev-parse --git-dir > /dev/null 2>&1 || exit

#
# Check if there are uncommitted changes
#
git diff-index --quiet HEAD -- || exit
git diff-index --quiet HEAD || exit

rev=$(git describe 2>/dev/null)
rev=$(git describe 2>/dev/null) || exit

rm -f $file
echo "#define\tZFS_META_GITREV \"${rev}\"" >>$file
/bin/echo -e "#define\tZFS_META_GITREV \"${rev}\"" >>$file

0 comments on commit 0ef5d11

Please sign in to comment.