* [PATCH 0/3] increase user-friendliness
@ 2009-10-29 0:22 Jeff King
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Jeff King @ 2009-10-29 0:22 UTC (permalink / raw)
To: git
Git has a reputation as being unfriendly to users. Let's fix that by
adding some features implemented by more user-friendly programs.
-Peff
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] add splash screen
2009-10-29 0:22 [PATCH 0/3] increase user-friendliness Jeff King
@ 2009-10-29 0:24 ` Jeff King
2009-10-29 1:28 ` Michael Witten
` (2 more replies)
2009-10-29 0:24 ` [PATCH 2/3] add config-mak git command Jeff King
` (2 subsequent siblings)
3 siblings, 3 replies; 9+ messages in thread
From: Jeff King @ 2009-10-29 0:24 UTC (permalink / raw)
To: git
Because bash completion is so slow to start, we need to
entertain users with a splash screen, so reuse the one from
git-gui.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Nick Edelen <sirnot@gmail.com>
Signed-off-by: "J.H." <warthog9@kernel.org>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
.gitignore | 1 +
Makefile | 3 +++
git-splash.sh | 4 ++++
git.c | 6 ++++++
4 files changed, 14 insertions(+), 0 deletions(-)
create mode 100644 git-splash.sh
diff --git a/.gitignore b/.gitignore
index 51a37b1..1e547e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -190,3 +190,4 @@ cscope*
*.pdb
Debug/
Release/
+git-splash
diff --git a/Makefile b/Makefile
index fea237b..36e1a61 100644
--- a/Makefile
+++ b/Makefile
@@ -329,6 +329,7 @@ SCRIPT_SH += git-rebase.sh
SCRIPT_SH += git-repack.sh
SCRIPT_SH += git-request-pull.sh
SCRIPT_SH += git-sh-setup.sh
+SCRIPT_SH += git-splash.sh
SCRIPT_SH += git-stash.sh
SCRIPT_SH += git-submodule.sh
SCRIPT_SH += git-web--browse.sh
@@ -1352,6 +1353,7 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
template_dir_SQ = $(subst ','\'',$(template_dir))
htmldir_SQ = $(subst ','\'',$(htmldir))
prefix_SQ = $(subst ','\'',$(prefix))
+sharedir_SQ = $(subst ','\'',$(sharedir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
@@ -1428,6 +1430,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+ -e 's|@@SHAREDIR@@|$(sharedir_SQ)|' \
-e $(BROKEN_PATH_FIX) \
$@.sh >$@+ && \
chmod +x $@+ && \
diff --git a/git-splash.sh b/git-splash.sh
new file mode 100644
index 0000000..fc2e6f7
--- /dev/null
+++ b/git-splash.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo 'source @@SHAREDIR@@/git-gui/lib/logo.tcl; pack [git_logo .logo]; after 3000 exit' |
+wish
diff --git a/git.c b/git.c
index 9883009..86dcfee 100644
--- a/git.c
+++ b/git.c
@@ -459,6 +459,12 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "git-help";
+ if (!getenv("GIT_NOSPLASH") && !(argv[1] && !strcmp(argv[1], "splash"))) {
+ const char *a[] = { "splash", NULL };
+ const char *e[] = { "GIT_NOSPLASH=1", NULL };
+ run_command_v_opt_cd_env(a, RUN_GIT_CMD, NULL, e);
+ }
+
/*
* "git-xxxx" is the same as "git xxxx", but we obviously:
*
--
1.6.5.1.3.g9d77a
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] add config-mak git command
2009-10-29 0:22 [PATCH 0/3] increase user-friendliness Jeff King
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
@ 2009-10-29 0:24 ` Jeff King
2009-10-29 0:24 ` [PATCH 3/3] add autoupdate feature Jeff King
2009-10-29 10:59 ` [PATCH 0/3] increase user-friendliness Johannes Schindelin
3 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-10-29 0:24 UTC (permalink / raw)
To: git
This records the contents of your config.mak at build time
and prints them later.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Nick Edelen <sirnot@gmail.com>
Signed-off-by: "J.H." <warthog9@kernel.org>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
.gitignore | 1 +
Makefile | 8 ++++++++
builtin.h | 1 +
git.c | 1 +
help.c | 7 +++++++
5 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1e547e7..cf0d8b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -191,3 +191,4 @@ cscope*
Debug/
Release/
git-splash
+config-mak.c
diff --git a/Makefile b/Makefile
index 36e1a61..ae4b9fc 100644
--- a/Makefile
+++ b/Makefile
@@ -480,6 +480,7 @@ LIB_OBJS += color.o
LIB_OBJS += combine-diff.o
LIB_OBJS += commit.o
LIB_OBJS += config.o
+LIB_OBJS += config-mak.o
LIB_OBJS += connect.o
LIB_OBJS += convert.o
LIB_OBJS += copy.o
@@ -1931,6 +1932,13 @@ coverage-clean:
COVERAGE_CFLAGS = $(CFLAGS) -O0 -ftest-coverage -fprofile-arcs
COVERAGE_LDFLAGS = $(CFLAGS) -O0 -lgcov
+config-mak.c: config.mak
+ (echo 'const char *config_mak ='; \
+ sed < config.mak -e 's/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$$/\\n"/'; \
+ echo ';' \
+ ) >$@+
+ mv $@+ $@
+
coverage-build: coverage-clean
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" all
$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
diff --git a/builtin.h b/builtin.h
index a2174dc..2ac8f3a 100644
--- a/builtin.h
+++ b/builtin.h
@@ -113,5 +113,6 @@ extern int cmd_verify_pack(int argc, const char **argv, const char *prefix);
extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
extern int cmd_replace(int argc, const char **argv, const char *prefix);
+extern int cmd_config_mak(int argc, const char **argv, const char *prefix);
#endif
diff --git a/git.c b/git.c
index 86dcfee..01ddf06 100644
--- a/git.c
+++ b/git.c
@@ -368,6 +368,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "verify-pack", cmd_verify_pack },
{ "show-ref", cmd_show_ref, RUN_SETUP },
{ "pack-refs", cmd_pack_refs, RUN_SETUP },
+ { "config-mak", cmd_config_mak, },
};
int i;
static const char ext[] = STRIP_EXTENSION;
diff --git a/help.c b/help.c
index e8db31f..422259a 100644
--- a/help.c
+++ b/help.c
@@ -365,3 +365,10 @@ int cmd_version(int argc, const char **argv, const char *prefix)
printf("git version %s\n", git_version_string);
return 0;
}
+
+extern const char *config_mak;
+int cmd_config_mak(int argc, const char **argv, const char *prefix)
+{
+ fputs(config_mak, stdout);
+ return 0;
+}
--
1.6.5.1.3.g9d77a
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] add autoupdate feature
2009-10-29 0:22 [PATCH 0/3] increase user-friendliness Jeff King
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
2009-10-29 0:24 ` [PATCH 2/3] add config-mak git command Jeff King
@ 2009-10-29 0:24 ` Jeff King
2009-10-29 10:59 ` [PATCH 0/3] increase user-friendliness Johannes Schindelin
3 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-10-29 0:24 UTC (permalink / raw)
To: git
Users can't be bothered to keep their software up to date, so
we must do it for them. Whenever any git command is
invoked, this patch checks for new releases of git at
kernel.org, and automatically upgrades your version of git.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Sam Vilain <sam@vilain.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Nick Edelen <sirnot@gmail.com>
Signed-off-by: "J.H." <warthog9@kernel.org>
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
.gitignore | 1 +
Makefile | 1 +
git-autoupdate.perl | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++
git.c | 9 +++++++-
4 files changed, 68 insertions(+), 1 deletions(-)
create mode 100644 git-autoupdate.perl
diff --git a/.gitignore b/.gitignore
index cf0d8b9..5a2703d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ git-annotate
git-apply
git-archimport
git-archive
+git-autoupdate
git-bisect
git-bisect--helper
git-blame
diff --git a/Makefile b/Makefile
index ae4b9fc..ba386a4 100644
--- a/Makefile
+++ b/Makefile
@@ -335,6 +335,7 @@ SCRIPT_SH += git-submodule.sh
SCRIPT_SH += git-web--browse.sh
SCRIPT_PERL += git-add--interactive.perl
+SCRIPT_PERL += git-autoupdate.perl
SCRIPT_PERL += git-difftool.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
diff --git a/git-autoupdate.perl b/git-autoupdate.perl
new file mode 100644
index 0000000..c8ca10b
--- /dev/null
+++ b/git-autoupdate.perl
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+
+use LWP::Simple;
+use strict;
+
+my $ROOT = "http://kernel.org/pub/software/scm/git";
+
+my $us = our_git_version();
+my $them = latest_git_version();
+
+if (compare_versions($us, $them) < 0) {
+ print STDERR <<EOF;
+A new version of git is available! Auto-installing version $them.
+EOF
+}
+else {
+ exit 0;
+}
+
+upgrade($them);
+exit 42;
+
+sub our_git_version {
+ local $_ = `git version`;
+ /^git version (.*?)(\.\d+\.g[a-f0-9]+)?(\.dirty)?$/
+ or die "unable to read git version: $_";
+ return $1;
+}
+
+sub latest_git_version {
+ local $_ = get("$ROOT/");
+ my @versions = /git-([0-9.]+)\.tar\.gz/g
+ or die "unable to find any git versions at $ROOT";
+ # git version numbers have always sorted lexicographically so far,
+ # so let's just assume that will be the case forever
+ return (sort @versions)[-1];
+}
+
+sub compare_versions {
+ # let's assume lexicographical sorting again
+ return $_[0] cmp $_[1];
+}
+
+sub upgrade {
+ my $version = shift;
+ my $fn = "git-$version.tar.gz";
+ getstore("$ROOT/$fn", "/tmp/$fn") == 200
+ or die "unable to fetch $ROOT/$fn";
+ my $rc = system qq(
+ cd /tmp &&
+ gunzip -c $fn | tar xf - &&
+ cd git-$version &&
+ git config-mak >config.mak &&
+ make install
+ );
+ $rc == 0 or die "failed to upgrade git";
+ system("less /tmp/git-$version/RelNotes");
+}
diff --git a/git.c b/git.c
index 01ddf06..959ad52 100644
--- a/git.c
+++ b/git.c
@@ -462,10 +462,17 @@ int main(int argc, const char **argv)
if (!getenv("GIT_NOSPLASH") && !(argv[1] && !strcmp(argv[1], "splash"))) {
const char *a[] = { "splash", NULL };
- const char *e[] = { "GIT_NOSPLASH=1", NULL };
+ const char *e[] = { "GIT_NOSPLASH=1", "GIT_NOAUTOUPDATE=1", NULL };
run_command_v_opt_cd_env(a, RUN_GIT_CMD, NULL, e);
}
+ if (!getenv("GIT_NOAUTOUPDATE")) {
+ const char *a[] = { "autoupdate", NULL };
+ const char *e[] = { "GIT_NOSPLASH=1", "GIT_NOAUTOUPDATE=1", NULL };
+ if (run_command_v_opt_cd_env(a, RUN_GIT_CMD, NULL, e) == 42)
+ exit(run_command_v_opt_cd_env(argv, 0, NULL, e));
+ }
+
/*
* "git-xxxx" is the same as "git xxxx", but we obviously:
*
--
1.6.5.1.3.g9d77a
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] add splash screen
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
@ 2009-10-29 1:28 ` Michael Witten
2009-10-29 2:25 ` A Large Angry SCM
2009-10-29 12:48 ` Paolo Bonzini
2 siblings, 0 replies; 9+ messages in thread
From: Michael Witten @ 2009-10-29 1:28 UTC (permalink / raw)
To: Jeff King; +Cc: git
On Wed, Oct 28, 2009 at 7:24 PM, Jeff King <peff@peff.net> wrote:
> Because bash completion is so slow to start, we need to
> entertain users with a splash screen, so reuse the one from
> git-gui.
According to Wolfram Alpha, you're about 22 weeks off in your timing.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] add splash screen
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
2009-10-29 1:28 ` Michael Witten
@ 2009-10-29 2:25 ` A Large Angry SCM
2009-10-29 12:48 ` Paolo Bonzini
2 siblings, 0 replies; 9+ messages in thread
From: A Large Angry SCM @ 2009-10-29 2:25 UTC (permalink / raw)
To: Jeff King; +Cc: git
Jeff King wrote:
> Because bash completion is so slow to start, we need to
> entertain users with a splash screen, so reuse the one from
> git-gui.
>
> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
> Signed-off-by: Sam Vilain <sam@vilain.net>
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> Signed-off-by: Nick Edelen <sirnot@gmail.com>
> Signed-off-by: "J.H." <warthog9@kernel.org>
> Signed-off-by: Brandon Casey <drafnel@gmail.com>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> .gitignore | 1 +
> Makefile | 3 +++
> git-splash.sh | 4 ++++
> git.c | 6 ++++++
> 4 files changed, 14 insertions(+), 0 deletions(-)
> create mode 100644 git-splash.sh
>
If you're going to assume that the user has a working network connection
for every git command invoked for part 3 of this series, why not get the
logo image from kernel.org also so you always have the most up-to-date logo?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] increase user-friendliness
2009-10-29 0:22 [PATCH 0/3] increase user-friendliness Jeff King
` (2 preceding siblings ...)
2009-10-29 0:24 ` [PATCH 3/3] add autoupdate feature Jeff King
@ 2009-10-29 10:59 ` Johannes Schindelin
2009-10-30 18:29 ` Jeff King
3 siblings, 1 reply; 9+ messages in thread
From: Johannes Schindelin @ 2009-10-29 10:59 UTC (permalink / raw)
To: Jeff King; +Cc: git
Hi,
On Wed, 28 Oct 2009, Jeff King wrote:
> Git has a reputation as being unfriendly to users. Let's fix that by
> adding some features implemented by more user-friendly programs.
So the bar for pirate patches has been raised to patch series now?
LOL,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] add splash screen
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
2009-10-29 1:28 ` Michael Witten
2009-10-29 2:25 ` A Large Angry SCM
@ 2009-10-29 12:48 ` Paolo Bonzini
2 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2009-10-29 12:48 UTC (permalink / raw)
To: Jeff King; +Cc: git
On 10/29/2009 01:24 AM, Jeff King wrote:
> Because bash completion is so slow to start, we need to
> entertain users with a splash screen, so reuse the one from
> git-gui.
I suggest adding "wm overrideredirect . 1; wm geometry . +300+300".
Paolo
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] increase user-friendliness
2009-10-29 10:59 ` [PATCH 0/3] increase user-friendliness Johannes Schindelin
@ 2009-10-30 18:29 ` Jeff King
0 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-10-30 18:29 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
On Thu, Oct 29, 2009 at 11:59:35AM +0100, Johannes Schindelin wrote:
> On Wed, 28 Oct 2009, Jeff King wrote:
>
> > Git has a reputation as being unfriendly to users. Let's fix that by
> > adding some features implemented by more user-friendly programs.
>
> So the bar for pirate patches has been raised to patch series now?
Well, I wasn't intending to do a series, but strangely when you ask in a
room full of git developers, "what ridiculous joke patch would you like
me to code this afternoon?", you get way more answers than you wanted. I
had to start rejecting suggestions. ;)
-Peff
PS Thanks to all who responded with ridiculous suggestions in your
reviews. I'm not going to bother keeping the thread alive by responding
to each, though. :)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-10-30 18:30 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 0:22 [PATCH 0/3] increase user-friendliness Jeff King
2009-10-29 0:24 ` [PATCH 1/3] add splash screen Jeff King
2009-10-29 1:28 ` Michael Witten
2009-10-29 2:25 ` A Large Angry SCM
2009-10-29 12:48 ` Paolo Bonzini
2009-10-29 0:24 ` [PATCH 2/3] add config-mak git command Jeff King
2009-10-29 0:24 ` [PATCH 3/3] add autoupdate feature Jeff King
2009-10-29 10:59 ` [PATCH 0/3] increase user-friendliness Johannes Schindelin
2009-10-30 18:29 ` Jeff King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).