git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] increase git el1T3nEss

From
Jeff King <peff@peff.net>
Date
Oct 29, 2008, 17:06 UTC
Message-ID
<20081029170631.GA12078@sigill.intra.peff.net>
In-Reply-To
<1225257832-29086-1-git-send-email-pasky@suse.cz>

The uptake of git by script kiddies has been disappointingly minimal. Let's make it more palatable by allowing mixed-case and l33t-speak commands.

Signed-off-by: Jeff King <peff@peff.net>
---
This commit was made by "git c0mM1t".
 git.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/git.c b/git.c
index 89feb0b..fd0ca67 100644
--- a/git.c
+++ b/git.c
@@ -261,6 +261,31 @@ static int run_command(struct cmd_struct *p, int argc, const char **argv)
 	return 0;
 }
 
+static char deelite(char in) {
+	if (isalpha(in))
+		return tolower(in);
+	switch (in) {
+	case '0': return 'o';
+	case '1': return 'i';
+	case '3': return 'e';
+	case '5': return 's';
+	case '7': return 'l';
+	}
+	return in;
+}
+
+static int elitecmp(const char *a, const char *b) {
+	while (1) {
+		char ca = deelite(*a), cb = deelite(*b);
+		if (ca != cb)
+			return ca < cb ? -1 : 1;
+		if (!ca)
+			return 0;
+		a++;
+		b++;
+	}
+}
+
 static void handle_internal_command(int argc, const char **argv)
 {
 	const char *cmd = argv[0];
@@ -381,7 +406,7 @@ static void handle_internal_command(int argc, const char **argv)
 
 	for (i = 0; i < ARRAY_SIZE(commands); i++) {
 		struct cmd_struct *p = commands+i;
-		if (strcmp(p->cmd, cmd))
+		if (elitecmp(p->cmd, cmd))
 			continue;
 		exit(run_command(p, argc, argv));
 	}
-- 
1.6.0.3.764.ge6f2.dirty
Previous: Johannes SchindelinNext: Miklos Vajna
Message 4 of 8 in “diff: support making output friendlier for fine, grand users”
  1. 1/1 diff: support making output friendlier for fine, grand usersPetr Baudis, Oct 29, 2008
  2. David BrownOct 29, 2008
  3. Johannes SchindelinOct 29, 2008
  4. increase git el1T3nEssJeff King, Oct 29, 2008
  5. Miklos VajnaOct 29, 2008
  6. Daniel BarkalowOct 29, 2008
  7. Jeff KingOct 29, 2008
  8. Petr BaudisOct 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.