So this is very much debatable, but I'm including a patch for the discussion to start. I never use ':/', and part of it is that it's so horribly cumbersome. I'd _like_ to use it to do things like gitk :/slabh.. which would (right now) show what happened since I merged the 'slabh' branch. But that doesn't work, I would need to write it as gitk :/"Merge branch 'slabh'".. at which point it really isn't all that useful any more - in order to figure out the string I need to use, I had to look up the commit, so the whole :/ format was useless. I might as well just have used the SHA1 value instead. The thing is, I'm not quite sure _who_ uses :/ as things are now, so maybe there is some reason for that incredibly annoying interface. But with this trivial (LARGELY UNTESTED!) patch, I get the behaviour _I_ want, and I can do my simpler version instead. It also allows me to do silly things like this: git show :/'Signed-off-by: Linus' which shows the last commit that was signed off by me. Is that really useful? Not bloody likely. But it shows how much more flexible the whole notion of "let's grep the commit message" is than having to match exactly the beginning of it. Linus PS. Do note the "largely untested" part. I think this patch is kind of cool, but it might be totally broken. I did run the test-suite on it, and it still says "failed 0", but that's probably more indicative of limited test coverage of :/ than anything else. --- sha1_name.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/sha1_name.c b/sha1_name.c index bf92417..7570f1a 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -692,12 +692,17 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1) struct commit_list *list = NULL, *backup = NULL, *l; int retval = -1; char *temp_commit_buffer = NULL; + regex_t regex; if (prefix[0] == '!') { if (prefix[1] != '!') die ("Invalid search pattern: %s", prefix); prefix++; } + + if (regcomp(®ex, prefix, REG_EXTENDED)) + die("Invalid search pattern: %s", prefix); + for_each_ref(handle_one_ref, &list); for (l = list; l; l = l->next) commit_list_insert(l->item, &backup); @@ -721,12 +726,13 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1) } if (!(p = strstr(p, "\n\n"))) continue; - if (!prefixcmp(p + 2, prefix)) { + if (!regexec(®ex, p + 2, 0, NULL, 0)) { hashcpy(sha1, commit->object.sha1); retval = 0; break; } } + regfree(®ex); free(temp_commit_buffer); free_commit_list(list); for (l = backup; l; l = l->next) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html