mirror of https://github.com/GNOME/gimp.git
app: fix abbreviated commit hashes
The abbreviated commit hash we show in the shell and the about dialog is currently just the last 7 characters of 'git describe', based on the assumption that abbreviated hashes are always 7-digits long. When the hash is longer than that, we're just showing a nonsense commit. This was never a good idea, since users can override this, and since disambiguation can result in longer hashes, but since git 2.11, the default abbreviated hash length is determined based on the size of the repository, which currently results in 10 digits for us. Let's just do it right.
This commit is contained in:
parent
78077dcfa5
commit
c97209ba4a
|
@ -272,9 +272,11 @@ dist-hook: dist-check-gimp-console dist-dump-gimprc
|
|||
git-version.h: update-git-version-header
|
||||
@if test -d "$(top_srcdir)/.git"; then \
|
||||
git_version="`git --git-dir=$(top_srcdir)/.git describe --always`"; \
|
||||
git_version_abbrev="`git --git-dir=$(top_srcdir)/.git rev-parse --short HEAD`"; \
|
||||
git_last_commit_year="`git --git-dir=$(top_srcdir)/.git log -n1 --reverse --pretty=%ci | cut -b 1-4`"; \
|
||||
elif test ! -f "$@"; then \
|
||||
git_version="Unknown, shouldn't happen"; \
|
||||
git_version_abbrev="$$git_version"; \
|
||||
git_last_commit_timestamp=-1; \
|
||||
git_last_commit_year="`date -u '+%Y'`"; \
|
||||
fi; \
|
||||
|
@ -282,6 +284,7 @@ git-version.h: update-git-version-header
|
|||
echo "#ifndef __GIT_VERSION_H__" > "$@.tmp"; \
|
||||
echo "#define __GIT_VERSION_H__" >> "$@.tmp"; \
|
||||
echo "#define GIMP_GIT_VERSION \"$$git_version\"" >> "$@.tmp"; \
|
||||
echo "#define GIMP_GIT_VERSION_ABBREV \"$$git_version_abbrev\"" >> "$@.tmp"; \
|
||||
echo "#define GIMP_GIT_LAST_COMMIT_YEAR \"$$git_last_commit_year\"" >> "$@.tmp"; \
|
||||
echo "#endif /* __GIT_VERSION_H__ */" >> "$@.tmp"; \
|
||||
fi
|
||||
|
|
|
@ -601,18 +601,13 @@ about_dialog_timer (gpointer data)
|
|||
static void
|
||||
about_dialog_add_unstable_message (GtkWidget *vbox)
|
||||
{
|
||||
GtkWidget *label;
|
||||
const gchar *version;
|
||||
gchar *short_hash;
|
||||
gchar *text;
|
||||
GtkWidget *label;
|
||||
gchar *text;
|
||||
|
||||
version = GIMP_GIT_VERSION;
|
||||
short_hash = g_strdup (version + strlen (version) - 7);
|
||||
text = g_strdup_printf (_("This is an unstable development release\n"
|
||||
"commit %s"), short_hash);
|
||||
"commit %s"), GIMP_GIT_VERSION_ABBREV);
|
||||
label = gtk_label_new (text);
|
||||
g_free (text);
|
||||
g_free (short_hash);
|
||||
|
||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
||||
|
|
|
@ -525,8 +525,6 @@ gimp_display_shell_canvas_draw_drop_zone (GimpDisplayShell *shell,
|
|||
#ifdef GIMP_UNSTABLE
|
||||
{
|
||||
PangoLayout *layout;
|
||||
const gchar *version;
|
||||
gchar *short_hash;
|
||||
gchar *msg;
|
||||
GtkAllocation allocation;
|
||||
gint width;
|
||||
|
@ -535,17 +533,14 @@ gimp_display_shell_canvas_draw_drop_zone (GimpDisplayShell *shell,
|
|||
|
||||
layout = gtk_widget_create_pango_layout (shell->canvas, NULL);
|
||||
|
||||
version = GIMP_GIT_VERSION;
|
||||
short_hash = g_strdup (version + strlen (version) - 7);
|
||||
msg = g_strdup_printf (_("<big>Unstable Development Version</big>\n\n"
|
||||
"<small>commit <tt>%s</tt></small>\n\n"
|
||||
"<small>Please test bugs against "
|
||||
"latest git master branch\n"
|
||||
"before reporting them.</small>"),
|
||||
short_hash);
|
||||
GIMP_GIT_VERSION_ABBREV);
|
||||
pango_layout_set_markup (layout, msg, -1);
|
||||
g_free (msg);
|
||||
g_free (short_hash);
|
||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
|
||||
pango_layout_get_pixel_size (layout, &width, &height);
|
||||
|
|
Loading…
Reference in New Issue