From patchwork Mon May 13 23:17:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 10941823 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 424AF76 for ; Mon, 13 May 2019 23:17:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3286628355 for ; Mon, 13 May 2019 23:17:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 270FC283A8; Mon, 13 May 2019 23:17:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF0FF28355 for ; Mon, 13 May 2019 23:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726607AbfEMXRk (ORCPT ); Mon, 13 May 2019 19:17:40 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38711 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfEMXRk (ORCPT ); Mon, 13 May 2019 19:17:40 -0400 Received: by mail-pg1-f195.google.com with SMTP id j26so7545740pgl.5 for ; Mon, 13 May 2019 16:17:39 -0700 (PDT) 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=K5KGWlgLIaFfGbNmAYY2dGdpfN8dIpTvYhklN2HMICA=; b=RMNU14uBAkFuHHNH7SNM4TzBnAvzILqjR/1+IcO3Hu92Lzjn+R3d/e8XetVyf8e259 1drMpfhA+GBl66qnhOBAoNzWOX5/OvCLoT0jdTG1bMpgQk5iqQoHACsAHK60V7lIEUc3 E3B5EHM3zTbMlYibxNoFeolATJQNMrSj1Zlijsa9GZxYmm/xHNGRaZUDjKnWOUXPFcg8 bWLSx+D9IaDeYRVOHHE85a13K7gbKg5uXACN9fGzIycQpaYEaIMiQaPNE7wQFU37GZ5W y7v2r0M5wJrksvB1wXmjwe4M4HQG0VRaazJDr08pdu8i6FYDp0zILJ9jrTJZEBLy/Lwa chsg== 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=K5KGWlgLIaFfGbNmAYY2dGdpfN8dIpTvYhklN2HMICA=; b=DmI95x+wT2TlhaNQXV+E/gRzo8kmwextLh74Kfh08ZNO2bkgngSwambgiDxkXX9kjZ dVCuz+AxBZHEDv8APi6k5IOxdRpkXKn7IIX38PjBuiD/f57kBVfEj8UCXviv/YVae9qY ghg1mUYooaxUW8fDqhnYozJfA4DcQTt6RLnm9obgKxDJ8vY0+r2/muEqaZ9cQo9Rtg0E /kDKZtwZRpq9M45+S38JAa6b9dMV7bdImafCI+60bcoz6vn94Pf3Lehh/AjT5IQ4nDxs k0YYjF3g27oHVMrXhrPQXVbXXMWwk7RxdDr2sckrR+2uwpGtyrW7xzt3bLl5gKMLSdqU 4how== X-Gm-Message-State: APjAAAU6uu9MR/EUlIT5mrb7xvm3HBr+uqD08xBNvJrW9W1buwK85m75 GqvPfZb0lETrUny7w6oKoN4= X-Google-Smtp-Source: APXvYqwd+sPwDnZZxF8W4fUPkIcU2cJG9950XqLzDt4RoMUXSa0z7RYmHKKjEPzgd+iPQ0Z7DOAgZQ== X-Received: by 2002:aa7:808d:: with SMTP id v13mr5819870pff.198.1557789459251; Mon, 13 May 2019 16:17:39 -0700 (PDT) Received: from newren2-linux.yojoe.local ([8.4.231.67]) by smtp.gmail.com with ESMTPSA id g10sm30664307pfg.153.2019.05.13.16.17.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 May 2019 16:17:38 -0700 (PDT) From: Elijah Newren To: Junio C Hamano Cc: git@vger.kernel.org, Eric Sunshine , Johannes Schindelin , Johannes Sixt , =?utf-8?q?Torsten_B=C3=B6gershausen?= , Elijah Newren Subject: [PATCH v5 4/5] fast-export: differentiate between explicitly utf-8 and implicitly utf-8 Date: Mon, 13 May 2019 16:17:25 -0700 Message-Id: <20190513231726.16218-5-newren@gmail.com> X-Mailer: git-send-email 2.21.0.782.gd8be4ee826 In-Reply-To: <20190513231726.16218-1-newren@gmail.com> References: <20190513164722.31534-1-newren@gmail.com> <20190513231726.16218-1-newren@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The find_encoding() function returned the encoding used by a commit message, returning a default of git_commit_encoding (usually utf-8). Although the current code does not differentiate between a commit which explicitly requested utf-8 and one where we just assume utf-8 because no encoding is set, it will become important when we try to preserve the encoding header. Since is_encoding_utf8() returns true when passed NULL, we can just return NULL from find_encoding() instead of returning git_commit_encoding. Signed-off-by: Elijah Newren --- builtin/fast-export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 7734a9f5a5..66331fa401 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -453,7 +453,7 @@ static const char *find_encoding(const char *begin, const char *end) bol = memmem(begin, end ? end - begin : strlen(begin), needle, strlen(needle)); if (!bol) - return git_commit_encoding; + return NULL; bol += strlen(needle); eol = strchrnul(bol, '\n'); *eol = '\0';