Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
ec295f5e
Commit
ec295f5e
authored
9 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
build-sys: detect a build from git and show its short commit hash
parent
4b5b66a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
configure.ac
+11
-1
configure.ac
src/nano.c
+4
-0
src/nano.c
src/nano.h
+6
-0
src/nano.h
src/winio.c
+3
-5
src/winio.c
with
24 additions
and
6 deletions
+24
-6
configure.ac
View file @
ec295f5e
...
...
@@ -18,7 +18,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
# USA.
AC_INIT([GNU nano], [2.5.3
-git
], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.5.3], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE
...
...
@@ -692,6 +692,16 @@ AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
AC_CHECK_PROG(haveit, makeinfo, yes, no)
AM_CONDITIONAL(HAVE_MAKEINFO, test x$haveit = xyes)
AC_MSG_CHECKING([whether building from git])
if test -d .git ; then
AC_MSG_RESULT([yes])
AC_PATH_PROG([GIT], [git])
REVISION=`($GIT rev-parse --is-inside-work-tree >/dev/null 2>&1) && ($GIT rev-parse --short HEAD)`
AC_SUBST(REVISION)
AC_DEFINE_UNQUOTED([REVISION],"${REVISION}","Setting REVISION in config.h.")
else
AC_MSG_RESULT([no])
fi
AC_CONFIG_FILES([
Makefile
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
ec295f5e
...
...
@@ -933,7 +933,11 @@ void usage(void)
* it was compiled with. */
void
version
(
void
)
{
#ifdef REVISION
printf
(
" GNU nano from git, commit %s (after %s)
\n
"
,
REVISION
,
VERSION
);
#else
printf
(
_
(
" GNU nano, version %s
\n
"
),
VERSION
);
#endif
printf
(
" (C) 1999..2016 Free Software Foundation, Inc.
\n
"
);
printf
(
_
(
" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"
));
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
ec295f5e
...
...
@@ -581,4 +581,10 @@ enum
/* The maximum number of bytes buffered at one time. */
#define MAX_BUF_SIZE 128
#ifdef REVISION
#define BRANDING PACKAGE_VERSION"-git "REVISION
#else
#define BRANDING PACKAGE_STRING
#endif
#endif
/* !NANO_H */
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
ec295f5e
...
...
@@ -1952,9 +1952,8 @@ void titlebar(const char *path)
{
int
space
=
COLS
;
/* The space we have available for display. */
size_t
verlen
=
strlenpt
(
PACKAGE_STRING
)
+
1
;
/* The length of the version message in columns, plus one for
* padding. */
size_t
verlen
=
strlenpt
(
BRANDING
);
/* The length of the version message in columns. */
const
char
*
prefix
;
/* "DIR:", "File:", or "New Buffer". Goes before filename. */
size_t
prefixlen
;
...
...
@@ -1996,8 +1995,7 @@ void titlebar(const char *path)
if
(
space
>=
4
)
{
/* Add a space after the version message, and account for both
* it and the two spaces before it. */
mvwaddnstr
(
topwin
,
0
,
2
,
PACKAGE_STRING
,
actual_x
(
PACKAGE_STRING
,
verlen
));
mvwaddnstr
(
topwin
,
0
,
2
,
BRANDING
,
actual_x
(
BRANDING
,
verlen
));
verlen
+=
3
;
/* Account for the full length of the version message. */
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment