Skip to contentSkip to conversation

increase user-friendliness

PATCH In review Jeff King 5 participants 9 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore

Jeff King

author
#0 lore raw

cover increase user-friendliness

Git has a reputation as being unfriendly to users. Let's fix that by adding some features implemented by more user-friendly programs.

-Peff

author
#1 lore raw

PATCH 1/3 add splash screen

Because bash completion is so slow to start, we need to entertain users with a splash screen, so reuse the one from git-gui.

---
 .gitignore    |    1 +
 Makefile      |    3 +++
 git-splash.sh |    4 ++++
 git.c         |    6 ++++++
 4 files changed, 14 insertions(+), 0 deletions(-)
 create mode 100644 git-splash.sh
.gitignore +1 -0
index 51a37b1..1e547e7 100644
@@ -190,3 +190,4 @@ cscope*
 *.pdb
 Debug/
 Release/
+git-splash
Makefile +3 -0
index fea237b..36e1a61 100644
@@ -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) \
 	    [email protected] >$@+ && \
 	chmod +x $@+ && \
git-splash.sh new file +4 -0
new file mode 100644
index 0000000..fc2e6f7
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+echo 'source @@SHAREDIR@@/git-gui/lib/logo.tcl; pack [git_logo .logo]; after 3000 exit' |
+wish
git.c +6 -0
index 9883009..86dcfee 100644
@@ -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:
 	 *
Signature · 1 line
1.6.5.1.3.g9d77a
#2 lore raw

Re: [PATCH 1/3] add splash screen

Quoted 11 lines · Jeff King

Because bash completion is so slow to start, we need to entertain users with a splash screen, so reuse the one from git-gui.

Quoted 8 lines
---
 .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?

#3 lore raw

Re: [PATCH 1/3] add splash screen

In reply to Jeff King
Quoted 3 lines · Jeff King

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

#4 lore raw

Re: [PATCH 1/3] add splash screen

In reply to Jeff King
Quoted 3 lines · Jeff King

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.

author
#5 lore raw

PATCH 2/3 add config-mak git command

In reply to Jeff King

This records the contents of your config.mak at build time and prints them later.

---
 .gitignore |    1 +
 Makefile   |    8 ++++++++
 builtin.h  |    1 +
 git.c      |    1 +
 help.c     |    7 +++++++
 5 files changed, 18 insertions(+), 0 deletions(-)
.gitignore +1 -0
index 1e547e7..cf0d8b9 100644
@@ -191,3 +191,4 @@ cscope*
 Debug/
 Release/
 git-splash
+config-mak.c
Makefile +8 -0
index 36e1a61..ae4b9fc 100644
@@ -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)" \
builtin.h +1 -0
index a2174dc..2ac8f3a 100644
@@ -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
git.c +1 -0
index 86dcfee..01ddf06 100644
@@ -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;
help.c +7 -0
index e8db31f..422259a 100644
@@ -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;
+}
Signature · 1 line
1.6.5.1.3.g9d77a
author
#6 lore raw

PATCH 3/3 add autoupdate feature

In reply to Jeff King

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.

---
 .gitignore          |    1 +
 Makefile            |    1 +
 git-autoupdate.perl |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++
 git.c               |    9 +++++++-
 4 files changed, 68 insertions(+), 1 deletions(-)
 create mode 100644 git-autoupdate.perl
.gitignore +1 -0
index cf0d8b9..5a2703d 100644
@@ -10,6 +10,7 @@ git-annotate
 git-apply
 git-archimport
 git-archive
+git-autoupdate
 git-bisect
 git-bisect--helper
 git-blame
Makefile +1 -0
index ae4b9fc..ba386a4 100644
@@ -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
git-autoupdate.perl new file +58 -0

58 lines not on this page · raw message

git.c +8 -1
index 01ddf06..959ad52 100644
@@ -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:
 	 *
Signature · 1 line
1.6.5.1.3.g9d77a
#7 lore raw
In reply to Jeff King

Hi,

Quoted 2 lines · Jeff King

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

author
#8 lore raw
Quoted 6 lines · Johannes Schindelin
Quoted 2 lines · Jeff King

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. :)