From patchwork Mon May 13 16:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Elijah Newren X-Patchwork-Id: 10941379 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 604881398 for ; Mon, 13 May 2019 16:47:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5112B27D29 for ; Mon, 13 May 2019 16:47:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 452522837D; Mon, 13 May 2019 16:47:39 +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 EC27F27D29 for ; Mon, 13 May 2019 16:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730925AbfEMQrh (ORCPT ); Mon, 13 May 2019 12:47:37 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40232 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730880AbfEMQrh (ORCPT ); Mon, 13 May 2019 12:47:37 -0400 Received: by mail-pf1-f194.google.com with SMTP id u17so7496897pfn.7 for ; Mon, 13 May 2019 09:47:37 -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=xVHQaSOJgVC/6fi+624umdLrXXhYdp2u3rHBvH1Us1M=; b=vMnORXPcvLLEwP4uGh8x7MTBGOhIaoC6/fgkxt9IgZ+CgOun2wktddRQP93fpvyVnR CWKvAjRfdL+A6CRrR6HKbZiGztuhRNlgRIZPbu7ww3bU3mtUENzZfup+bbx9zAAnXthU 3SsqO7oXLe6T5Ofc+cidbbTTho30oJqJwmHOZnUXs5Lc4bCgfXGDM3UwBZNYXOv3+Lgz q95Sl0mwz9gKkfVlPStlklOT7i+yXdvwd/w03RHnMDy3xgRL/BappDLOE4isLcxJsggA GL0OlDT19BqHQTPhqmMK2f5TDBQtNOAeaIPC0oSK2LJiUqieFzf6HluxJqvQZ7vQQpzA xanw== 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=xVHQaSOJgVC/6fi+624umdLrXXhYdp2u3rHBvH1Us1M=; b=ena87z+yeNvX2AFGICrOL+VDqKkVBUHMJP4x1cHWsfpnShODZihqRmRGKNTrBkQW/M BkWu7sAJAjL1NSlEM/LdJDJAfth6I3rODVYhMeoJLnIj/F7ZGFdAMjFigy5TRWdUC34j 83yqaYpjtCrPQ3wSe3Rwicbu5/YuMIvc7v/3yPsuvixk4uBaw4WD1/BSTnSqnRiQm6cK Z/r5WxH6IYzabcBtKg/bVtPPiAbZ/q7DHF3JNMhHDD3V1KiHEoBCA3m3oSwtDz30nzOu x7HP59YlfmMi/Z+EtTnAUT2s8vsGUA6QX3KOwtU8Su3FOhK5+uDFsXgkbdkYAEPBdaqW ogdQ== X-Gm-Message-State: APjAAAUMZtARt3MvmPD0FE8/EwT4Ml9WtEcQhYWD0RyLBTjSBDNQh4vY k4bl542qxTzEdEN7A6QRFOk= X-Google-Smtp-Source: APXvYqwzEoaT2VZ90LhqwLcGClFcv4HxM/yupURRaftCOBdZ4c6FUNUHP8tJ2DDzvMsFqw0+Cp9+wg== X-Received: by 2002:a63:1d09:: with SMTP id d9mr32448982pgd.289.1557766056659; Mon, 13 May 2019 09:47:36 -0700 (PDT) Received: from newren2-linux.yojoe.local ([8.4.231.67]) by smtp.gmail.com with ESMTPSA id n35sm2851206pgl.44.2019.05.13.09.47.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 May 2019 09:47:36 -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 v4 4/5] fast-export: differentiate between explicitly utf-8 and implicitly utf-8 Date: Mon, 13 May 2019 09:47:21 -0700 Message-Id: <20190513164722.31534-5-newren@gmail.com> X-Mailer: git-send-email 2.21.0.782.g571613a09e In-Reply-To: <20190513164722.31534-1-newren@gmail.com> References: <20190510205335.19968-1-newren@gmail.com> <20190513164722.31534-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';