From patchwork Tue Jan 5 13:03:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 11998829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5ACF7C433DB for ; Tue, 5 Jan 2021 13:05:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E96322AAC for ; Tue, 5 Jan 2021 13:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbhAENEz (ORCPT ); Tue, 5 Jan 2021 08:04:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727063AbhAENEz (ORCPT ); Tue, 5 Jan 2021 08:04:55 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53EC0C061574 for ; Tue, 5 Jan 2021 05:04:14 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id c133so2949961wme.4 for ; Tue, 05 Jan 2021 05:04:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qAt4pHkGYman66hA6IZHvkuPuD1zf00L3YgZ1K5X9wo=; b=W0pT5UoSlrs5G0CBf3q3WEVXfLTDkTar3QsH6+J626IstOxFG0tEv/6TvL29KAlgYn pJ4qTfc876ISno5rKtOUypxGYwcISJq4L4PWbHQ0VD70JBypaZ3d9HzwLp2RfG1jGCVn LcySQSNvdkfi5IwS1DJQxnSZnyNXLuLLR36aphm91EixpsZyBVObN+IFkvYHPtkh1K7a 6jb7XUzIEmaOheGYJQy+e/lWR2aM8kKDq7qIUbmSEc2fnLKpwr+6aC539JlHN6e0ANFi VWOcgwdJRHdR69yUdNd9ThTNQnkGQ7RtXLEqDct047Rm6BeTL4a+Vy1SpM8dEeM8XON7 euFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qAt4pHkGYman66hA6IZHvkuPuD1zf00L3YgZ1K5X9wo=; b=MCl3Frlij+Dx149M3YZR/mnswwATcmJoB0WvJ7aMBaOyew4bDZTtLBohPfi/DOz/QR 6t2vsixxobojeF3c34gQJj4l6BQ/wkW80kZxkRAH8ea+7q92yPKXp2SVwrmSA8ICbU3D qTp3JWfbCqL9cQ1H0GkhAoPEaGbRGKRiEdqEf5G4Vv6jvVW4/vQUJ6m6HfodQ/MQYVBD YW8oZYXTRd0OGmTovSFMjy+BdyxkM+EDVqnDVOe4TmLOwoEXCe9kggVDCs501+5hH/tW am1ZQ01nATyO7tHSTwK3f/nN8tE5Phf/aSoQNoxX9dPqd2Xs5nghko9s741MIaVa95/D YnSA== X-Gm-Message-State: AOAM532gBbYh1ni1HZN9qOQQj/aB4CjyPzuSY+ckgqxm/1z2HLkAEWG4 UB6pwHRO1f+CiUOubM5m9tWRImUCcbQ= X-Google-Smtp-Source: ABdhPJw86FN0fqRLkc9TYM36dkzipegVgQ+Ja1wJ3YaIPcbdqZY91Jtl5BzzPMJvIvYrHGX5ELYsoA== X-Received: by 2002:a1c:a9cc:: with SMTP id s195mr3423844wme.97.1609851852637; Tue, 05 Jan 2021 05:04:12 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id a65sm3899630wmc.35.2021.01.05.05.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jan 2021 05:04:11 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Linus Torvalds , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH] shortlog: remove unused(?) "repo-abbrev" feature Date: Tue, 5 Jan 2021 14:03:59 +0100 Message-Id: <20210105130359.21139-1-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <7vejrs54kp.fsf@assigned-by-dhcp.cox.net> References: <7vejrs54kp.fsf@assigned-by-dhcp.cox.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove support for the magical "repo-abbrev" comment in .mailmap files. This was added to .mailmap parsing in [1], as a generalized feature of the git-shortlog Perl script added earlier in [2]. There was no documentation or tests for this feature, and I don't think it's used in practice anymore. What it did was to allow you to specify a single string to be search-replaced with "/.../" in the .mailmap file. E.g. for linux.git's current .mailmap: git archive --remote=git@gitlab.com:linux-kernel/linux.git \ HEAD -- .mailmap | grep -a repo-abbrev # repo-abbrev: /pub/scm/linux/kernel/git/ Then when running e.g.: git shortlog --merges --author=Linus -1 v5.10-rc7..v5.10 | grep Merge We'd emit (the [...] is mine): Merge tag [...]git://git.kernel.org/.../tip/tip But will now emit: Merge tag [...]git.kernel.org/pub/scm/linux/kernel/git/tip/tip I think at this point this is just a historical artifact we can get rid of. It was initially meant for Linus's own use when we integrated the Perl script[2], but since then it seems he's stopped using it. Digging through Linus's release announcements on the LKML[3] the last release I can find that made use of this output is Linux 2.6.25-rc6 back in March 2008[4]. Later on Linus started using --no-merges[5], and nowadays seems to prefer some custom not-quite-shortlog format of merges from lieutenants[6]. You will still see it on linux.git if you run "git shortlog" manually yourself with --merges, with this removed you can still get the same output with: git log --pretty=fuller v5.10-rc7..v5.10 | sed 's!/pub/scm/linux/kernel/git/!/.../!g' | git shortlog Arguably we should do the same for the search-replacing of "[PATCH]" at the beginning with "". That seems to be another relic of a bygone era when linux.git patches would have their E-Mail subject lines applied as-is by "git am" or whatever. But we documented that feature in "git-shortlog(1)", and it seems more widely applicable than something purely kernel-specific. 1. 7595e2ee6ef (git-shortlog: make common repository prefix configurable with .mailmap, 2006-11-25) 2. fa375c7f1b6 (Add git-shortlog perl script, 2005-06-04) 3. https://lore.kernel.org/lkml/ 4. https://lore.kernel.org/lkml/alpine.LFD.1.00.0803161651350.3020@woody.linux-foundation.org/ 5. https://lore.kernel.org/lkml/BANLkTinrbh7Xi27an3uY7pDWrNKhJRYmEA@mail.gmail.com/ 6. https://lore.kernel.org/lkml/CAHk-=wg1+kf1AVzXA-RQX0zjM6t9J2Kay9xyuNqcFHWV-y5ZYw@mail.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- I wondered what this repo-abbrev thing was while reading thorugh recent mailmap.c traffic. I was a bit on the fence about this being a RFC/PATCH, but I guess if people hate this & want to keep it that's fine, but if not this should be ready for inclusion. Surely has some conflicts with brian's recent submission, but I wanted to get it out of my queue sooner than later. builtin/blame.c | 2 +- builtin/check-mailmap.c | 2 +- builtin/commit.c | 2 +- builtin/log.c | 2 +- builtin/shortlog.c | 16 ++------------ mailmap.c | 47 ++++++++++------------------------------- mailmap.h | 2 +- pretty.c | 2 +- shortlog.h | 1 - 9 files changed, 19 insertions(+), 57 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 6f7e32411a8..712ae8e7425 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1151,7 +1151,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) sb.xdl_opts = xdl_opts; sb.no_whole_file_rename = no_whole_file_rename; - read_mailmap(&mailmap, NULL); + read_mailmap(&mailmap); sb.found_guilty_entry = &found_guilty_entry; sb.found_guilty_entry_data = π diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index cdce144f3b7..7dc47e47932 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -47,7 +47,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix) if (argc == 0 && !use_stdin) die(_("no contacts specified")); - read_mailmap(&mailmap, NULL); + read_mailmap(&mailmap); for (i = 0; i < argc; ++i) check_mailmap(&mailmap, argv[i]); diff --git a/builtin/commit.c b/builtin/commit.c index 505fe60956d..739110c5a7f 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1039,7 +1039,7 @@ static const char *find_author_by_nickname(const char *name) av[++ac] = NULL; setup_revisions(ac, av, &revs, NULL); revs.mailmap = &mailmap; - read_mailmap(revs.mailmap, NULL); + read_mailmap(revs.mailmap); if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); diff --git a/builtin/log.c b/builtin/log.c index bd6ff4f9f95..4ee81bc976d 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -230,7 +230,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, if (mailmap) { rev->mailmap = xcalloc(1, sizeof(struct string_list)); - read_mailmap(rev->mailmap, NULL); + read_mailmap(rev->mailmap); } if (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) { diff --git a/builtin/shortlog.c b/builtin/shortlog.c index c52e4ccd19a..e7c21ab6201 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -61,8 +61,7 @@ static void insert_one_record(struct shortlog *log, if (log->summary) item->util = (void *)(UTIL_TO_INT(item) + 1); else { - const char *dot3 = log->common_repo_prefix; - char *buffer, *p; + char *buffer; struct strbuf subject = STRBUF_INIT; const char *eol; @@ -82,17 +81,6 @@ static void insert_one_record(struct shortlog *log, format_subject(&subject, oneline, " "); buffer = strbuf_detach(&subject, NULL); - if (dot3) { - int dot3len = strlen(dot3); - if (dot3len > 5) { - while ((p = strstr(buffer, dot3)) != NULL) { - int taillen = strlen(p) - dot3len; - memcpy(p, "/.../", 5); - memmove(p + 5, p + dot3len, taillen + 1); - } - } - } - if (item->util == NULL) item->util = xcalloc(1, sizeof(struct string_list)); string_list_append(item->util, buffer); @@ -342,7 +330,7 @@ void shortlog_init(struct shortlog *log) { memset(log, 0, sizeof(*log)); - read_mailmap(&log->mailmap, &log->common_repo_prefix); + read_mailmap(&log->mailmap); log->list.strdup_strings = 1; log->wrap = DEFAULT_WRAPLEN; diff --git a/mailmap.c b/mailmap.c index 962fd86d6d7..f1da233adb9 100644 --- a/mailmap.c +++ b/mailmap.c @@ -143,31 +143,10 @@ static char *parse_name_and_email(char *buffer, char **name, return (*right == '\0' ? NULL : right); } -static void read_mailmap_line(struct string_list *map, char *buffer, - char **repo_abbrev) +static void read_mailmap_line(struct string_list *map, char *buffer) { char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL; - if (buffer[0] == '#') { - static const char abbrev[] = "# repo-abbrev:"; - int abblen = sizeof(abbrev) - 1; - int len = strlen(buffer); - if (!repo_abbrev) - return; - - if (len && buffer[len - 1] == '\n') - buffer[--len] = 0; - if (!strncmp(buffer, abbrev, abblen)) { - char *cp; - - free(*repo_abbrev); - - for (cp = buffer + abblen; isspace(*cp); cp++) - ; /* nothing */ - *repo_abbrev = xstrdup(cp); - } - return; - } if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL) parse_name_and_email(name2, &name2, &email2, 1); @@ -175,8 +154,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer, add_mapping(map, name1, email1, name2, email2); } -static int read_mailmap_file(struct string_list *map, const char *filename, - char **repo_abbrev) +static int read_mailmap_file(struct string_list *map, const char *filename) { char buffer[1024]; FILE *f; @@ -192,13 +170,12 @@ static int read_mailmap_file(struct string_list *map, const char *filename, } while (fgets(buffer, sizeof(buffer), f) != NULL) - read_mailmap_line(map, buffer, repo_abbrev); + read_mailmap_line(map, buffer); fclose(f); return 0; } -static void read_mailmap_string(struct string_list *map, char *buf, - char **repo_abbrev) +static void read_mailmap_string(struct string_list *map, char *buf) { while (*buf) { char *end = strchrnul(buf, '\n'); @@ -206,14 +183,12 @@ static void read_mailmap_string(struct string_list *map, char *buf, if (*end) *end++ = '\0'; - read_mailmap_line(map, buf, repo_abbrev); + read_mailmap_line(map, buf); buf = end; } } -static int read_mailmap_blob(struct string_list *map, - const char *name, - char **repo_abbrev) +static int read_mailmap_blob(struct string_list *map, const char *name) { struct object_id oid; char *buf; @@ -231,13 +206,13 @@ static int read_mailmap_blob(struct string_list *map, if (type != OBJ_BLOB) return error("mailmap is not a blob: %s", name); - read_mailmap_string(map, buf, repo_abbrev); + read_mailmap_string(map, buf); free(buf); return 0; } -int read_mailmap(struct string_list *map, char **repo_abbrev) +int read_mailmap(struct string_list *map) { int err = 0; @@ -247,10 +222,10 @@ int read_mailmap(struct string_list *map, char **repo_abbrev) if (!git_mailmap_blob && is_bare_repository()) git_mailmap_blob = "HEAD:.mailmap"; - err |= read_mailmap_file(map, ".mailmap", repo_abbrev); + err |= read_mailmap_file(map, ".mailmap"); if (startup_info->have_repository) - err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev); - err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev); + err |= read_mailmap_blob(map, git_mailmap_blob); + err |= read_mailmap_file(map, git_mailmap_file); return err; } diff --git a/mailmap.h b/mailmap.h index d0e65646cb5..7e99fccb46c 100644 --- a/mailmap.h +++ b/mailmap.h @@ -3,7 +3,7 @@ struct string_list; -int read_mailmap(struct string_list *map, char **repo_abbrev); +int read_mailmap(struct string_list *map); void clear_mailmap(struct string_list *map); int map_user(struct string_list *map, diff --git a/pretty.c b/pretty.c index 7a7708a0ea7..fe0a66623e3 100644 --- a/pretty.c +++ b/pretty.c @@ -679,7 +679,7 @@ static int mailmap_name(const char **email, size_t *email_len, static struct string_list *mail_map; if (!mail_map) { mail_map = xcalloc(1, sizeof(*mail_map)); - read_mailmap(mail_map, NULL); + read_mailmap(mail_map); } return mail_map->nr && map_user(mail_map, email, email_len, name, name_len); } diff --git a/shortlog.h b/shortlog.h index 64be879b241..3f7e9aabcae 100644 --- a/shortlog.h +++ b/shortlog.h @@ -23,7 +23,6 @@ struct shortlog { } groups; struct string_list trailers; - char *common_repo_prefix; int email; struct string_list mailmap; FILE *file; From patchwork Tue Jan 12 20:17:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AD0DC433DB for ; Tue, 12 Jan 2021 21:47:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04DC223123 for ; Tue, 12 Jan 2021 21:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438007AbhALVhE (ORCPT ); Tue, 12 Jan 2021 16:37:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436845AbhALUS6 (ORCPT ); Tue, 12 Jan 2021 15:18:58 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 366C2C061795 for ; Tue, 12 Jan 2021 12:18:18 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id y23so3320334wmi.1 for ; Tue, 12 Jan 2021 12:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oRwCSbQS1GwtBpIY9PjgMEn7KWOqBkT+C2ETYJdC3so=; b=M1keJgmiXYnnNYY/EeiMF3GSBb0trBrxMbrW2T9PIk3IFzTVE3NXK8CTNYbZP2nJos rqIR2m0sr8oLeH4DJ01++UQ9rI/4lZ7xJg0KJryfK5YZcb8C06oTqbWL0KyjeT//lk5f T9SFNGHLXtI1yCBuLdupG6QE3Qg78YdZBWY6mHBlWqkM2pWTvi42eTFETKg/nK1MNf3G r1olVtMMImAcVUN9oREgxichrwrInU0gnRcd0rADc4MoDAGF4YZYddQcZOMBck3Q7wxI G6FyfHI5SlGkRGoQJ8k3v31aWxGmxAZJmpz10VJ0o8gRBdWx8XK1me9cENLHD59AXQll JUHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oRwCSbQS1GwtBpIY9PjgMEn7KWOqBkT+C2ETYJdC3so=; b=t0U18xb1ZPorFgvQPjxK1BjzzdkLgwt6umGLgR44kqWkMFuw1NR/p3AWoT1YEW6Unp MrFU4bIAlc0nUzEYzcTnV+4Si9zixxaL4TOa3yRdOKeOuNiZkB7FOthcoVJhEHYW1u65 pvSe0IVjMgYJaldF1J03051y7vxnqCkkTLZ7o+pl/A+DjMD/V4Vk/2by1rzogBE2ZfmJ xeCs07bLpJSNu/FIK4wJ6+mDKfwRbe3VUMqu7f6jKSOqL0NC2hw4Pc3F6FoT1JwtLK9e ywS3AheEXKEdOi4Sl2o/L+Ru8mdWptGYqmAMrJZZFVw/VTTCeM42oTBVl3sBiJg0sUs0 Nmtw== X-Gm-Message-State: AOAM53346r2XdfRFdhAxy/6L7fMYBH/eqEJcdUa7ZNyQxhvoOUulwJ5i L7JHAZUEWhZza8dWQAq7sMOsLH+U0pVoBw== X-Google-Smtp-Source: ABdhPJwv00RJmnYflbn+LzdKckhX/SGdyziXVtzQJ+edps4wmSvD8KNg37KbPaG2moMgLK63YgH7iw== X-Received: by 2002:a1c:a957:: with SMTP id s84mr869450wme.166.1610482696733; Tue, 12 Jan 2021 12:18:16 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:15 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 02/22] mailmap doc: quote config variables `like.this` Date: Tue, 12 Jan 2021 21:17:46 +0100 Message-Id: <20210112201806.13284-3-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Quote the mailmap.file and mailmap.blob configuration variables as `mailmap.file` and `mailmap.blob`, and link to git-config(1). This is in line with the preferred way of doing this in the rest of our documentation. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/gitmailmap.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt index 8b07f9c5d7..e75eadde63 100644 --- a/Documentation/gitmailmap.txt +++ b/Documentation/gitmailmap.txt @@ -14,8 +14,8 @@ DESCRIPTION ----------- If the file `.mailmap` exists at the toplevel of the repository, or at -the location pointed to by the mailmap.file or mailmap.blob -configuration options, it +the location pointed to by the `mailmap.file` or `mailmap.blob` +configuration options (see linkgit:git-config[1]), it is used to map author and committer names and email addresses to canonical real names and email addresses. From patchwork Tue Jan 12 20:17:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014867 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66CC1C433E6 for ; Tue, 12 Jan 2021 21:46:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 360E723122 for ; Tue, 12 Jan 2021 21:46:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438016AbhALVhF (ORCPT ); Tue, 12 Jan 2021 16:37:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436848AbhALUTA (ORCPT ); Tue, 12 Jan 2021 15:19:00 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90ABDC06179F for ; Tue, 12 Jan 2021 12:18:19 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id k10so3039766wmi.3 for ; Tue, 12 Jan 2021 12:18:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qguZE9vRyYW4p0GjHBfq1uKkD9Jw32ItTgP9aoQc26U=; b=tMbt9BXd+M0Ts4jl//n3vYqgKykUffdDvpZ15edd3E8Ogkm0NobhcBuYOr7uaDI2j6 0l/JFQcE1nL30Y6YQuuuXyhJE7HS4RFt9w18WEmBehis0X9OATGl8dd8t0u5JKEIBNXI Ws0jA7dncADT+7mtOCd+kVzRHogA7zFGUXIvYx/igHWZT3Q24IB5wfD84KEi3p3PcT5I SNRE/eo/+3d2Xb7YaaqNB2xl0uETDH2hS7/aKAwQENy3SdJ3a7S5FQpKIJ8lNTZ0OSdn FX9ukXC99r6tFoBHp2OG51d7QEnJN5azyGaO+BV3MN1z+DeIWINoOHlr3HgUL9A+hxHU 7nrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qguZE9vRyYW4p0GjHBfq1uKkD9Jw32ItTgP9aoQc26U=; b=NIFy5c3j45X1sG3yyPL3VeBCnztXyfRoZSXW/usiXLvDh5SAcd8zBUwANv02Z9V3Rp WVFc7xakUUzCTca8UHX0IGoOQ28K7qWNu7mlo5YMyAo+VZWydGmXVX0QJxBaPh098YZo vItS7Eu64S9aVlXbi11g4ZUEneLmWMcmoIIGGNT2k/gtkBE8nBOqSzJoCtzwSgExDwy8 b5fzbuNL+xAbMtHQSrsl7Ye1aSF6/FweQ2KII27iZNLTLB0brl+pGsWeohozFEMFYx+1 r4WZQR1zxvekgE3lJXL0tIiaJra3yvDIazLqqMGFjeLDzoztpUIUr7KQRnAKo+QZWqTZ K1tQ== X-Gm-Message-State: AOAM53375kMWPoW+lrkRG7PsVcbVw1QZx4J52DQLBnE6hfkfypGd6Hs9 6iSrDKj6v7Dg3f6h+nj/zIEUWcTWXN9CyQ== X-Google-Smtp-Source: ABdhPJxJbiVKVphbQ62e8oG8621d26v1aWyMhjjQTXR2CRx1qQmIhqaVMuFt5MaIp1kWzNRODkcm3A== X-Received: by 2002:a1c:4907:: with SMTP id w7mr554945wma.118.1610482698019; Tue, 12 Jan 2021 12:18:18 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:16 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 03/22] check-mailmap doc: note config options Date: Tue, 12 Jan 2021 21:17:47 +0100 Message-Id: <20210112201806.13284-4-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a passing mention of the mailmap.file and mailmap.blob configuration options. Before this addition a reader of the "check-mailmap" manpage would have no idea that a custom map could be specified, unless they'd happen to e.g. come across it in the "config" manpage first. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/git-check-mailmap.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/git-check-mailmap.txt b/Documentation/git-check-mailmap.txt index 45a5cfafd8..02f4418323 100644 --- a/Documentation/git-check-mailmap.txt +++ b/Documentation/git-check-mailmap.txt @@ -36,6 +36,13 @@ name is provided or known to the 'mailmap', ``Name $$$$'' is printed; otherwise only ``$$$$'' is printed. +CONFIGURATION +------------- + +See `mailmap.file` and `mailmap.blob` in linkgit:git-config[1] for how +to specify a custom `.mailmap` target file or object. + + MAPPING AUTHORS --------------- From patchwork Tue Jan 12 20:17:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10A0FC4360C for ; Tue, 12 Jan 2021 21:46:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4B5523123 for ; Tue, 12 Jan 2021 21:46:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438022AbhALVhJ (ORCPT ); Tue, 12 Jan 2021 16:37:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436850AbhALUTC (ORCPT ); Tue, 12 Jan 2021 15:19:02 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30FFC0617A2 for ; Tue, 12 Jan 2021 12:18:21 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id y23so3320447wmi.1 for ; Tue, 12 Jan 2021 12:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LFiOH14qRqgdLE9TAnn/adGrxlaOUH80pCvXvDHdJWU=; b=re/LsWxityNbvYKmcRmvdXIYmuKTyLVpMmqbBIuDYkbAgAtYS2oXGhXB6fkVpDj6Fs ePZCA3O54BGgUP84IGLd8mKwd9uI1/MoNT5Z8IGFMNZxHeVUNGTB815xrVOFK37N4FCB SixzYKEUZ5jTCqXe1broN5iv0IfxgJtcyT+pv6cW2LrF2i6Bz5RJaX08pQWWWt3yog3K M5BomiD9Dn5Wr4xWP4XlynC/HMzUotHCPQ36jGB2l7cypqZsoHDILo8EMGomxbPyEzMX mG0Gfpew/gChuEvnr4MeCDqJ9FEaeP4DvOLtLQSyYozR1TYMzJhMfAiX+PsfzfPNxIqx 0nnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LFiOH14qRqgdLE9TAnn/adGrxlaOUH80pCvXvDHdJWU=; b=QifhmGE0chbeifiLLk1P6ULPuCQUUQKFtSdnwkkkF6plpe0TtZp6yZGbln4qMIECrH Z9DHL0HqQjT9zmkDUeTQvkEoUg2SJeVNkxDtuyxEgKKqQLGM+ew/29eU066uVkpkfL79 jFNQWgg58fyCQ2krTLA0iTJk2qmCDitmtk5J9jk4zU6mPFagWq7pc4o5bgwuMgWF+W6o LsfWM0y4Tk/TjfZsNFR2LVTjumo6QFu3Da71MMq6KlJcqgZWWps+SlfJuGSwSVtxic99 UlsU1BbwM522te3ONbbZFyED0xTeKDQR+JV4X3hhlhPMRs1O50rsM6aBjzNBHaH4lOk4 rqig== X-Gm-Message-State: AOAM531Mbu3RvaMBn7FFo0nN0RJOXsv/A08hMeAIXvZ7XOKR3VXZuUmE jLZ83kAYDMH7QqCJXczeKE+uZ3mu+slNjQ== X-Google-Smtp-Source: ABdhPJxrbPASpQsQatrgGd6c5ukGG4Cy/lVLwrovCxSsvtYg07/5WJCGDTjOBzPcCrPJ7NGOzhYADw== X-Received: by 2002:a7b:c45a:: with SMTP id l26mr860405wmi.91.1610482699167; Tue, 12 Jan 2021 12:18:19 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:18 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 04/22] mailmap doc: start by mentioning the comment syntax Date: Tue, 12 Jan 2021 21:17:48 +0100 Message-Id: <20210112201806.13284-5-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Mentioning the comment syntax and blank line support first is in line with how "git help config" describes its format. See b8936cf060 (config.txt grammar, typo, and asciidoc fixes, 2006-06-08) for the paragraph I'm copying & amending from its documentation. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/gitmailmap.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt index e75eadde63..4e4677018b 100644 --- a/Documentation/gitmailmap.txt +++ b/Documentation/gitmailmap.txt @@ -23,6 +23,9 @@ canonical real names and email addresses. SYNTAX ------ +The '#' character begins a comment to the end of line, blank lines +are ignored. + In the simple form, each line in the file consists of the canonical real name of an author, whitespace, and an email address used in the commit (enclosed by '<' and '>') to map to the name. For example: @@ -94,8 +97,6 @@ Other Author Santa Claus ------------ -Use hash '#' for comments that are either on their own line, or after -the email address. SEE ALSO From patchwork Tue Jan 12 20:17:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014863 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7DA4C433E6 for ; Tue, 12 Jan 2021 21:46:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8019F2312A for ; Tue, 12 Jan 2021 21:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438038AbhALVhN (ORCPT ); Tue, 12 Jan 2021 16:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436851AbhALUTP (ORCPT ); Tue, 12 Jan 2021 15:19:15 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5792FC0617A3 for ; Tue, 12 Jan 2021 12:18:22 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id w5so3821460wrm.11 for ; Tue, 12 Jan 2021 12:18:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tzpO8spHMX0Zxlaxn+pDX+gQCynmj/1QgUVN7enLepo=; b=MnjzQbcLBtkfuEebmV7xP6PVhxyFqdr/uw0U5sSb6wlZrUQfFTy2KjIdVZzOrD0+Qb v9rkeahbBCIYrk4SpCyImmoySLRGWqaJeAgXplsbMKUnmkv3v3Pcuak6L5RXu4Y3F7kU NkEkXym2f8TcScZ+dNFmS/9+x5MXkMCxDHKksrhijNeTasxBzV69K9ZwOaS6Bw+FAY9g drIj3fTe4SmNpbXJ+5epXvw/u5T4gsHyhvPQElOLChZMgXBPWd0on/6EwE3z0Mui4Iz0 RsLoDwJ9yRBGcj1QGLW4+EZr9GmDJuypzQp/6i9TbRWabZmlX1EhxCdSuBZZotIkxsOv qdEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tzpO8spHMX0Zxlaxn+pDX+gQCynmj/1QgUVN7enLepo=; b=C8zPz9jk9DYQLVjeiBTiuL7c1A3008otpyxw9nFNeKyocoGFnaCCpHfSk+IAxy19Vj +69jIlWDqhRp0EAihBavpX3b8RProuyh0ZkaSTf6Go8ehhUvc59pr+DPhPHXJ3ipn6Cq 4az96OA8i99VuPwFVi9H0Eg87I1DxemTpOWj2nygof++kfoBToBy8oO8K9x7Q54lTLSq x+LkCzYAo50kJ6DI9+KACFW19FVQK6mdj4beTpTKFHq9tCNlHBoTis+GDwusnTSdlUDN HW8TA7M0qwScEOrxgGf8Vy/rJqdj9etN5EVexut4OvRSvLFJXQN38xGNwTk6Vh3hkAY8 E7fg== X-Gm-Message-State: AOAM532bAtAYe9rWbW2Sf5IYunSriLsbn6bmC07uPvjjo5mGzkob9d9+ rB2WzMt5SmVPPlIXk74CgNyGbhaIYq5yHw== X-Google-Smtp-Source: ABdhPJzyGO6KqAcCdqzoebfZfWl5HQdxkRAjKJflwWj2IVT8mu2UR3GvP8f2hI59gxJrnda+w18U+g== X-Received: by 2002:adf:e590:: with SMTP id l16mr554152wrm.294.1610482700859; Tue, 12 Jan 2021 12:18:20 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:19 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 05/22] mailmap tests: use our preferred whitespace syntax Date: Tue, 12 Jan 2021 21:17:49 +0100 Message-Id: <20210112201806.13284-6-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change these tests to use the preferred whitespace around ">", "<<-EOF" etc. This is an initial step in larger and more meaningful refactoring of the file, which makes a subsequent commit easier to read. I'm not changing the whitespace of "echo > file" patterns to "echo >file" because all of those will be changed to here-docs in a subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 586c3a86b1..034a78aba1 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -13,7 +13,7 @@ fuzz_blame () { } test_expect_success setup ' - cat >contacts <<- EOF && + cat >contacts <<-EOF && $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> nick1 EOF @@ -33,7 +33,7 @@ test_expect_success 'check-mailmap no arguments' ' ' test_expect_success 'check-mailmap arguments' ' - cat >expect <<- EOF && + cat >expect <<-EOF && $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> nick1 EOF @@ -44,7 +44,7 @@ test_expect_success 'check-mailmap arguments' ' ' test_expect_success 'check-mailmap --stdin' ' - cat >expect <<- EOF && + cat >expect <<-EOF && $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> nick1 EOF @@ -195,10 +195,10 @@ test_expect_success 'No mailmap files, but configured' ' test_expect_success 'setup mailmap blob tests' ' git checkout -b map && test_when_finished "git checkout master" && - cat >just-bugs <<- EOF && + cat >just-bugs <<-\EOF && Blob Guy EOF - cat >both <<- EOF && + cat >both <<-EOF && Blob Guy <$GIT_AUTHOR_EMAIL> Blob Guy EOF @@ -471,7 +471,7 @@ test_expect_success 'Log output with log.mailmap' ' ' test_expect_success 'log.mailmap=false disables mailmap' ' - cat >expect <<- EOF && + cat >expect <<-EOF && Author: CTO Author: claus Author: santa @@ -480,12 +480,12 @@ test_expect_success 'log.mailmap=false disables mailmap' ' Author: nick1 Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git -c log.mailmap=False log | grep Author > actual && + git -c log.mailmap=False log | grep Author >actual && test_cmp expect actual ' test_expect_success '--no-use-mailmap disables mailmap' ' - cat >expect <<- EOF && + cat >expect <<-EOF && Author: CTO Author: claus Author: santa From patchwork Tue Jan 12 20:17:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7226BC433E0 for ; Tue, 12 Jan 2021 21:46:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1EB0F23123 for ; Tue, 12 Jan 2021 21:46:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405516AbhALVhM (ORCPT ); Tue, 12 Jan 2021 16:37:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436854AbhALUTP (ORCPT ); Tue, 12 Jan 2021 15:19:15 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E10CC0617A4 for ; Tue, 12 Jan 2021 12:18:24 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id d26so3806575wrb.12 for ; Tue, 12 Jan 2021 12:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2lkQJYZosjrDDIJHFBFVqj3GEMy/9c+BLkaTLLR5ZcI=; b=iT0tAmjY4+wR0SmWENlMeIwqDO5pBq6DdMz1igk2DZMgdulyeBNOusrJTs7TmuEeC5 gT4hrvkIJ71Mf9UGyVGC1acqLkzNvQevuSdNE+l/bBJIXfHgptwgr69nNtaAQZPcp6GR wjhuCmT3l/StfdL5YvRXZpQEXTifCl4+VTTczXCDRmbhtOoDDRq/33C/DZgRqGAqdxrM byU7XblAvEBe1ANTj+gsXNdyVdPdQS1tMhkytcQ+75jI3KAXZymHc5v6tx2bMUOy7wax eADH6acZdUocqexYLQ733K8RNH6SkPmYhhMFnjGjnar8rEoKmuCslOGMRZY0LcbhsI3H dQJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2lkQJYZosjrDDIJHFBFVqj3GEMy/9c+BLkaTLLR5ZcI=; b=G9DRHyDtnfV591MSxUMgVxNZzCGjwZKERJyv9pGyJWgnvvT1iaxMGlK7Fh/Ri4w1mn M91noJJlGvgRDFkxYR01B5GwcPr7lh3nhOFHDFfi14biitBTTS9aVI2/4yLKa76f343b J7KJMmxpicTCNMY+oW6VDrave59UScP3PD/JOhkFOQKdpfexoP0srahGRmAl8gn04nzu VDhCgy/uKoHb6rx9fYzzae9glANjIYgUzc5Hh7iCg5r2MSDHCancG2Fnp5Q1ec9mp23i WvYvIDoP5jmfBi5fVXT0tyn3pKYtM86Xhc1MP8BYF8mCsOstsLFErYAr3wXS+6CehWjq zRfQ== X-Gm-Message-State: AOAM533UrdbbyFQQHrQC4h2YIT+jVpFFTyzrzb/9YR5Wx4haXC2Cskzl HVpvgHdJqa9ybaJCyPtnTTTwICxyGI1S7Q== X-Google-Smtp-Source: ABdhPJzpC/HDDnIq9Suy6f4bHypKVaDWAF+hCVs7szSaNrNbVXaM8K6POCTXp8ddWPVqZqi8YMVWFg== X-Received: by 2002:a5d:6a88:: with SMTP id s8mr574983wru.118.1610482702645; Tue, 12 Jan 2021 12:18:22 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:21 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 06/22] mailmap tests: modernize syntax & test idioms Date: Tue, 12 Jan 2021 21:17:50 +0100 Message-Id: <20210112201806.13284-7-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor the mailmap tests to: * Setup "actual" test files in the body of "test_expect_success" * Don't have X of "test_expect_success X Y" be an unquoted string. * Not to carry over test config between tests, and instead use "test_config". * Replace various "echo" a line-at-a-time patterns with here-docs. * Change a case of "log.mailmap=False" to use the lower-case "false". Both work, but this ends up in git-config's boolean parsing and these atypical values are tested for elsewhere. Let's use the lower-case to not draw the reader's attention to this abnormality. * Remove commentary asserting that things work a given way in favor of simply testing for it, i.e. in the case of a .mailmap file outside of the repository. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 473 ++++++++++++++++++++++++++------------------- 1 file changed, 274 insertions(+), 199 deletions(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 034a78aba1..61d1b62317 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -12,7 +12,7 @@ fuzz_blame () { " "$@" } -test_expect_success setup ' +test_expect_success 'setup commits and contacts file' ' cat >contacts <<-EOF && $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> nick1 @@ -66,128 +66,164 @@ test_expect_success 'check-mailmap bogus contact' ' test_must_fail git check-mailmap bogus ' -cat >expect << EOF -$GIT_AUTHOR_NAME (1): - initial - -nick1 (1): - second +test_expect_success 'No mailmap' ' + cat >expect <<-EOF && + $GIT_AUTHOR_NAME (1): + initial -EOF + nick1 (1): + second -test_expect_success 'No mailmap' ' + EOF git shortlog HEAD >actual && test_cmp expect actual ' -cat >expect <<\EOF -Repo Guy (1): - initial +test_expect_success 'setup default .mailmap' ' + cat >default.map <<-EOF + Repo Guy <$GIT_AUTHOR_EMAIL> + EOF +' + +test_expect_success 'test default .mailmap' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && -nick1 (1): - second + cat >expect <<-\EOF && + Repo Guy (1): + initial -EOF + nick1 (1): + second -test_expect_success 'default .mailmap' ' - echo "Repo Guy <$GIT_AUTHOR_EMAIL>" > .mailmap && + EOF git shortlog HEAD >actual && test_cmp expect actual ' -# Using a mailmap file in a subdirectory of the repo here, but -# could just as well have been a file outside of the repository -cat >expect <<\EOF -Internal Guy (1): - second +test_expect_success 'mailmap.file set' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && -Repo Guy (1): - initial + test_config mailmap.file internal.map && + cat >internal.map <<-\EOF && + Internal Guy + EOF -EOF -test_expect_success 'mailmap.file set' ' - mkdir -p internal_mailmap && - echo "Internal Guy " > internal_mailmap/.mailmap && - git config mailmap.file internal_mailmap/.mailmap && + cat >expect <<-\EOF && + Internal Guy (1): + second + + Repo Guy (1): + initial + + EOF git shortlog HEAD >actual && - test_cmp expect actual + test_cmp expect actual && + + # The internal_mailmap/.mailmap file is an a subdirectory, but + # as shown here it can also be outside the repository + test_when_finished "rm -rf sub-repo" && + git clone . sub-repo && + ( + cd sub-repo && + cp ../.mailmap . && + git config mailmap.file ../internal.map && + git shortlog HEAD >actual && + test_cmp ../expect actual + ) ' -cat >expect <<\EOF -External Guy (1): - initial +test_expect_success 'mailmap.file override' ' + test_config mailmap.file internal.map && + cat >internal.map <<-EOF && + Internal Guy + External Guy <$GIT_AUTHOR_EMAIL> + EOF -Internal Guy (1): - second + cat >expect <<-\EOF && + External Guy (1): + initial -EOF -test_expect_success 'mailmap.file override' ' - echo "External Guy <$GIT_AUTHOR_EMAIL>" >> internal_mailmap/.mailmap && - git config mailmap.file internal_mailmap/.mailmap && + Internal Guy (1): + second + + EOF git shortlog HEAD >actual && test_cmp expect actual ' -cat >expect <<\EOF -Repo Guy (1): - initial +test_expect_success 'mailmap.file non-existent' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && -nick1 (1): - second + cat >expect <<-\EOF && + Repo Guy (1): + initial -EOF + nick1 (1): + second -test_expect_success 'mailmap.file non-existent' ' - rm internal_mailmap/.mailmap && - rmdir internal_mailmap && + EOF git shortlog HEAD >actual && test_cmp expect actual ' -cat >expect <<\EOF -Internal Guy (1): - second +test_expect_success 'name entry after email entry' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && -Repo Guy (1): - initial + test_config mailmap.file internal.map && + cat >internal.map <<-\EOF && + + Internal Guy + EOF -EOF + cat >expect <<-\EOF && + Internal Guy (1): + second + + Repo Guy (1): + initial + + EOF -test_expect_success 'name entry after email entry' ' - mkdir -p internal_mailmap && - echo " " >internal_mailmap/.mailmap && - echo "Internal Guy " >>internal_mailmap/.mailmap && git shortlog HEAD >actual && test_cmp expect actual ' -cat >expect <<\EOF -Internal Guy (1): - second +test_expect_success 'name entry after email entry, case-insensitive' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && -Repo Guy (1): - initial + test_config mailmap.file internal.map && + cat >internal.map <<-\EOF && + + Internal Guy + EOF -EOF + cat >expect <<-\EOF && + Internal Guy (1): + second + + Repo Guy (1): + initial + + EOF -test_expect_success 'name entry after email entry, case-insensitive' ' - mkdir -p internal_mailmap && - echo " " >internal_mailmap/.mailmap && - echo "Internal Guy " >>internal_mailmap/.mailmap && git shortlog HEAD >actual && test_cmp expect actual ' -cat >expect << EOF -$GIT_AUTHOR_NAME (1): - initial +test_expect_success 'No mailmap files, but configured' ' + cat >expect <<-EOF && + $GIT_AUTHOR_NAME (1): + initial -nick1 (1): - second + nick1 (1): + second -EOF -test_expect_success 'No mailmap files, but configured' ' - rm -f .mailmap internal_mailmap/.mailmap && + EOF git shortlog HEAD >actual && test_cmp expect actual ' @@ -205,11 +241,16 @@ test_expect_success 'setup mailmap blob tests' ' printf "Tricky Guy <$GIT_AUTHOR_EMAIL>" >no-newline && git add just-bugs both no-newline && git commit -m "my mailmaps" && - echo "Repo Guy <$GIT_AUTHOR_EMAIL>" >.mailmap && - echo "Internal Guy <$GIT_AUTHOR_EMAIL>" >internal.map + + cat >internal.map <<-EOF + Internal Guy <$GIT_AUTHOR_EMAIL> + EOF ' test_expect_success 'mailmap.blob set' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && + cat >expect <<-\EOF && Blob Guy (1): second @@ -223,6 +264,9 @@ test_expect_success 'mailmap.blob set' ' ' test_expect_success 'mailmap.blob overrides .mailmap' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && + cat >expect <<-\EOF && Blob Guy (2): initial @@ -250,6 +294,9 @@ test_expect_success 'mailmap.file overrides mailmap.blob' ' ' test_expect_success 'mailmap.blob can be missing' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && + cat >expect <<-\EOF && Repo Guy (1): initial @@ -267,11 +314,15 @@ test_expect_success 'mailmap.blob defaults to off in non-bare repo' ' ( cd non-bare && test_commit one .mailmap "Fake Name <$GIT_AUTHOR_EMAIL>" && - echo " 1 Fake Name" >expect && + cat >expect <<-\EOF && + 1 Fake Name + EOF git shortlog -ns HEAD >actual && test_cmp expect actual && rm .mailmap && - echo " 1 $GIT_AUTHOR_NAME" >expect && + cat >expect <<-EOF && + 1 $GIT_AUTHOR_NAME + EOF git shortlog -ns HEAD >actual && test_cmp expect actual ) @@ -281,7 +332,9 @@ test_expect_success 'mailmap.blob defaults to HEAD:.mailmap in bare repo' ' git clone --bare non-bare bare && ( cd bare && - echo " 1 Fake Name" >expect && + cat >expect <<-\EOF && + 1 Fake Name + EOF git shortlog -ns HEAD >actual && test_cmp expect actual ) @@ -300,50 +353,46 @@ test_expect_success 'mailmap.blob can handle blobs without trailing newline' ' test_cmp expect actual ' -test_expect_success 'cleanup after mailmap.blob tests' ' - rm -f .mailmap -' - test_expect_success 'single-character name' ' - echo " 1 A <$GIT_AUTHOR_EMAIL>" >expect && - echo " 1 nick1 " >>expect && - echo "A <$GIT_AUTHOR_EMAIL>" >.mailmap && test_when_finished "rm .mailmap" && + cat >.mailmap <<-EOF && + A <$GIT_AUTHOR_EMAIL> + EOF + + cat >expect <<-EOF && + 1 A <$GIT_AUTHOR_EMAIL> + 1 nick1 + EOF git shortlog -es HEAD >actual && test_cmp expect actual ' test_expect_success 'preserve canonical email case' ' - echo " 1 $GIT_AUTHOR_NAME " >expect && - echo " 1 nick1 " >>expect && - echo " <$GIT_AUTHOR_EMAIL>" >.mailmap && test_when_finished "rm .mailmap" && + cat >.mailmap <<-EOF && + <$GIT_AUTHOR_EMAIL> + EOF + + cat >expect <<-EOF && + 1 $GIT_AUTHOR_NAME + 1 nick1 + EOF git shortlog -es HEAD >actual && test_cmp expect actual ' -# Extended mailmap configurations should give us the following output for shortlog -cat >expect << EOF -$GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1): - initial - -CTO (1): - seventh - -Other Author (2): - third - fourth - -Santa Claus (2): - fifth - sixth - -Some Dude (1): - second - -EOF - test_expect_success 'Shortlog output (complex mapping)' ' + test_config mailmap.file complex.map && + cat >complex.map <<-EOF && + Committed <$GIT_COMMITTER_EMAIL> + + Some Dude nick1 + Other Author nick2 + Other Author + Santa Claus + Santa Claus + EOF + echo three >>one && git add one && test_tick && @@ -369,103 +418,119 @@ test_expect_success 'Shortlog output (complex mapping)' ' test_tick && git commit --author "CTO " -m seventh && - mkdir -p internal_mailmap && - echo "Committed <$GIT_COMMITTER_EMAIL>" > internal_mailmap/.mailmap && - echo " " >> internal_mailmap/.mailmap && - echo "Some Dude nick1 " >> internal_mailmap/.mailmap && - echo "Other Author nick2 " >> internal_mailmap/.mailmap && - echo "Other Author " >> internal_mailmap/.mailmap && - echo "Santa Claus " >> internal_mailmap/.mailmap && - echo "Santa Claus " >> internal_mailmap/.mailmap && + cat >expect <<-EOF && + $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1): + initial + + CTO (1): + seventh + + Other Author (2): + third + fourth + + Santa Claus (2): + fifth + sixth + + Some Dude (1): + second + + EOF git shortlog -e HEAD >actual && test_cmp expect actual ' -# git log with --pretty format which uses the name and email mailmap placemarkers -cat >expect << EOF -Author CTO maps to CTO -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> +test_expect_success 'Log output (complex mapping)' ' + test_config mailmap.file complex.map && -Author claus maps to Santa Claus -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + cat >expect <<-EOF && + Author CTO maps to CTO + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -Author santa maps to Santa Claus -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + Author claus maps to Santa Claus + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -Author nick2 maps to Other Author -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + Author santa maps to Santa Claus + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -Author nick2 maps to Other Author -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + Author nick2 maps to Other Author + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -Author nick1 maps to Some Dude -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + Author nick2 maps to Other Author + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -Author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> -Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> -EOF + Author nick1 maps to Some Dude + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + + Author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> maps to $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + Committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> maps to Committed <$GIT_COMMITTER_EMAIL> + EOF -test_expect_success 'Log output (complex mapping)' ' git log --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && test_cmp expect actual ' -cat >expect << EOF -Author email cto@coompany.xx has local-part cto -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME +test_expect_success 'Log output (local-part email address)' ' + cat >expect <<-EOF && + Author email cto@coompany.xx has local-part cto + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email me@company.xx has local-part me -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + Author email me@company.xx has local-part me + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email me@company.xx has local-part me -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + Author email me@company.xx has local-part me + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email nick2@company.xx has local-part nick2 -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + Author email nick2@company.xx has local-part nick2 + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email bugs@company.xx has local-part bugs -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + Author email bugs@company.xx has local-part bugs + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email bugs@company.xx has local-part bugs -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + Author email bugs@company.xx has local-part bugs + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -Author email author@example.com has local-part author -Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME -EOF + Author email author@example.com has local-part author + Committer email $GIT_COMMITTER_EMAIL has local-part $TEST_COMMITTER_LOCALNAME + EOF -test_expect_success 'Log output (local-part email address)' ' git log --pretty=format:"Author email %ae has local-part %al%nCommitter email %ce has local-part %cl%n" >actual && test_cmp expect actual ' -cat >expect << EOF -Author: CTO -Author: Santa Claus -Author: Santa Claus -Author: Other Author -Author: Other Author -Author: Some Dude -Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> -EOF - test_expect_success 'Log output with --use-mailmap' ' + test_config mailmap.file complex.map && + + cat >expect <<-EOF && + Author: CTO + Author: Santa Claus + Author: Santa Claus + Author: Other Author + Author: Other Author + Author: Some Dude + Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + EOF + git log --use-mailmap | grep Author >actual && test_cmp expect actual ' -cat >expect << EOF -Author: CTO -Author: Santa Claus -Author: Santa Claus -Author: Other Author -Author: Other Author -Author: Some Dude -Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> -EOF - test_expect_success 'Log output with log.mailmap' ' + test_config mailmap.file complex.map && + + cat >expect <<-EOF && + Author: CTO + Author: Santa Claus + Author: Santa Claus + Author: Other Author + Author: Other Author + Author: Some Dude + Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + EOF + git -c log.mailmap=True log | grep Author >actual && test_cmp expect actual ' @@ -480,7 +545,7 @@ test_expect_success 'log.mailmap=false disables mailmap' ' Author: nick1 Author: $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> EOF - git -c log.mailmap=False log | grep Author >actual && + git -c log.mailmap=false log | grep Author >actual && test_cmp expect actual ' @@ -498,56 +563,66 @@ test_expect_success '--no-use-mailmap disables mailmap' ' test_cmp expect actual ' -cat >expect <<\EOF -Author: Santa Claus -Author: Santa Claus -EOF - test_expect_success 'Grep author with --use-mailmap' ' + test_config mailmap.file complex.map && + + cat >expect <<-\EOF && + Author: Santa Claus + Author: Santa Claus + EOF git log --use-mailmap --author Santa | grep Author >actual && test_cmp expect actual ' -cat >expect <<\EOF -Author: Santa Claus -Author: Santa Claus -EOF test_expect_success 'Grep author with log.mailmap' ' + test_config mailmap.file complex.map && + + cat >expect <<-\EOF && + Author: Santa Claus + Author: Santa Claus + EOF + git -c log.mailmap=True log --author Santa | grep Author >actual && test_cmp expect actual ' test_expect_success 'log.mailmap is true by default these days' ' + test_config mailmap.file complex.map && git log --author Santa | grep Author >actual && test_cmp expect actual ' test_expect_success 'Only grep replaced author with --use-mailmap' ' + test_config mailmap.file complex.map && git log --use-mailmap --author "" >actual && test_must_be_empty actual ' -# git blame -cat >expect <expect <<-EOF && + ^OBJI ($GIT_AUTHOR_NAME DATE 1) one + OBJID (Some Dude DATE 2) two + OBJID (Other Author DATE 3) three + OBJID (Other Author DATE 4) four + OBJID (Santa Claus DATE 5) five + OBJID (Santa Claus DATE 6) six + OBJID (CTO DATE 7) seven + EOF + git blame one >actual && fuzz_blame actual >actual.fuzz && test_cmp expect actual.fuzz ' -cat >expect <<\EOF -Some Dude -EOF - test_expect_success 'commit --author honors mailmap' ' + test_config mailmap.file complex.map && + + cat >expect <<-\EOF && + Some Dude + EOF + test_must_fail git commit --author "nick" --allow-empty -meight && git commit --author "Some Dude" --allow-empty -meight && git show --pretty=format:"%an <%ae>%n" >actual && From patchwork Tue Jan 12 20:17:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BC5DC10DAA for ; Tue, 12 Jan 2021 21:43:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C6B3E23123 for ; Tue, 12 Jan 2021 21:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438062AbhALVhU (ORCPT ); Tue, 12 Jan 2021 16:37:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436866AbhALUTf (ORCPT ); Tue, 12 Jan 2021 15:19:35 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B76EAC0617A5 for ; Tue, 12 Jan 2021 12:18:26 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id r3so3871853wrt.2 for ; Tue, 12 Jan 2021 12:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0QQWYtmAHJxXWtlODKa3IWICvGBvVoeTSt0o6QhaXss=; b=b7tw1zaP6JlMD6YVFbbn4zO0sLbastdVL/4E6z5MirJL7XfzAifKzFq1HRMTwHUlJD hnvSkuRIaC/5ingLmXypiHfUkWRkgWPRIVs/tgaouAk0l3k5aEtDVxVxfP1L/fz0TNP0 q7Ut/cibkCaTXvJtXcmB4QYbJujMy6mAAMjrzjVBhmCZ7YuVVIXFYhwpqPBjbACEF+ol ODRGfJ2B5g51fObz3HFa+DKkC+tnrtgJQe7LEw7HwgnltuqGFwVaGWLHO09Gz+S23vjd TF4qnPGL1iVEWdVN0WOQw4CSmbBSOJLhWkmOWMdHUvlv7GAhlTBuVuNmzUuU5hG1a/Eo BAzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0QQWYtmAHJxXWtlODKa3IWICvGBvVoeTSt0o6QhaXss=; b=GjR9NNqOaUb92eiFV8Sq6+9HFYNItiWTx4PXRPzmd1rZYCuf32/NUXevynEfqFZOB4 gqWKYPb7JJjHwGNvxZ5uqtf3LOfa4hkLkfbkEReJgkaU5i76R/1sOa6SiQ1ueyif2osf IKwJmgVdolXGBLKIVLWjpvvXErxTdeoi6v1m21yhWQNnMO/WnyPT8DPd1WELijcjn/J0 wveYlAMy5vASlWOZWO+qV/MARVeYPe04TN4baRRfWRrIse44mISc+oxACXdvNpf15bK4 Wv9jsFc4AeQodoEOwb8KTn17WWLGnwO0v8Uz+TH0pNNnEZDbqqqJ7nBrEUBdsAhKZ61w bS/g== X-Gm-Message-State: AOAM530HYDa7IbMlzqCShln2EcFoj1ZJAJD7hoRePNr50PWMuAMM/dIZ 3yVLAx34/DVmbJCdwLMpzyvMEhlXkcXKJg== X-Google-Smtp-Source: ABdhPJxESrGLQvoM1zEqFY1m80fWG3lAdo95/WdPdKG99GhPZkgkgT5SjVmJQ/tpJw4SCMMY6GbZEQ== X-Received: by 2002:a5d:4ece:: with SMTP id s14mr498125wrv.427.1610482705178; Tue, 12 Jan 2021 12:18:25 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:23 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 07/22] mailmap tests: improve --stdin tests Date: Tue, 12 Jan 2021 21:17:51 +0100 Message-Id: <20210112201806.13284-8-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The --stdin tests setup the "contact" file in the main setup, let's instead set it up in the test that uses it. Also refactor the first test so it's obvious that the point of it is that "check-mailmap" will spew its input as-is when given no argument. For that one we can just use the "expect" file as-is. Also add tests for how other "--stdin" cases are handled, e.g. one where we actually do a mapping. For the rest of --stdin testing we just assume we're going to get the same output. We could follow-up and make sure everything's round-tripped through both --stdin and the file/blob backends, but I don't think there's much point in that. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 61d1b62317..dbd365681e 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -13,11 +13,6 @@ fuzz_blame () { } test_expect_success 'setup commits and contacts file' ' - cat >contacts <<-EOF && - $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> - nick1 - EOF - echo one >one && git add one && test_tick && @@ -48,24 +43,53 @@ test_expect_success 'check-mailmap --stdin' ' $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> nick1 EOF - git check-mailmap --stdin actual && + git check-mailmap --stdin actual && test_cmp expect actual ' -test_expect_success 'check-mailmap --stdin arguments' ' +test_expect_success 'check-mailmap --stdin arguments: no mapping' ' + test_when_finished "rm contacts" && + cat >contacts <<-EOF && + $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> + nick1 + EOF cat >expect <<-\EOF && Internal Guy EOF - cat >expect && + cat contacts >>expect && + git check-mailmap --stdin "Internal Guy " \ actual && test_cmp expect actual ' +test_expect_success 'check-mailmap --stdin arguments: mapping' ' + test_when_finished "rm .mailmap" && + cat >.mailmap <<-EOF && + New Name <$GIT_AUTHOR_EMAIL> + EOF + cat >stdin <<-EOF && + Old Name <$GIT_AUTHOR_EMAIL> + EOF + + cp .mailmap expect && + git check-mailmap --stdin actual && + test_cmp expect actual && + + cat .mailmap >>expect && + git check-mailmap --stdin "Another Old Name <$GIT_AUTHOR_EMAIL>" \ + actual && + test_cmp expect actual +' + test_expect_success 'check-mailmap bogus contact' ' test_must_fail git check-mailmap bogus ' +test_expect_success 'check-mailmap bogus contact --stdin' ' + test_must_fail git check-mailmap --stdin bogus expect <<-EOF && $GIT_AUTHOR_NAME (1): From patchwork Tue Jan 12 20:17:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014853 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AE49C07EBB for ; Tue, 12 Jan 2021 21:43:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F64423127 for ; Tue, 12 Jan 2021 21:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436934AbhALVhV (ORCPT ); Tue, 12 Jan 2021 16:37:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436869AbhALUTf (ORCPT ); Tue, 12 Jan 2021 15:19:35 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AB34C0617A6 for ; Tue, 12 Jan 2021 12:18:29 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id q18so3867947wrn.1 for ; Tue, 12 Jan 2021 12:18:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gq0wEbmaE+z6knB43LztlX5an7hfs653jER7XA1Bbws=; b=LWkEjKhcwGsGprUhIxk3xhRY7ptreS2e9QL0e3qef4pT+0Lj5RtDaMEDysCJUhbvTP hx61cgLYU9Gkz2C0uJpDj8Z66Gc1U3ix4WKi+WfM/+FFVG+RfGnJBlgTsc83K804V20V VosJgZ14JnAtt/k6OZDF15ndRru9a1HKiiXOaDcFjhjXlcHqvydQS9r4WhMKSMCzrpo/ HwbcuxhtxarDBecCezjmocyAALa+vJQPZFqoyxnVfTsVgcRckmLGUY7BHLZcuFiskgfh p1ftrugzwQrSoBCGRuKSWeeLWtyfADWWr/4i9YKMKoKJ3H9FfyDbllDbptdoRyBgFEC9 LeAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gq0wEbmaE+z6knB43LztlX5an7hfs653jER7XA1Bbws=; b=DiXVQlp1Q43rw52mwChUVicM34Mb/HEHuPo1ZIPSRZM9m+lzHUdzoBQFY9B1lLTk4A 9cNRhkmMKsePCMyKQoihtX3UOa+Nn+NoVkKFTCkRnYP2lmnVwnkP3a0EGNadIFLFTXRs re7vu+qp9kIukPUpCIH8sU3QjOoNxSzI56r0tqm1PggAwCf/8hRYqNk46Vps5+TAso5W Sl3wT4MK3++9UG8VpqoWOODkk++McWLhw6CaOQ5UzUiuhJYi1YzuTyYVCxKJEFlWEPWy YLZVQ7bm2RQCpwOCg1FqZRnm0IJ6QX58ewVV2k6hCXRy+1OlGSnSM2kytiiSh/9r+y87 OAQQ== X-Gm-Message-State: AOAM530fFdIEDtpEB44/YTtroagGbJV+3+obwpur8/9Aaul4AMR8EeOr 9d8ldEvajR1Km1IsCGyIPfYYsFHWzINK3g== X-Google-Smtp-Source: ABdhPJyKAlJeeYbTPdIj6RU4PnBnxXTm4QyHv04hbJzcQwwX6krqMw+WF79ogBllicaMbosaahzLEw== X-Received: by 2002:a5d:4ad0:: with SMTP id y16mr536588wrs.424.1610482707929; Tue, 12 Jan 2021 12:18:27 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:25 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 08/22] mailmap tests: remove redundant entry in test Date: Tue, 12 Jan 2021 21:17:52 +0100 Message-Id: <20210112201806.13284-9-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove a redundant line in a test added in d20d654fe8 (Change current mailmap usage to do matching on both name and email of author/committer., 2009-02-08). This didn't conceivably test anything useful and is most likely a copy/paste error. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index dbd365681e..03a98d9635 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -414,7 +414,6 @@ test_expect_success 'Shortlog output (complex mapping)' ' Other Author nick2 Other Author Santa Claus - Santa Claus EOF echo three >>one && From patchwork Tue Jan 12 20:17:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12379C433E9 for ; Tue, 12 Jan 2021 21:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B743023122 for ; Tue, 12 Jan 2021 21:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438083AbhALVhX (ORCPT ); Tue, 12 Jan 2021 16:37:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436871AbhALUTh (ORCPT ); Tue, 12 Jan 2021 15:19:37 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32FFC0617A7 for ; Tue, 12 Jan 2021 12:18:30 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id 91so3834327wrj.7 for ; Tue, 12 Jan 2021 12:18:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dj1Cbb2WzdiwGMOLPxlsdX0/nBb1sg62xe7BLduS/Gs=; b=dGgp6RB9diTuIzEoERtegrVXxZ7psZhuva9zDAsskj+AOyx103qtrBx9wXvVdYUOxA Aygy5omzgM0WhoAqLHkPCS0+47Zkb2B64FjSq76dMkSAMXbMZxFLAGVnBvE8Qev6n3GO N0BAUiQeFFGt33yx5NSJnFW1QSrtOn45Fuxl/0DhW8GMSzsNUD1SQ7wrKSOl5XtXJNiU 8DHSSgqO4CyeUf2gA/fCtG5Caw0zTDLXhmCsXm9QKApiA5oSX1Zi5J3gehFvcklATEV2 7gZ3cKT83E4wlgl9NjhzkBWW12QWIy0LPSd9tVNQOyleYMwDdhy5zWOaSTniq1+yHQ/E 2zHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Dj1Cbb2WzdiwGMOLPxlsdX0/nBb1sg62xe7BLduS/Gs=; b=rXIeMUIIn54PpJXA6tW/ryeNWA+uTCA7yZLK7OGSz/Fb77reMEb4WHyoeikaV8awdN SIDrFC/gqA1aBKSJejnulj5SW3bNmVobwSwzS8jfr8EGba3sadPSIdfIc74sOcRFcCCL zdV1BvSV2xNZynPFe0nAT1irc6TWMVeByf/E5GKDKNdFG018yWcC17QJO3a7BcjU302m jZy8QjE69vOppdNGRx2L1/YOuNgRRMzFBxBXtOvJTZhs32CGQtr4tzpYaKemLgwo+3Bc 0XPFeql2l1tbWiPYBBltSIXeUdItgtko2JPFdSIUdvkebrw7lG2gObwrQi+MorJ0jsic s+0Q== X-Gm-Message-State: AOAM5320Ah1RvBohh2CaoCTczkwUsrLQsdtS9JMVW3Q1hMYbOL/RXUSk n1ouaMW5he77vfCUoLAKEUptpCJlJ2bUkw== X-Google-Smtp-Source: ABdhPJwLStk12N2WMF2tduCM/kH+SCjWbfz33TlT3HKzKXVJhTbXyoyIVS5pYnUxuJqrMZemSxywxg== X-Received: by 2002:adf:c18d:: with SMTP id x13mr552781wre.128.1610482709521; Tue, 12 Jan 2021 12:18:29 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:28 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 09/22] mailmap tests: add a test for "not a blob" error Date: Tue, 12 Jan 2021 21:17:53 +0100 Message-Id: <20210112201806.13284-10-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a test for one of the error conditions added in 938a60d64f (mailmap: clean up read_mailmap error handling, 2012-12-12). Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 03a98d9635..78d56e0566 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -333,6 +333,15 @@ test_expect_success 'mailmap.blob can be missing' ' test_cmp expect actual ' +test_expect_success 'mailmap.blob might be the wrong type' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && + + git -c mailmap.blob=HEAD: shortlog HEAD >actual 2>err && + test_i18ngrep "mailmap is not a blob" err && + test_cmp expect actual +' + test_expect_success 'mailmap.blob defaults to off in non-bare repo' ' git init non-bare && ( From patchwork Tue Jan 12 20:17:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1CE0C07D5B for ; Tue, 12 Jan 2021 21:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9997F23123 for ; Tue, 12 Jan 2021 21:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438077AbhALVhV (ORCPT ); Tue, 12 Jan 2021 16:37:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436873AbhALUTh (ORCPT ); Tue, 12 Jan 2021 15:19:37 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 648C8C0617A9 for ; Tue, 12 Jan 2021 12:18:32 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id r7so3844897wrc.5 for ; Tue, 12 Jan 2021 12:18:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=maAeeEQVtyl0NBRV/WsprOcQIO71et3ouvCpkbhWTK4=; b=fbGEbhjBuHqohPGiozyshKkAm91rZ6HVSgLYe55f0zDmoKpcU3v6GJhLKWkbR7AqJb I/sOzSkZXGpIn9J0BoRYyHDumXWqlvQlvcMly34KvPz7VDNEvJhM/mLzuv0fY2O5r1Cn 5kdMHSCzQXnc8ZlRS+LH5MhxO1MzkrUooMi2Mwwnzxi1HyiKOEXVa7LtHY0dwdRIWWtT IuuKGhvmF+G6h7dFPuNEklS0wiXBRlMlJ6Jw6mQe8bzAET9T+UKB4gZq+PKS5oD6f5ui mBzEtOEwpmVS2z/kNVILjW9NtLA8YmV6fdh+CIpC3W5f6WlzxmU5F7Z27CeYsBQpmolL SyPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=maAeeEQVtyl0NBRV/WsprOcQIO71et3ouvCpkbhWTK4=; b=ESppSWuDrX/1Dc7tz18gXcgafbreLXjJUjmbiUvjG5S38Bo/xj3UfrSFedryMPNbrS aH3qhwtLouU3D+G1JO55brfBjTadv7x/PMVR+J3W2MUM98y73MUBDYhVI0uBwIMmUQzX 4J4MpfY/7ocvJC8OUT4zcUYAqk8zEmW0KZB1smxYUfzgsxN3v+HRPT6LC2bTajOEGVRr 9j940wJUrKset7qAEttC1fDmQV+JIdjYfDFJwW3HwjTZGNgUKQFo0MwIY9312ZZvq90G hx63RvWSh66XD8TOwGvXzErytyfjFJWT9QiLNdLXiuwnJsbbupkWFT8grkRvklNwCaqN gzEQ== X-Gm-Message-State: AOAM533YHIITZk+GzNRwMiL9rOaypMrsmDT3RAdtjy1Hnyz+fmGpbCjZ pXURGNpYXUjyVt0IoVwzCISmeByTEg0Vog== X-Google-Smtp-Source: ABdhPJxFn/R3aP+iKMgOPnYpr0c77PzFq6r73FKlaRc1LnqeX49vc0liXvVLm9hKPn5FdtRbHOH9oQ== X-Received: by 2002:adf:e348:: with SMTP id n8mr572242wrj.148.1610482710838; Tue, 12 Jan 2021 12:18:30 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:29 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 10/22] mailmap tests: get rid of overly complex blame fuzzing Date: Tue, 12 Jan 2021 21:17:54 +0100 Message-Id: <20210112201806.13284-11-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a test that used a custom fuzzing function since bfdfa3d414 (t4203 (mailmap): stop hardcoding commit ids and dates, 2010-10-15) to just use the "blame --porcelain" output instead. We could use the same pattern as 0ba9c9a0fb (t8008: rely on rev-parse'd HEAD instead of sha1 value, 2017-07-26) does to do this, but there wouldn't be any point. We're not trying to test "blame" output here in general, just that "blame" pays attention to the mailmap. So it's sufficient to get the blamed line(s) and authors from the output, which is much easier with the "--porcelain" option. It would still be possible for there to be a bug in "blame" such that it uses the mailmap for its "--porcelain" output, but not the regular output. Let's test for that simply by checking if specifying the mailmap changes the output. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- t/t4203-mailmap.sh | 50 +++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 78d56e0566..a42b454756 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -4,14 +4,6 @@ test_description='.mailmap configurations' . ./test-lib.sh -fuzz_blame () { - sed " - s/$_x05[0-9a-f][0-9a-f][0-9a-f]/OBJID/g - s/$_x05[0-9a-f][0-9a-f]/OBJI/g - s/[-0-9]\{10\} [:0-9]\{8\} [-+][0-9]\{4\}/DATE/g - " "$@" -} - test_expect_success 'setup commits and contacts file' ' echo one >one && git add one && @@ -630,24 +622,42 @@ test_expect_success 'Only grep replaced author with --use-mailmap' ' test_must_be_empty actual ' -test_expect_success 'Blame output (complex mapping)' ' +test_expect_success 'Blame --porcelain output (complex mapping)' ' test_config mailmap.file complex.map && cat >expect <<-EOF && - ^OBJI ($GIT_AUTHOR_NAME DATE 1) one - OBJID (Some Dude DATE 2) two - OBJID (Other Author DATE 3) three - OBJID (Other Author DATE 4) four - OBJID (Santa Claus DATE 5) five - OBJID (Santa Claus DATE 6) six - OBJID (CTO DATE 7) seven - EOF - - git blame one >actual && - fuzz_blame actual >actual.fuzz && + 1 1 1 + A U Thor + 2 2 1 + Some Dude + 3 3 1 + Other Author + 4 4 1 + Other Author + 5 5 1 + Santa Claus + 6 6 1 + Santa Claus + 7 7 1 + CTO + EOF + + git blame --porcelain one >actual.blame && + grep -E \ + -e "[0-9]+ [0-9]+ [0-9]+$" \ + -e "^author .*$" \ + actual.blame >actual.grep && + cut -d " " -f2-4 actual.fuzz && test_cmp expect actual.fuzz ' +test_expect_success 'Blame output (complex mapping)' ' + git -c mailmap.file=complex.map blame one >a && + git blame one >b && + test_file_not_empty a && + ! cmp a b +' + test_expect_success 'commit --author honors mailmap' ' test_config mailmap.file complex.map && From patchwork Tue Jan 12 20:17:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E3DAC432C3 for ; Tue, 12 Jan 2021 21:43:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5D1C23122 for ; Tue, 12 Jan 2021 21:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438088AbhALVhY (ORCPT ); Tue, 12 Jan 2021 16:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436875AbhALUTi (ORCPT ); Tue, 12 Jan 2021 15:19:38 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28096C0617AA for ; Tue, 12 Jan 2021 12:18:34 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id c5so3842364wrp.6 for ; Tue, 12 Jan 2021 12:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4sXaunXpiEs9/dvTUkulS/Q647AX0OJ89L8T2tHibYw=; b=QGxxoyHElVbgUxwtCG8P+WuOH74nB9Kb5eDVUnRlc6yTXwyEnZQUgw0XGClAqfyBGw d8jVeMHZR7SgZi2BwOMIdeTCSHU2N+bq/16vMRpc4HDS6EeZ8Idz0jah5iBdnhr8qk/X 26r977P7r2UIZOKie++8sx+Gq3Rh1nzzGmZ7DX7J9OXf4KmvrY4n5/70PpNHPgqDl0uV +y8vevLsUE4W0WWxov+nkn7Rt5ZfqBC+/pviu+QJk2kS/u2+uTFVXy6C33igz3d5o91O pvM74QcRwOMZfdJG6FDWeXn2iDhwLZYSeUNoHAT2RnFtj4qcUB4JSY79Cjg4c7A03t4X QNAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4sXaunXpiEs9/dvTUkulS/Q647AX0OJ89L8T2tHibYw=; b=bMYmLKYjlsSTdTLWdrTIOCQfuzrS1hBohUXxtZWmFADQpFO/clnxzO5ZbVC9KKUrSV lrwShPsGZCY9Y0XfCmtRLCWuHv/Olmvnp1yXm40k2TvNoIj8Njc7jPPGS8sof2zs4B+j y1Cc6jpmEx+YCAEcwqKQdS8sVYaa5Lj7NfOX+DH4OFFJE7ptKezISfwkCe9mCGYe6Vr2 Y1exb4imruT2cRpqQ43WuKnria8JMrP1GCDpFYTIAWfJl79tZZ2WiEavO1aYONZiQcnK F+ort2utn7mM1yB8F3Gw57mR+mkKJU2RGbcjQqUziNZnVo2ruxn+cYbCiq7keZo49SSn Yv0g== X-Gm-Message-State: AOAM530to3jqWAswEcGW34p6vCoBWctKaqYTWcc8UR3R6Q7HprZJ0FCs DbsElx2F9PiVKPxPIRysiPPDr0KrpR6I8A== X-Google-Smtp-Source: ABdhPJxHJXSwfiRPFhJGR+18DUS/dayZFs2pU5cqCIgi9C8kJZZXF0XBgZEcNS9OMFdGhZgDNMQFHg== X-Received: by 2002:adf:db44:: with SMTP id f4mr526312wrj.169.1610482712638; Tue, 12 Jan 2021 12:18:32 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:31 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 11/22] mailmap: test for silent exiting on missing file/blob Date: Tue, 12 Jan 2021 21:17:55 +0100 Message-Id: <20210112201806.13284-12-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org That we silently ignore missing mailmap.file or mailmap.blob values is intentional. See 938a60d64f (mailmap: clean up read_mailmap error handling, 2012-12-12). However, nothing tested for this. Let's do that by checking that stderr is empty in those cases. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index a42b454756..2b342d7f7c 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -309,6 +309,24 @@ test_expect_success 'mailmap.file overrides mailmap.blob' ' test_cmp expect actual ' +test_expect_success 'mailmap.file can be missing' ' + test_when_finished "rm .mailmap" && + cp default.map .mailmap && + + test_config mailmap.file nonexistent && + cat >expect <<-\EOF && + Repo Guy (1): + initial + + nick1 (1): + second + + EOF + git shortlog HEAD >actual 2>err && + test_must_be_empty err && + test_cmp expect actual +' + test_expect_success 'mailmap.blob can be missing' ' test_when_finished "rm .mailmap" && cp default.map .mailmap && @@ -321,7 +339,8 @@ test_expect_success 'mailmap.blob can be missing' ' second EOF - git -c mailmap.blob=map:nonexistent shortlog HEAD >actual && + git -c mailmap.blob=map:nonexistent shortlog HEAD >actual 2>err && + test_must_be_empty err && test_cmp expect actual ' From patchwork Tue Jan 12 20:17:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75410C4332E for ; Tue, 12 Jan 2021 21:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 43D6223122 for ; Tue, 12 Jan 2021 21:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437059AbhALVhY (ORCPT ); Tue, 12 Jan 2021 16:37:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436876AbhALUTi (ORCPT ); Tue, 12 Jan 2021 15:19:38 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62EA0C061786 for ; Tue, 12 Jan 2021 12:18:36 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id d13so3813045wrc.13 for ; Tue, 12 Jan 2021 12:18:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w5dPSi2cBbzusmhOSLzAnu1a620aUwocVNxqpBXnIjc=; b=RuNQ/82LSk9vR4wDifIeGIy+rrs2dz+CihDdiyNhMSgKkmBnet5E8MfIOI9pTZOano OiHNMiEJnx01Ee2d/MmJk+aZ6cl2V+tTVfw6me+tvPR1wmi3dbvxDX36Jpeifnewk/0P x3qzWj+qSz+WrrsgeeUaWFH3GGCShN7B7b3WgfS+1qIvvfWN8tf7f5Cu0bsmZEDylNm6 EYUwRdhHyDeGLInIFYrSfkmHQpeFCa9VQEBpVNyjuVSqTdTD2XEYWyGtwjszVGnjo5ne 6n7dTL0z/+x8CuxRFmm3KUcu5PJGCgrVbDUxoa6chd8XgLLYUEqkNYsYGUZkNl2/uFmN klDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w5dPSi2cBbzusmhOSLzAnu1a620aUwocVNxqpBXnIjc=; b=ChbUwZIy4jRC3JYfna975LwIwgllwFcV4u91d/vfulhY+75l+6kBLY12QTYAaChsSs wrc6MyQk5dyesA9T+YKPXz4I1ypLhPTZRM206NUl1nMCd9fZmnqW9vTNHCQnEiGK7s59 tqalBVbJAMvcefJd4MjHbHuzNDbAJ3FqIeTpQpcoKnAcoVqp/poNVe6d/xOYcd9gexUy 50OJmd2WXfL9tscd1A3ADR6TY19cxESIkoKou3992BB8ZnYQnfR6uuPEgDxAa3KrMhrz TMvsv6CeZiwIUZGOllTIp9QAgg0cQ6/5qmG/LpgI+UobxrbKbW0yfHqsy4Ch+Wk8yl+r palA== X-Gm-Message-State: AOAM531Wwg4jmZ5cBp38qHtwuwImtXeaYoBuE9oUlB5mh2NsVJWAr5sT PsI08dRTUXF/W6ZeBwkdj7eiHv0QUX+yBA== X-Google-Smtp-Source: ABdhPJzeyjFbvLnqEM1hHDD9AqrTt5ByLaluGZhC5fd41+FBBvwVqVfbqZvnSzIdsiCTZie3rYei3Q== X-Received: by 2002:a5d:4a06:: with SMTP id m6mr539291wrq.189.1610482714940; Tue, 12 Jan 2021 12:18:34 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:33 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 12/22] test-lib functions: expand "test_commit" comment template Date: Tue, 12 Jan 2021 21:17:56 +0100 Message-Id: <20210112201806.13284-13-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Expand the comment template for "test_commit" to match that of "test_commit_bulk" added in b1c36cb849 (test-lib: introduce test_commit_bulk, 2019-07-02). It has several undocumented options, which won't all fit on one line. Follow-up commit(s) will document them. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/test-lib-functions.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 999982fe4a..396e039d2a 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -178,16 +178,14 @@ debug () { GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7 } -# Call test_commit with the arguments -# [-C ] [ [ []]]" +# Usage: test_commit [options] [ [ []]] +# -C : +# Run all git commands in directory # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. # # , , and all default to . -# -# If the first argument is "-C", the second argument is used as a path for -# the git invocations. test_commit () { notick= && From patchwork Tue Jan 12 20:17:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014849 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF6EFC433E0 for ; Tue, 12 Jan 2021 21:43:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A06FD23127 for ; Tue, 12 Jan 2021 21:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438125AbhALVh0 (ORCPT ); Tue, 12 Jan 2021 16:37:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436877AbhALUTk (ORCPT ); Tue, 12 Jan 2021 15:19:40 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87AF1C0617AB for ; Tue, 12 Jan 2021 12:18:37 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id n16so2400773wmc.0 for ; Tue, 12 Jan 2021 12:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XJWKJ/CIVB8URp+6npPRrveo3/JUVRe7nRgR27ox9IA=; b=hbrW8NOks0MakctKNoASaHFWDk5/MK9l34JuhLBgcZBDfPLqxk0dboAmZo2C7Quddk K7hkz4ymp56AbUM7D988aJXvlb5QttRZJgSP+m3sw3o+n6doXZXg10pi4I1R5DDtmrXQ N9GpHMLT2vNLOiqio/0tFuCUg6xG+ZVzZfFw1dt/Ujemq1yToZvQMxw57kLPXbKBqkes vMSc1tQ5z4qSI26/qTr8LGsUNnMVSgtg1bob/unf9m3gHmfNjB+LaRa4EjhwzfN++Obc uQxEst4fH0rdo9bIWYYmGhLHKilfXKQafQxUL+704Nsco9yjiiz/a2mZXh5flKIY2H7C YDYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XJWKJ/CIVB8URp+6npPRrveo3/JUVRe7nRgR27ox9IA=; b=XctL+tWaRwvfyJkvLm0bM3ZbjBcrFVVTsKKSOUiXPsIMA0rsZxqp+u6IzGoL+Gs6Ao LotRR5Nfyk6XYkNBWm6az6jsMLQ/9q8TOWQ/PfhzAiEEIhCkTuMiYjRLaPZr4HJkyBnd Esq37hV5AS5CxEQ/SdSfQ9N4FfB7WQ9SvJk3tUOulNlJ8Hqj+zxPRot2WkCjdLl6pUg7 XJDri1LlfYseJ/3avIIb7+1vh7aM01uJPK2l1tX2xW01wSx2lSMKdPblB78BRWTqhgU5 kPfwK1ommGdk9+KLdhrI33QFySCcOIBwPrxXG8/6eO/fEKXnuh5C+po2I5pzQmHGOULY G7BQ== X-Gm-Message-State: AOAM532JaI3tf2jMPXqbjlYgO7P5XhAYcnGw+jFKqcjsGIKsB0EkFDUr YvdDL4LlV4hBf1M/rlFnq/nu6915Xtm79g== X-Google-Smtp-Source: ABdhPJw8AXqTkuCA311crKyklOyX3GW8ZKo3/YfwDJ2NTTLKf2L1gomSc1H/Ezx4biXEUZTZXTWA8g== X-Received: by 2002:a7b:c246:: with SMTP id b6mr897082wmj.154.1610482716064; Tue, 12 Jan 2021 12:18:36 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:35 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 13/22] test-lib functions: document arguments to test_commit Date: Tue, 12 Jan 2021 21:17:57 +0100 Message-Id: <20210112201806.13284-14-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The --notick argument was added in [1] and was followed by --signoff in [2], but neither of these commits added any documentation for these options. When -C was added in [3] a comment was added to document it, but not the other options. Let's document all of these options. 1. 44b85e89d7 (t7003: add test to filter a branch with a commit at epoch, 2012-07-12), 2. 5ed75e2a3f (cherry-pick: don't forget -s on failure, 2012-09-14). 3. 6f94351b0a (test-lib-functions.sh: teach test_commit -C , 2016-12-08) Signed-off-by: Ævar Arnfjörð Bjarmason --- t/test-lib-functions.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 396e039d2a..194b601bc0 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -181,6 +181,10 @@ debug () { # Usage: test_commit [options] [ [ []]] # -C : # Run all git commands in directory +# --notick +# Do not call test_tick before making a commit +# --signoff +# Invoke "git commit" with --signoff # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. From patchwork Tue Jan 12 20:17:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11B01C433DB for ; Tue, 12 Jan 2021 21:43:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAEE423123 for ; Tue, 12 Jan 2021 21:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438115AbhALVhZ (ORCPT ); Tue, 12 Jan 2021 16:37:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436878AbhALUTk (ORCPT ); Tue, 12 Jan 2021 15:19:40 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19137C0617B0 for ; Tue, 12 Jan 2021 12:18:39 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id y17so3812376wrr.10 for ; Tue, 12 Jan 2021 12:18:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ke29G83NNsmb6HLJxtPdUXwXpHHhGnuKUg6jtsexGtE=; b=InDWQbd9iodNQUnBlM2AgZGB14qvhSX3e8DPyxbPg2/UcNVwVyF42DTWRzLOeGHPxt L0El7ReU+u90vaVs9GLLLzBmZ7BvK6FTxxfjH8qv7KB3WLCRzx7xuvXRaPAjpIpcpOmv tlJ1NiTUplc1CAwb5q5TeAzRXcn7i5jaSOYmJL/Y2nnuLOUlARBWAy2XjB0uFpzkV939 nFqBiIg+jOsrXy7axN7l8RiRTgAzBrhr7HjMNDsNOj64OI3Ycl8VGzYZUY3pA3WDvQ9p pzFHEIV205/GPKMB+QEZVbsKSzwim0YeEqF25XLtLaqxtGH4ymm32oAV2x0NoU6jUZXm OspA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ke29G83NNsmb6HLJxtPdUXwXpHHhGnuKUg6jtsexGtE=; b=JrxaYh5BHEW8sJnwaTLdx2SQUOJANrDk4QurCIv/qdT2Hw6/Wdg5vj+lWZidzDpy4z WWgRbsuBkI+4TBkAKlitZYz/c5UE+N7kYZ6MpfhOWKdgkzHfMFaaOcohZga7LGWRu7Jv qeKh0qFwxdVEBPJHGP48XnXOjqV8JpHl2VMo+cqh/IqhxACMTGOipyYLSuISS0Alafgh be4iRkFxAuSmavz5f8Cf6jSAvQzDvVh5uxPiJiXSYBJv51oPFCuyLZCKNmPVFmh0lkeQ Kh5hzkXiqjh64CWKlr8Jb9l+v49FT075RRoVSLEKh5WHwm8JQhljJ3WYxhLZ0iccpJjo OBZQ== X-Gm-Message-State: AOAM5329Gt5oY0HZE+lTSMJKzL7uVV7y7vaurcTmKsisGpZFJ6ioQ5AQ GdiMK47jeskqH+MtEndR8loJ4ipN+A399g== X-Google-Smtp-Source: ABdhPJyymzidtWMbFIR5nwG8Oq22iKXdHO1ZmEjpqIIRXNLt7pLOlxYlDq2e9SfGT/4eS0zQnE3giw== X-Received: by 2002:adf:c403:: with SMTP id v3mr531076wrf.55.1610482717479; Tue, 12 Jan 2021 12:18:37 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:36 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 14/22] test-lib functions: add --author support to test_commit Date: Tue, 12 Jan 2021 21:17:58 +0100 Message-Id: <20210112201806.13284-15-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add support for --author to "test_commit". This will simplify some current and future tests, one of those is being changed here. Let's also line-wrap the "git commit" command invocation to make diffs that add subsequent options easier to add, as they'll only need to add a new option line. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t7509-commit-authorship.sh | 7 ++----- t/test-lib-functions.sh | 11 ++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/t/t7509-commit-authorship.sh b/t/t7509-commit-authorship.sh index 500ab2fe72..ee6c47416e 100755 --- a/t/t7509-commit-authorship.sh +++ b/t/t7509-commit-authorship.sh @@ -18,11 +18,8 @@ message_body () { } test_expect_success '-C option copies authorship and message' ' - echo "Initial" >foo && - git add foo && - test_tick && - git commit -m "Initial Commit" --author Frigate\ \ && - git tag Initial && + test_commit --author Frigate\ \ \ + "Initial Commit" foo Initial Initial && echo "Test 1" >>foo && test_tick && git commit -a -C Initial && diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 194b601bc0..529f6264fe 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -185,6 +185,8 @@ debug () { # Do not call test_tick before making a commit # --signoff # Invoke "git commit" with --signoff +# --author= +# Invoke "git commit" with --author= # # This will commit a file with the given contents and the given commit # message, and tag the resulting commit with the given tag name. @@ -193,6 +195,7 @@ debug () { test_commit () { notick= && + author= && signoff= && indir= && while test $# != 0 @@ -201,6 +204,10 @@ test_commit () { --notick) notick=yes ;; + --author) + author="$2" + shift + ;; --signoff) signoff="$1" ;; @@ -222,7 +229,9 @@ test_commit () { then test_tick fi && - git ${indir:+ -C "$indir"} commit $signoff -m "$1" && + git ${indir:+ -C "$indir"} commit \ + ${author:+ --author "$author"} \ + $signoff -m "$1" && git ${indir:+ -C "$indir"} tag "${4:-$1}" } From patchwork Tue Jan 12 20:17:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014839 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79811C07D5A for ; Tue, 12 Jan 2021 21:42:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 478AA23122 for ; Tue, 12 Jan 2021 21:42:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438135AbhALVh1 (ORCPT ); Tue, 12 Jan 2021 16:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436879AbhALUTm (ORCPT ); Tue, 12 Jan 2021 15:19:42 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 228AFC0617B1 for ; Tue, 12 Jan 2021 12:18:41 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 3so3311870wmg.4 for ; Tue, 12 Jan 2021 12:18:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FgDqqsHnnRDTaA/0ja+ZvMf8GdOBArz+IBlJ8/zn0hU=; b=peWbWB3Z7l5Xh7WbbaLkP6ex0xBH8RzoW4qJ+A1BLce4QSHH5sypm3/pQ1nKtBfWxo mjoSQXc2BDa9MZN/Omb9klsjghpnDU9aydcyCh8Ro0tx17eVZQH3nXtyB1JxP/gyu68F QdmP396sW7k/roy3L9AEOyHSYc6ZDlyV2ktGuuXgKSFI0PLU744uEI6/OHWjYhcjGX/4 fSRe5FbT7c93jribjvk0lQyQxkGUc+Ev7CxnMLEHLw/n7v9PPgeXj7Z3eRPlkTu4asyc s+uoDxltF2QJ4ohmh3okc4cGhWgyM7S8kT1D1vWQkPOC1RcZOQdMq0ZVIQev/8rdgCBS jHCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FgDqqsHnnRDTaA/0ja+ZvMf8GdOBArz+IBlJ8/zn0hU=; b=TFVz+lR0F7zDAeClCsjXQRgs0dYbaxjJqNv20+Nyq5qWri5BD3k26+57Wrg8GL9CbL AQ206JaaT4+vV/pJbAc7FzVYY4Ik3gR5sMQGQT4HLqZeqFmqvM6fmz6MOMvzpvjcdnE/ +RSsuq8vvU223I2A3Z+IQeONCmi6fFeB0EY/CvnFY/znrverso7gCu+y7NNDFz6KLK9/ QYAWMH/mU/40lWz1NpQIbS4Mq8mT5RAS2aDYQ+Hhp4o6N7GsOBd1vgJ4uc1qkPZNWK7r 0tFB77fB5fzJ6N+3m7qxhHzvESEvGByED534eBc2p/4Z0C6so7p39BpmA4UAK6hNg0R3 gC7g== X-Gm-Message-State: AOAM5320EiFKN8Juj4znr4PY2/nRd4lCbUoq+e2kPewfYBd8vGw/Mt8Z 0T8jRZs7sxJDGRF+eGOkiKxfGc8cWIaSbw== X-Google-Smtp-Source: ABdhPJw5XBrLS+ZaOPG3d0XAE/sgLjVhdTAhE/pMEMKegL8Pck3D7m4Py4PNpibONnrw9G/P4UZyYA== X-Received: by 2002:a1c:4489:: with SMTP id r131mr936266wma.24.1610482719560; Tue, 12 Jan 2021 12:18:39 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:38 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 15/22] test-lib functions: add an --append option to test_commit Date: Tue, 12 Jan 2021 21:17:59 +0100 Message-Id: <20210112201806.13284-16-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add an --append option to test_commit to append to the we're writing to. This simplifies a lot of test setup, as shown in some of the tests being changed here. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 39 +++++++-------------------------------- t/test-lib-functions.sh | 14 +++++++++++++- 2 files changed, 20 insertions(+), 33 deletions(-) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 2b342d7f7c..5d92880a5a 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -5,14 +5,8 @@ test_description='.mailmap configurations' . ./test-lib.sh test_expect_success 'setup commits and contacts file' ' - echo one >one && - git add one && - test_tick && - git commit -m initial && - echo two >>one && - git add one && - test_tick && - git commit --author "nick1 " -m second + test_commit initial one one && + test_commit --author "nick1 " --append second one two ' test_expect_success 'check-mailmap no arguments' ' @@ -436,30 +430,11 @@ test_expect_success 'Shortlog output (complex mapping)' ' Santa Claus EOF - echo three >>one && - git add one && - test_tick && - git commit --author "nick2 " -m third && - - echo four >>one && - git add one && - test_tick && - git commit --author "nick2 " -m fourth && - - echo five >>one && - git add one && - test_tick && - git commit --author "santa " -m fifth && - - echo six >>one && - git add one && - test_tick && - git commit --author "claus " -m sixth && - - echo seven >>one && - git add one && - test_tick && - git commit --author "CTO " -m seventh && + test_commit --author "nick2 " --append third one three && + test_commit --author "nick2 " --append fourth one four && + test_commit --author "santa " --append fifth one five && + test_commit --author "claus " --append sixth one six && + test_commit --author "CTO " --append seventh one seven && cat >expect <<-EOF && $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> (1): diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 529f6264fe..b0a5d74dc7 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -183,6 +183,9 @@ debug () { # Run all git commands in directory # --notick # Do not call test_tick before making a commit +# --append +# Use "echo >>" instead of "echo >" when writing "" to +# "" # --signoff # Invoke "git commit" with --signoff # --author= @@ -195,6 +198,7 @@ debug () { test_commit () { notick= && + append= && author= && signoff= && indir= && @@ -204,6 +208,9 @@ test_commit () { --notick) notick=yes ;; + --append) + append=yes + ;; --author) author="$2" shift @@ -223,7 +230,12 @@ test_commit () { done && indir=${indir:+"$indir"/} && file=${2:-"$1.t"} && - echo "${3-$1}" > "$indir$file" && + if test -n "$append" + then + echo "${3-$1}" >>"$indir$file" + else + echo "${3-$1}" >"$indir$file" + fi && git ${indir:+ -C "$indir"} add "$file" && if test -z "$notick" then From patchwork Tue Jan 12 20:18:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D73B1C4360C for ; Tue, 12 Jan 2021 21:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACEDA23121 for ; Tue, 12 Jan 2021 21:42:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437101AbhALVh1 (ORCPT ); Tue, 12 Jan 2021 16:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436883AbhALUTm (ORCPT ); Tue, 12 Jan 2021 15:19:42 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EED5C0617B9 for ; Tue, 12 Jan 2021 12:18:43 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id t16so3865690wra.3 for ; Tue, 12 Jan 2021 12:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z4Ume2w83CGfLz5W95CZmWjd4oB3YWF7eatdtPXwYK4=; b=IA194zY+dLGA8iN9j3YaU6Z0EiiYlW8W1OpzakBlaZ1T/LlmoNBsyoW5O91jt4MHbl 6nfEGB+htrqXI/TbJ5oBYriRMmUCBk/uWTHvNtr6LI1iTH6VD5G2hPPHNjQ2tX70MGy0 sR+1mOnRbjWf/QSpUg9CpGYGdWc4SW6iLIEj6BF0C6CsxxDVyfxl1sEIxP+YYjZYUsUl f7YuUQqkRJM4dhVMwao7OCcBPS9bQ8TSeV4sF6NLpMs5VckeksenZegbTOJJY1tz0znZ tZVh+v81CbI+xGImyvMf0SiUn5oj1BF9Hp4gNIzjJr17HS9xvK8oSo0aIa4M3rfGXGyo UG2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z4Ume2w83CGfLz5W95CZmWjd4oB3YWF7eatdtPXwYK4=; b=cCAnx5J2tKuKFaa+xk2KWThFFJmtX0YY1d/J4GD/6CYDx5twaY9GXuGX613HVnxLOz dtaWiaxwPpyffarIp8FgD+qvQlJLNsOYR+H5rr1MKMhDAomxHMcDK2Zapmo0BGoVP62f tNu2d2HmV7B8nzgp7j8QJ7VLfoETjq4YWhDDn/vKO316f7aqNxjzRRuV1j5/huDBtC+J xh+91/eQuByPldkSb5JsDma+8wjv/OCPjqRHu2cew23iWVUyqnFJU+SdpPnFr2/TdAEL 7klITYZ/Mhymb4oSyIyEosnoW/Z73jWhhf7bnWGtsFPa2Q0Ny1Fy1E7XHpz6w0TFu0zG 7DZw== X-Gm-Message-State: AOAM531POdFpbVHqFH0R+GR9J12y/6QLv7kdb/Ky7JGMPXos5hVxGvc4 4FdJ/DATzXMbdiEc5g/kob5bGpfMR4VMEw== X-Google-Smtp-Source: ABdhPJz20RqqXOiERgJuFcsY65Fu0DE+Hcs1kFtiJDxiHsFb/xmYibHE6c8kD/DuiadAz01AjoaGIA== X-Received: by 2002:a5d:5227:: with SMTP id i7mr587743wra.68.1610482721711; Tue, 12 Jan 2021 12:18:41 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:40 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 16/22] tests: refactor a few tests to use "test_commit --append" Date: Tue, 12 Jan 2021 21:18:00 +0100 Message-Id: <20210112201806.13284-17-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Refactor a few more tests to use the new "--append" option to "test_commit". I added it for use in the mailmap tests, but this demonstrates how useful it is in general. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t1412-reflog-loop.sh | 7 ++----- t/t2012-checkout-last.sh | 12 +++--------- t/t7810-grep.sh | 18 +++--------------- 3 files changed, 8 insertions(+), 29 deletions(-) diff --git a/t/t1412-reflog-loop.sh b/t/t1412-reflog-loop.sh index 3acd895afb..977603f7f1 100755 --- a/t/t1412-reflog-loop.sh +++ b/t/t1412-reflog-loop.sh @@ -4,11 +4,8 @@ test_description='reflog walk shows repeated commits again' . ./test-lib.sh test_expect_success 'setup commits' ' - test_tick && - echo content >file && git add file && git commit -m one && - git tag one && - echo content >>file && git add file && git commit -m two && - git tag two + test_commit one file content && + test_commit --append two file content ' test_expect_success 'setup reflog with alternating commits' ' diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh index e7ba8c505f..c95aa3e78f 100755 --- a/t/t2012-checkout-last.sh +++ b/t/t2012-checkout-last.sh @@ -5,13 +5,9 @@ test_description='checkout can switch to last branch and merge base' . ./test-lib.sh test_expect_success 'setup' ' - echo hello >world && - git add world && - git commit -m initial && + test_commit initial world hello && git branch other && - echo "hello again" >>world && - git add world && - git commit -m second + test_commit --append second world "hello again" ' test_expect_success '"checkout -" does not work initially' ' @@ -93,9 +89,7 @@ test_expect_success 'switch to twelfth from the last' ' test_expect_success 'merge base test setup' ' git checkout -b another other && - echo "hello again" >>world && - git add world && - git commit -m third + test_commit --append third world "hello again" ' test_expect_success 'another...master' ' diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index 991d5bd9c0..312e0f8cb4 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -687,21 +687,9 @@ test_expect_success 'grep -C1 hunk mark between files' ' ' test_expect_success 'log grep setup' ' - echo a >>file && - test_tick && - GIT_AUTHOR_NAME="With * Asterisk" \ - GIT_AUTHOR_EMAIL="xyzzy@frotz.com" \ - git commit -a -m "second" && - - echo a >>file && - test_tick && - git commit -a -m "third" && - - echo a >>file && - test_tick && - GIT_AUTHOR_NAME="Night Fall" \ - GIT_AUTHOR_EMAIL="nitfol@frobozz.com" \ - git commit -a -m "fourth" + test_commit --append --author "With * Asterisk " second file a && + test_commit --append third file a && + test_commit --append --author "Night Fall " fourth file a ' test_expect_success 'log grep (1)' ' From patchwork Tue Jan 12 20:18:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54E13C4332D for ; Tue, 12 Jan 2021 21:43:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BE0223122 for ; Tue, 12 Jan 2021 21:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437020AbhALVhU (ORCPT ); Tue, 12 Jan 2021 16:37:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436858AbhALUTa (ORCPT ); Tue, 12 Jan 2021 15:19:30 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97641C0617BA for ; Tue, 12 Jan 2021 12:18:46 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id y17so3812673wrr.10 for ; Tue, 12 Jan 2021 12:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1jURmx6GhDLLiSmp7AtWgrmCSWU/VLl1BGxVdDoZk7w=; b=jIx8TMdJt8e2P2czPNUEa9NXJvqTqnbeirR4p9CWebSBMT/BR+ka635zLhgcC8Djlj fLVcFxWnVVNQmoCBsZBF0gSj4cMJPKEK7ezCniim4zNg9kzsYrYm0Rp3b2uGjSdPSAp7 nRSn5hSS6ZMuxrvxYFxEXbZGwMimxh1ylmLzSoReB/DwxVWL58lsFyZI8BmlY/Zhfb1g yVKTCnmJqzg4TusPBk6SAoOvRSBY1xRSrruyloLXlCAxf68gi3kybWMVDRuKEBZI7VNa NA4ZLz71ayXUtxrnXd9IP6qDl7VWRDhoXCGzZi/IhW8gxKxXBctt0oSRYdy38x+l8wDl 0ryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1jURmx6GhDLLiSmp7AtWgrmCSWU/VLl1BGxVdDoZk7w=; b=BlmVD7gsa8ctxtTMx77tuW+QwDebM4NrJvRDTzUdEaRqPEQ86xyTpUgFyZN0hd0/Jq GZ1zQ5vmA1ZLiw/ICf5UGvXA+k/wAcr/9wH+56meOPzTeN0PBKjUnNT/vGIcDUSQvTQL ycDyaW8lxxiiqgkLwjV1m9Af8Q+ZUmO1A3FTHaOsQ/liJ5ZtCj1p6emSI5EdHAJmrUgo ChdOKRCYpG4yB6wndBDC2t7ElsZcBRTSthT1GlShkI5IEhGCaBq+vGlsxL7Xi7f3AMnz gqtvaWG1B6ymawdrlDaOFvm6In8RpR1teK9uPpJvRabwDkt8Cp1zIhbie73tNX39BAU6 WlUg== X-Gm-Message-State: AOAM531fOAldiM2ts43VBYAVn08vhSV7NIWgKM4HRIPpw0giVr4vUr0d V1II665x7mQGfAU5ipz7r8b5oAMXASjE7A== X-Google-Smtp-Source: ABdhPJxKMELWYMQ/GMVbrZYIJNz+XtRbGWNa7aW1dOe3KcZqh3+ZT+9spvqjd7PsKRHP1CKv6HvdGg== X-Received: by 2002:a5d:4712:: with SMTP id y18mr531306wrq.229.1610482724978; Tue, 12 Jan 2021 12:18:44 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:42 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 17/22] mailmap doc + tests: add better examples & test them Date: Tue, 12 Jan 2021 21:18:01 +0100 Message-Id: <20210112201806.13284-18-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change the mailmap documentation added in 0925ce4d49 (Add map_user() and clear_mailmap() to mailmap, 2009-02-08) to continue discussing the Jane/Joe example. I think this makes things a lot less confusing as we're building up more complex examples using one set of data which covers all the things we'd like to discuss. Also add tests to assert that what our documentation says is what's actually happening. This is mostly (or entirely) covered by existing tests which I'm not deleting, but having these tests for the synopsis makes it easier to follow-along while reading the tests & docs. Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/gitmailmap.txt | 49 ++++++++++++-------- t/t4203-mailmap.sh | 88 ++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+), 20 deletions(-) diff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt index 4e4677018b..55dfebd1b1 100644 --- a/Documentation/gitmailmap.txt +++ b/Documentation/gitmailmap.txt @@ -53,7 +53,7 @@ commit matching both the specified commit name and email address. EXAMPLES -------- -Example 1: Your history contains commits by two authors, Jane +Your history contains commits by two authors, Jane and Joe, whose names appear in the repository under several forms: ------------ @@ -65,36 +65,45 @@ Jane D. ------------ Now suppose that Joe wants his middle name initial used, and Jane -prefers her family name fully spelled out. A proper `.mailmap` file -would look like: +prefers her family name fully spelled out. A `.mailmap` file to +correct the names would look like: ------------ -Jane Doe Joe R. Developer +Jane Doe +Jane Doe ------------ -Note how there is no need for an entry for ``, because the -real name of that author is already correct. +Note that there's no need to map the name for 'jane@laptop.(none)' to +only correct the names. However, leaving the obviously broken +`' and '' E-Mails as-is is +usually not what you want. A `.mailmap` file which also corrects those +is: -Example 2: Your repository contains commits from the following -authors: +------------ +Joe R. Developer +Jane Doe +Jane Doe +------------ + +Finally, let's say that Joe and Jane shared an E-Mail address, but not +a name, e.g. by having these two commits in the history generated by a +bug reporting system. I.e. names appearing in history as: ------------ -nick1 -nick2 -nick2 -santa -claus -CTO +Joe +Jane ------------ -Then you might want a `.mailmap` file that looks like: +A full `.mailmap` file which also handles those cases (an addition of +two lines to the above example) would be: + ------------ - -Some Dude nick1 -Other Author nick2 -Other Author -Santa Claus +Joe R. Developer +Jane Doe +Jane Doe +Joe R. Developer Joe +Jane Doe Jane ------------ diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 5d92880a5a..96ba5367c6 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -419,6 +419,94 @@ test_expect_success 'preserve canonical email case' ' test_cmp expect actual ' +test_expect_success 'gitmailmap(5) example output: setup' ' + test_create_repo doc && + test_commit -C doc --author "Joe Developer " A && + test_commit -C doc --author "Joe R. Developer " B && + test_commit -C doc --author "Jane Doe " C && + test_commit -C doc --author "Jane Doe " D && + test_commit -C doc --author "Jane D. " E +' + +test_expect_success 'gitmailmap(5) example output: example #1' ' + test_config -C doc mailmap.file ../doc.map && + cat >doc.map <<-\EOF && + Joe R. Developer + Jane Doe + Jane Doe + EOF + + cat >expect <<-\EOF && + Author Joe Developer maps to Joe R. Developer + Committer C O Mitter maps to C O Mitter + + Author Joe R. Developer maps to Joe R. Developer + Committer C O Mitter maps to C O Mitter + + Author Jane Doe maps to Jane Doe + Committer C O Mitter maps to C O Mitter + + Author Jane Doe maps to Jane Doe + Committer C O Mitter maps to C O Mitter + + Author Jane D maps to Jane Doe + Committer C O Mitter maps to C O Mitter + EOF + git -C doc log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + +test_expect_success 'gitmailmap(5) example output: example #2' ' + test_config -C doc mailmap.file ../doc.map && + cat >doc.map <<-\EOF && + Joe R. Developer + Jane Doe + Jane Doe + EOF + + cat >expect <<-\EOF && + Author Joe Developer maps to Joe R. Developer + Committer C O Mitter maps to C O Mitter + + Author Joe R. Developer maps to Joe R. Developer + Committer C O Mitter maps to C O Mitter + + Author Jane Doe maps to Jane Doe + Committer C O Mitter maps to C O Mitter + + Author Jane Doe maps to Jane Doe + Committer C O Mitter maps to C O Mitter + + Author Jane D maps to Jane Doe + Committer C O Mitter maps to C O Mitter + EOF + git -C doc log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + +test_expect_success 'gitmailmap(5) example output: example #3' ' + test_config -C doc mailmap.file ../doc.map && + cat >>doc.map <<-\EOF && + Joe R. Developer Joe + Jane Doe Jane + EOF + + test_commit -C doc --author "Joe " F && + test_commit -C doc --author "Jane " G && + + cat >>expect <<-\EOF && + + Author Joe maps to Joe R. Developer + Committer C O Mitter maps to C O Mitter + + Author Jane maps to Jane Doe + Committer C O Mitter maps to C O Mitter + EOF + git -C doc log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + + test_expect_success 'Shortlog output (complex mapping)' ' test_config mailmap.file complex.map && cat >complex.map <<-EOF && From patchwork Tue Jan 12 20:18:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014859 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 384E4C43332 for ; Tue, 12 Jan 2021 21:43:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE3EB23122 for ; Tue, 12 Jan 2021 21:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438045AbhALVhT (ORCPT ); Tue, 12 Jan 2021 16:37:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436855AbhALUTa (ORCPT ); Tue, 12 Jan 2021 15:19:30 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D15C0617BB for ; Tue, 12 Jan 2021 12:18:48 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id y187so3318890wmd.3 for ; Tue, 12 Jan 2021 12:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1/KwABnLhIWPuW6zI9VQL7LiE4m978JsQXxUfjG0lXY=; b=uLjAhUQLu6Kl32mdVqeLVHkw7d4My29L6Etlfx1gRZImQATODqqOKHGuQCjA43hX65 irV+CE+ag1CQb/0KmTtOWae4BcypYhcIPnhwsB16GQL1coKg+mGsqjgeqqa1C8FwQhiQ lshszjndiJ/S00dN0cOMEDso3cC5uK3WKBzIQ0Q7w1rkFJTQFIfCEckw5h1PrJM+vmsj bO9AjxK+ijCvOpbi2GAGWfsFLHcenG5s1O4ro8wAx2fjrPYSfDU5vLmFG2U25L5Rmeqz VGlw3cB4Jn/CiKk0QBCi+Sjkm60U+hbDqLzagZxisIEM3J4/aLqv0csWC9BjSXFdtjHY ZtQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1/KwABnLhIWPuW6zI9VQL7LiE4m978JsQXxUfjG0lXY=; b=JvXr9BrakD/HDlJF7fKJMSeEKGqTqY7lTMm4E2dwk5S6SB2dAIdQKyP2ipkZ6zTvPz dGouOlLhOXCkUUi9lIElrNUg1XEH+hNt1sqG5kPXq9RVa3PHkxItXxhJuBGypOKfRnmm x9ZaVKReuVIbI3RihD/4++OQnkpvk8vu2oA2wXUfndINmu/ghBAZcZp5aCnf8b9Xde3J 4g3bKcpuOLNYJOnh7KOsxYtuwFM0YgQgk3+flCto4n3NmGqUFS7Vx/NNRsElgX6PYSFk 7JxjLl0W7MZsQDuOi5EBz0dYAU3wUIRp+fHmYjGWyqXzfSGE0O1ng9mGbWJ17VeAvsVk 5t0Q== X-Gm-Message-State: AOAM531FodpZxmTAanFJoqvE5kX9BQVZGAloooHKHrlVpMbux9CPPjyN ZY8pTcwz+wzCO2Cc2ec+2EMCl2d8ITnjOQ== X-Google-Smtp-Source: ABdhPJxbvxDw/dnFykY6Fxewv1eaJXo5ZdGEfvWZc/gMZSob1zcaRVJ+8TH2KVBmZvL82FTi5Nel6g== X-Received: by 2002:a05:600c:410d:: with SMTP id j13mr857586wmi.95.1610482727006; Tue, 12 Jan 2021 12:18:47 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:45 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= , =?utf-8?q?Martin_?= =?utf-8?q?=C3=85gren?= Subject: [PATCH 18/22] mailmap tests: add a test for comment syntax Date: Tue, 12 Jan 2021 21:18:02 +0100 Message-Id: <20210112201806.13284-19-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add a test for mailmap comment syntax. As noted in [1] there was no test coverage for this. Let's make sure a future change doesn't break it. 1. https://lore.kernel.org/git/CAN0heSoKYWXqskCR=GPreSHc6twCSo1345WTmiPdrR57XSShhA@mail.gmail.com/ Reported-by: Martin Ågren Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 96ba5367c6..10e672e006 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -753,4 +753,37 @@ test_expect_success 'commit --author honors mailmap' ' test_cmp expect actual ' +test_expect_success 'comment syntax: setup' ' + test_create_repo comm && + test_commit -C comm --author "A " A && + test_commit -C comm --author "B " B && + test_commit -C comm --author "C <#@example.com>" C && + test_commit -C comm --author "D " D && + + test_config -C comm mailmap.file ../doc.map && + cat >>doc.map <<-\EOF && + # Ah + + ; Bee + Cee <#@example.com> + Dee + EOF + + cat >expect <<-\EOF && + Author A maps to A + Committer C O Mitter maps to C O Mitter + + Author B maps to ; Bee + Committer C O Mitter maps to C O Mitter + + Author C <#@example.com> maps to Cee + Committer C O Mitter maps to C O Mitter + + Author D maps to Dee + Committer C O Mitter maps to C O Mitter + EOF + git -C comm log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + test_done From patchwork Tue Jan 12 20:18:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78D0AC4332E for ; Tue, 12 Jan 2021 21:41:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 386AC23123 for ; Tue, 12 Jan 2021 21:41:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406967AbhALVhp (ORCPT ); Tue, 12 Jan 2021 16:37:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436889AbhALUTz (ORCPT ); Tue, 12 Jan 2021 15:19:55 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF3FC0617BC for ; Tue, 12 Jan 2021 12:18:51 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id w5so3822725wrm.11 for ; Tue, 12 Jan 2021 12:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/GbiPcxVPtVHZEDZbn05l7tKilW9oowR0P27rayiY/s=; b=hr4o0L4gv/mnclfvo410tYKKr8RfWlI+rdBcthIJD5eeYBu+QOojS42b5fKcjsyzoa cVItsAaIPlpQVo0qVYY1TJ0O5p5irWij7zhpYhTNdotm1Lc7CCRjl7Y5B3D00hQoCgh4 XsnISXVfgq5VPdyTYBZ7dkpvNeiIb582BWx15u2nII0aY5cimqGTb+yi1OOwRfLUPCq6 GGm/0tp+PuwF8Rv84Ii8qlR9qmBhQ7jWaknpoe70mUo5jm4t9VooQC2/O5Y2//j0APx6 lsj6Drr2Z2SImGRkTRO9dbyjt3yI2R79lhX2JQaLnYpZVoeL5BgMooqRK1AlVBTg5uaa xmgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/GbiPcxVPtVHZEDZbn05l7tKilW9oowR0P27rayiY/s=; b=K0Y6XIhUBco4W9bcZmHNrQmX36IXiNus3XjI+QKKsCN0xgXrQNYmS9TbLED6pMnIko 6SECZFxWBr4HTQ4HRALfgqiK/vYwjz6HKiDypgMszQUizNYRoG8Xd7lbci1OXTh1/wgO gQV2631cfC41QX/HnGYTdjZtIXRLRSXlnVQpuzVOBx55Ug1//HhAJ5HSBNiefLDIMrGm DEUveimdnymM2qoSgV7z0onEV5P72ZurI7iSYiReZ6x0PAUkocDL03nTn+ZJs3YYVZGw rRM9HhFmZpzw5YRcXjEV5N1qTluzg64wfzRdDwMWkW0Fl8/h7cV+yhs8V04/hiiksnxa szuw== X-Gm-Message-State: AOAM533QTxtCbVhFRq0nr3U8hkIOVeIh9YXt/iuDh8Y0DThvRp3ilek9 CvS1NGKviub13I2WdJx4Uk8gx8UEoCY3Iw== X-Google-Smtp-Source: ABdhPJywfGVUiaizldQEj9TXdmeDiKp/6pE+NQ0oC/9qfeMCTekk6pAwQMuiiyT2hPUhvOu0ZCHmNw== X-Received: by 2002:adf:8285:: with SMTP id 5mr500454wrc.289.1610482730236; Tue, 12 Jan 2021 12:18:50 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:47 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 19/22] mailmap tests: add tests for whitespace syntax Date: Tue, 12 Jan 2021 21:18:03 +0100 Message-Id: <20210112201806.13284-20-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add tests for mailmap's handling of whitespace, i.e. how it trims space within "<>" and around author names. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 10e672e006..4f61655c04 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -786,4 +786,56 @@ test_expect_success 'comment syntax: setup' ' test_cmp expect actual ' +test_expect_success 'whitespace syntax: setup' ' + test_create_repo space && + test_commit -C space --author "A " A && + test_commit -C space --author "B " B && + test_commit -C space --author " C " C && + test_commit -C space --author " D " D && + test_commit -C space --author "E E " E && + test_commit -C space --author "F F " F && + test_commit -C space --author "G G " G && + test_commit -C space --author "H H " H && + + test_config -C space mailmap.file ../space.map && + cat >>space.map <<-\EOF && + Ah < a@example.com > + Bee < b@example.com > + Cee C + dee D + eee E E + eff F F + gee G G + aitch H H + EOF + + cat >expect <<-\EOF && + Author A maps to A + Committer C O Mitter maps to C O Mitter + + Author B maps to B + Committer C O Mitter maps to C O Mitter + + Author C maps to Cee + Committer C O Mitter maps to C O Mitter + + Author D maps to dee + Committer C O Mitter maps to C O Mitter + + Author E E maps to eee + Committer C O Mitter maps to C O Mitter + + Author F F maps to eff + Committer C O Mitter maps to C O Mitter + + Author G G maps to gee + Committer C O Mitter maps to C O Mitter + + Author H H maps to H H + Committer C O Mitter maps to C O Mitter + EOF + git -C space log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + test_done From patchwork Tue Jan 12 20:18:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28CB6C433E0 for ; Tue, 12 Jan 2021 21:38:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2B7123102 for ; Tue, 12 Jan 2021 21:38:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438149AbhALVhm (ORCPT ); Tue, 12 Jan 2021 16:37:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436890AbhALUTz (ORCPT ); Tue, 12 Jan 2021 15:19:55 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE2AC061575 for ; Tue, 12 Jan 2021 12:18:59 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id e25so3335368wme.0 for ; Tue, 12 Jan 2021 12:18:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uhSlRfILJOy/AuRh3HA96omy9eVjPDse/iZzuXuS2Dc=; b=L5mSRoKe68qofdoQfunFUVxPyaOP6La52kOHwW3ivgjDGEtCmztkdc0Aaou0tn0tUk djGabJYn59pHy6/+03uRQpXdRnm6uhgA5urZkAbWG5tabwkGL/l7EG8+wIJid42I8zKp EniL1xOjha7RFyJDyHCX2KjOOMrUZYlU3uml1jpFEcwfhPfDsSzE/62cQKw/HEPJdxn6 m76RwQqxqLXLH9QQdT+YK+HFc7CONgPfsM77wCznH6lzOaxAqVIN+SuwpB0fTGLxNbZb e5vXK6FGT51nvMP86nl9ICsDGb+jGD1dWO+kVa/IOv8M/1Qui0Z7I7XostSEZRFB86dN a0YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uhSlRfILJOy/AuRh3HA96omy9eVjPDse/iZzuXuS2Dc=; b=ZKHvk7OxeAz8ZxZLLSl8hedMEhb1KPPD40gZEZUlm9cGYFDNUf1pavQbFoAGTSLTPC ag8LnLrAfizaSijz48LqIYMFRl/0B64UdN6fhSOciGSanzQCRk7DXbzKV0k8IWom+jAs dWAl9gVr1Vn41k6qGXfqkLd66mmBtB1WOTae9fkwwwcn6rPGouLZSpaasHG9vKqQ41oQ y8yISQabbAQlh9fOi6lF9CKTrFWWb+qCjY2iKzk7gzUp7knLKoY8vd4/9pGuYTOGIwws kw3p2A9KG3caNCYH87wwi15EVnHpXTBigm8DftuLm8tYMbjH4cFBH8DwwmTmAGtELKMR Tvfw== X-Gm-Message-State: AOAM530ZpBFAINTrX+W7SLNgq1ZPb4VcpB6z+v6Bcm3o2j8V6IWAqKPy cmblMwQF0F0vd0v5aPUwrdd60sFuE0HaEw== X-Google-Smtp-Source: ABdhPJyrOImJnA8eqJQQ7W3al95alD1cVq8rvXrdrRhTb6e1b3Qt/9TsRFv5SwDsttQ3ogCkcDQ7FA== X-Received: by 2002:a7b:cc90:: with SMTP id p16mr822583wma.105.1610482738228; Tue, 12 Jan 2021 12:18:58 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:50 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 20/22] mailmap tests: add tests for empty "<>" syntax Date: Tue, 12 Jan 2021 21:18:04 +0100 Message-Id: <20210112201806.13284-21-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add tests for mailmap's handling of "<>", which is allowed on the RHS, but not the LHS of a " " pair. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4203-mailmap.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index 4f61655c04..f19736fef1 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -838,4 +838,31 @@ test_expect_success 'whitespace syntax: setup' ' test_cmp expect actual ' +test_expect_success 'empty syntax: setup' ' + test_create_repo empty && + test_commit -C empty --author "A <>" A && + test_commit -C empty --author "B " B && + test_commit -C empty --author "C " C && + + test_config -C empty mailmap.file ../empty.map && + cat >>empty.map <<-\EOF && + Ah <> + Bee <> + Cee <> + EOF + + cat >expect <<-\EOF && + Author A <> maps to Bee + Committer C O Mitter maps to C O Mitter + + Author B maps to B + Committer C O Mitter maps to C O Mitter + + Author C maps to C + Committer C O Mitter maps to C O Mitter + EOF + git -C empty log --reverse --pretty=format:"Author %an <%ae> maps to %aN <%aE>%nCommitter %cn <%ce> maps to %cN <%cE>%n" >actual && + test_cmp expect actual +' + test_done From patchwork Tue Jan 12 20:18:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45338C433DB for ; Tue, 12 Jan 2021 21:42:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E20C723121 for ; Tue, 12 Jan 2021 21:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438143AbhALVhc (ORCPT ); Tue, 12 Jan 2021 16:37:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436885AbhALUTp (ORCPT ); Tue, 12 Jan 2021 15:19:45 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A436C061794 for ; Tue, 12 Jan 2021 12:19:02 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id r4so3306212wmh.5 for ; Tue, 12 Jan 2021 12:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Rbg8n89Lbafup0iBredgS8KADE8Pnpe5fipX60ShT18=; b=GPkvUvKg2FHMWJ9cYAtxqFESLyqFLcFIoYEE/9iHOf6+oJrewMgTmb1nDjUrm8IYHC QMRiPZfP5AlLSVQXCGwMSsBOjw+xPJ5M35qR2/8L5GQf9vIIJepAIdHsqsiXhCtPMMh2 CKaxFG2jDJQDkzRqU13/qoDpNev7RpMAGq1JBltX3A7CY3mlC8+sJ+vVDSbBIbN4kwZP IGIGcPwk8vXtIHyED+xWNrNM3B88TwV+tJTCHek/6qRCpJ2qSXrDaDlSlbnvepr25kYl a5fbYhWQ1l/HhVQIEeXdHmxQkr6FXW1ExVn+IH31S1DtIhcFG2CXnSaYkQi9nkuEMVwo BpMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rbg8n89Lbafup0iBredgS8KADE8Pnpe5fipX60ShT18=; b=uiM3wGyjmgZ71PCJ/fOP2J/Z1NeiiPX3e12DICruVpTQNpXYTECFUUQ71s12Gg84/y zXQVrxKCTl5uGHGmB2vCOnOUHJZ1Yeg0MBLEuwh331csrbZFCY9lnt2G3Cc3q7BaKmde /aicCwLN7M/sH6JpLLpE2HwH8SWShPrqSlzP9Wr+Gx3NckYeg8+MFu6sOduR19tq/cMK 9ks/kHN2+qd8luHXHobcks34n58gTabBxZ5JnMr7B/L3FbV2tiBYMYNSkb5JSLeL15Mc utX09CMtzrPuYaySgusmzoymHTM5Y8CgZ/DhxvnTixSQtHLX7CkSoM4Z/sbfj8LCXPCh TitQ== X-Gm-Message-State: AOAM531Bh+vGkGvPbl5tfJ25htp30U6F/nSG0FC7Boywxllp/ByaAV0H oRR7Og4VNcpLe3vKf6Q/xrg4VrjBb+WGKg== X-Google-Smtp-Source: ABdhPJz8lmuJIwyi0bZl+ZPvih+9+8XTYqxAoS9+Hcd9YwEHOYC+wt9xmljC7I66LsEnRACHZUPOIg== X-Received: by 2002:a1c:2646:: with SMTP id m67mr862416wmm.81.1610482740615; Tue, 12 Jan 2021 12:19:00 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.18.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:18:59 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 21/22] mailmap doc + tests: document and test for case-insensitivity Date: Tue, 12 Jan 2021 21:18:05 +0100 Message-Id: <20210112201806.13284-22-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add documentation and more tests for case-insensitivity. The existing test only matched on the E-Mail part, but as shown here we also match the name with strcasecmp(). This behavior was last discussed on the mailing list in the thread starting at [1]. It seems we're keeping it like this, so let's document it. 1. https://lore.kernel.org/git/87czykvg19.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/gitmailmap.txt | 5 +++++ t/t4203-mailmap.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Documentation/gitmailmap.txt b/Documentation/gitmailmap.txt index 55dfebd1b1..7f1089786d 100644 --- a/Documentation/gitmailmap.txt +++ b/Documentation/gitmailmap.txt @@ -49,6 +49,11 @@ commit matching the specified commit email address, and: which allows mailmap to replace both the name and the email of a commit matching both the specified commit name and email address. +Both E-Mails and names are matched case-insensitively. For example +this would also match the 'Commit Name ' above: +-- +Proper Name CoMmIt NaMe +-- EXAMPLES -------- diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh index f19736fef1..89cb300f28 100755 --- a/t/t4203-mailmap.sh +++ b/t/t4203-mailmap.sh @@ -220,7 +220,21 @@ test_expect_success 'name entry after email entry, case-insensitive' ' initial EOF + git shortlog HEAD >actual && + test_cmp expect actual && + + cat >internal.map <<-\EOF && + NiCk NICK1 + EOF + + cat >expect <<-\EOF && + NiCk (1): + second + + Repo Guy (1): + initial + EOF git shortlog HEAD >actual && test_cmp expect actual ' From patchwork Tue Jan 12 20:18:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12014835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23977C4332D for ; Tue, 12 Jan 2021 21:42:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0306723123 for ; Tue, 12 Jan 2021 21:42:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436899AbhALVhd (ORCPT ); Tue, 12 Jan 2021 16:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436887AbhALUTp (ORCPT ); Tue, 12 Jan 2021 15:19:45 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D65CC061795 for ; Tue, 12 Jan 2021 12:19:05 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id g10so1579983wmh.2 for ; Tue, 12 Jan 2021 12:19:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JH09G29nKhQTNzNCjrlB0T1G8yYLr/574/1r+2W5oow=; b=jtLNPlq2FSn08gkqWg5seKXX6NUediOG9bB4G+UvewveTeNj7GcXtR0btCtFWrTzad g+y4c9jiuUXxsoUFJv/acOLWKvPWJk8VuE1RRB94u6XQsgYqWOEyjwDoUsy1HuWL9CzJ /sFeIPicurb5JxBgmgfOmBTvKf6PMNLrVmIMouxKUOfcPG7K9t9q7ZRKxXJny785nSAD +pbClKElWL3p7rB8zFkZqw9b7nkX0RBpCWseG5c1gMwmo64Epk7TZFp6gZ2g1YKULFvB 08dQDXvvuLxCENa9z4zkbSosulEl8wOzTjtejczeOrMgpjPDrbCbyJpyD8md98Up3IhR RuRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JH09G29nKhQTNzNCjrlB0T1G8yYLr/574/1r+2W5oow=; b=PbQW/DgaTiUEHnhiUUk5V3auRZXOAKPODlUUmGtcsG61yKOI+dU3mi762xUoHqB1gR OxEqnq68gztyvRlBM9cV0CKjCQqeYxttU3lAvNOtSyP40qAzPu+YHaxpk/wcosrNKVVd ySpR6IFyZ8zvXVDXe/RjWzRpsBlnOmOBsjyMKlL1LmuzwpQKw7WP3TR5t4mvySXtpzR9 AIS66Luyf6Rc0X9AjCHT8olqL1quoKDLiLRHaG/rZRgRMJnphiEYlByz77gQr9LBJJOf NKPjf9l9AZIgbfL4L+VFNegoFyMBIULnrXJuSgztXzQSqS8f8dDwRf8c0seeO4Y73XKR vM5w== X-Gm-Message-State: AOAM530sZvP3kVM4nYdGmHoNL5ZoU8UHfnSqmUULw2ZH+x4PWQs50e/O 3ms/ARga9BAR4nEYozJJSpa57UYX71w3dQ== X-Google-Smtp-Source: ABdhPJwH4Td/+SJNJGLoq6FLrAeUwLASNhXd+ckw1k8TJJAHA8ZOvpD7Fvn73RT9C7aBjUVtLddZZA== X-Received: by 2002:a7b:c385:: with SMTP id s5mr878378wmj.170.1610482743457; Tue, 12 Jan 2021 12:19:03 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id c10sm7095374wrb.92.2021.01.12.12.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 12:19:01 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Sixt , Johannes Schindelin , "brian m . carlson" , =?utf-8?b?w4Z2YXIgQXJu?= =?utf-8?b?ZmrDtnLDsCBCamFybWFzb24=?= , Linus Torvalds Subject: [PATCH 22/22] shortlog: remove unused(?) "repo-abbrev" feature Date: Tue, 12 Jan 2021 21:18:06 +0100 Message-Id: <20210112201806.13284-23-avarab@gmail.com> X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8 In-Reply-To: <20210105130359.21139-1-avarab@gmail.com> References: <20210105130359.21139-1-avarab@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Remove support for the magical "repo-abbrev" comment in .mailmap files. This was added to .mailmap parsing in [1], as a generalized feature of the git-shortlog Perl script added earlier in [2]. There was no documentation or tests for this feature, and I don't think it's used in practice anymore. What it did was to allow you to specify a single string to be search-replaced with "/.../" in the .mailmap file. E.g. for linux.git's current .mailmap: git archive --remote=git@gitlab.com:linux-kernel/linux.git \ HEAD -- .mailmap | grep -a repo-abbrev # repo-abbrev: /pub/scm/linux/kernel/git/ Then when running e.g.: git shortlog --merges --author=Linus -1 v5.10-rc7..v5.10 | grep Merge We'd emit (the [...] is mine): Merge tag [...]git://git.kernel.org/.../tip/tip But will now emit: Merge tag [...]git.kernel.org/pub/scm/linux/kernel/git/tip/tip I think at this point this is just a historical artifact we can get rid of. It was initially meant for Linus's own use when we integrated the Perl script[2], but since then it seems he's stopped using it. Digging through Linus's release announcements on the LKML[3] the last release I can find that made use of this output is Linux 2.6.25-rc6 back in March 2008[4]. Later on Linus started using --no-merges[5], and nowadays seems to prefer some custom not-quite-shortlog format of merges from lieutenants[6]. You will still see it on linux.git if you run "git shortlog" manually yourself with --merges, with this removed you can still get the same output with: git log --pretty=fuller v5.10-rc7..v5.10 | sed 's!/pub/scm/linux/kernel/git/!/.../!g' | git shortlog Arguably we should do the same for the search-replacing of "[PATCH]" at the beginning with "". That seems to be another relic of a bygone era when linux.git patches would have their E-Mail subject lines applied as-is by "git am" or whatever. But we documented that feature in "git-shortlog(1)", and it seems more widely applicable than something purely kernel-specific. 1. 7595e2ee6ef (git-shortlog: make common repository prefix configurable with .mailmap, 2006-11-25) 2. fa375c7f1b6 (Add git-shortlog perl script, 2005-06-04) 3. https://lore.kernel.org/lkml/ 4. https://lore.kernel.org/lkml/alpine.LFD.1.00.0803161651350.3020@woody.linux-foundation.org/ 5. https://lore.kernel.org/lkml/BANLkTinrbh7Xi27an3uY7pDWrNKhJRYmEA@mail.gmail.com/ 6. https://lore.kernel.org/lkml/CAHk-=wg1+kf1AVzXA-RQX0zjM6t9J2Kay9xyuNqcFHWV-y5ZYw@mail.gmail.com/ Acked-by: Linus Torvalds Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/blame.c | 2 +- builtin/check-mailmap.c | 2 +- builtin/commit.c | 2 +- builtin/log.c | 2 +- builtin/shortlog.c | 16 ++------------ mailmap.c | 48 +++++++++++------------------------------ mailmap.h | 2 +- pretty.c | 2 +- shortlog.h | 1 - 9 files changed, 21 insertions(+), 56 deletions(-) diff --git a/builtin/blame.c b/builtin/blame.c index 6f7e32411a..712ae8e742 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -1151,7 +1151,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix) sb.xdl_opts = xdl_opts; sb.no_whole_file_rename = no_whole_file_rename; - read_mailmap(&mailmap, NULL); + read_mailmap(&mailmap); sb.found_guilty_entry = &found_guilty_entry; sb.found_guilty_entry_data = π diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index cdce144f3b..7dc47e4793 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -47,7 +47,7 @@ int cmd_check_mailmap(int argc, const char **argv, const char *prefix) if (argc == 0 && !use_stdin) die(_("no contacts specified")); - read_mailmap(&mailmap, NULL); + read_mailmap(&mailmap); for (i = 0; i < argc; ++i) check_mailmap(&mailmap, argv[i]); diff --git a/builtin/commit.c b/builtin/commit.c index 505fe60956..739110c5a7 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1039,7 +1039,7 @@ static const char *find_author_by_nickname(const char *name) av[++ac] = NULL; setup_revisions(ac, av, &revs, NULL); revs.mailmap = &mailmap; - read_mailmap(revs.mailmap, NULL); + read_mailmap(revs.mailmap); if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); diff --git a/builtin/log.c b/builtin/log.c index bd6ff4f9f9..4ee81bc976 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -230,7 +230,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, if (mailmap) { rev->mailmap = xcalloc(1, sizeof(struct string_list)); - read_mailmap(rev->mailmap, NULL); + read_mailmap(rev->mailmap); } if (rev->pretty_given && rev->commit_format == CMIT_FMT_RAW) { diff --git a/builtin/shortlog.c b/builtin/shortlog.c index c52e4ccd19..e7c21ab620 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -61,8 +61,7 @@ static void insert_one_record(struct shortlog *log, if (log->summary) item->util = (void *)(UTIL_TO_INT(item) + 1); else { - const char *dot3 = log->common_repo_prefix; - char *buffer, *p; + char *buffer; struct strbuf subject = STRBUF_INIT; const char *eol; @@ -82,17 +81,6 @@ static void insert_one_record(struct shortlog *log, format_subject(&subject, oneline, " "); buffer = strbuf_detach(&subject, NULL); - if (dot3) { - int dot3len = strlen(dot3); - if (dot3len > 5) { - while ((p = strstr(buffer, dot3)) != NULL) { - int taillen = strlen(p) - dot3len; - memcpy(p, "/.../", 5); - memmove(p + 5, p + dot3len, taillen + 1); - } - } - } - if (item->util == NULL) item->util = xcalloc(1, sizeof(struct string_list)); string_list_append(item->util, buffer); @@ -342,7 +330,7 @@ void shortlog_init(struct shortlog *log) { memset(log, 0, sizeof(*log)); - read_mailmap(&log->mailmap, &log->common_repo_prefix); + read_mailmap(&log->mailmap); log->list.strdup_strings = 1; log->wrap = DEFAULT_WRAPLEN; diff --git a/mailmap.c b/mailmap.c index 962fd86d6d..eb77c6e77c 100644 --- a/mailmap.c +++ b/mailmap.c @@ -143,31 +143,13 @@ static char *parse_name_and_email(char *buffer, char **name, return (*right == '\0' ? NULL : right); } -static void read_mailmap_line(struct string_list *map, char *buffer, - char **repo_abbrev) +static void read_mailmap_line(struct string_list *map, char *buffer) { char *name1 = NULL, *email1 = NULL, *name2 = NULL, *email2 = NULL; - if (buffer[0] == '#') { - static const char abbrev[] = "# repo-abbrev:"; - int abblen = sizeof(abbrev) - 1; - int len = strlen(buffer); - if (!repo_abbrev) - return; - - if (len && buffer[len - 1] == '\n') - buffer[--len] = 0; - if (!strncmp(buffer, abbrev, abblen)) { - char *cp; - - free(*repo_abbrev); - - for (cp = buffer + abblen; isspace(*cp); cp++) - ; /* nothing */ - *repo_abbrev = xstrdup(cp); - } + if (buffer[0] == '#') return; - } + if ((name2 = parse_name_and_email(buffer, &name1, &email1, 0)) != NULL) parse_name_and_email(name2, &name2, &email2, 1); @@ -175,8 +157,7 @@ static void read_mailmap_line(struct string_list *map, char *buffer, add_mapping(map, name1, email1, name2, email2); } -static int read_mailmap_file(struct string_list *map, const char *filename, - char **repo_abbrev) +static int read_mailmap_file(struct string_list *map, const char *filename) { char buffer[1024]; FILE *f; @@ -192,13 +173,12 @@ static int read_mailmap_file(struct string_list *map, const char *filename, } while (fgets(buffer, sizeof(buffer), f) != NULL) - read_mailmap_line(map, buffer, repo_abbrev); + read_mailmap_line(map, buffer); fclose(f); return 0; } -static void read_mailmap_string(struct string_list *map, char *buf, - char **repo_abbrev) +static void read_mailmap_string(struct string_list *map, char *buf) { while (*buf) { char *end = strchrnul(buf, '\n'); @@ -206,14 +186,12 @@ static void read_mailmap_string(struct string_list *map, char *buf, if (*end) *end++ = '\0'; - read_mailmap_line(map, buf, repo_abbrev); + read_mailmap_line(map, buf); buf = end; } } -static int read_mailmap_blob(struct string_list *map, - const char *name, - char **repo_abbrev) +static int read_mailmap_blob(struct string_list *map, const char *name) { struct object_id oid; char *buf; @@ -231,13 +209,13 @@ static int read_mailmap_blob(struct string_list *map, if (type != OBJ_BLOB) return error("mailmap is not a blob: %s", name); - read_mailmap_string(map, buf, repo_abbrev); + read_mailmap_string(map, buf); free(buf); return 0; } -int read_mailmap(struct string_list *map, char **repo_abbrev) +int read_mailmap(struct string_list *map) { int err = 0; @@ -247,10 +225,10 @@ int read_mailmap(struct string_list *map, char **repo_abbrev) if (!git_mailmap_blob && is_bare_repository()) git_mailmap_blob = "HEAD:.mailmap"; - err |= read_mailmap_file(map, ".mailmap", repo_abbrev); + err |= read_mailmap_file(map, ".mailmap"); if (startup_info->have_repository) - err |= read_mailmap_blob(map, git_mailmap_blob, repo_abbrev); - err |= read_mailmap_file(map, git_mailmap_file, repo_abbrev); + err |= read_mailmap_blob(map, git_mailmap_blob); + err |= read_mailmap_file(map, git_mailmap_file); return err; } diff --git a/mailmap.h b/mailmap.h index d0e65646cb..7e99fccb46 100644 --- a/mailmap.h +++ b/mailmap.h @@ -3,7 +3,7 @@ struct string_list; -int read_mailmap(struct string_list *map, char **repo_abbrev); +int read_mailmap(struct string_list *map); void clear_mailmap(struct string_list *map); int map_user(struct string_list *map, diff --git a/pretty.c b/pretty.c index 05eef7fda0..3922f6f9f2 100644 --- a/pretty.c +++ b/pretty.c @@ -679,7 +679,7 @@ static int mailmap_name(const char **email, size_t *email_len, static struct string_list *mail_map; if (!mail_map) { mail_map = xcalloc(1, sizeof(*mail_map)); - read_mailmap(mail_map, NULL); + read_mailmap(mail_map); } return mail_map->nr && map_user(mail_map, email, email_len, name, name_len); } diff --git a/shortlog.h b/shortlog.h index 64be879b24..3f7e9aabca 100644 --- a/shortlog.h +++ b/shortlog.h @@ -23,7 +23,6 @@ struct shortlog { } groups; struct string_list trailers; - char *common_repo_prefix; int email; struct string_list mailmap; FILE *file;