From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Sebrecht Subject: [PATCH v6] mailinfo: allow e-mail files as input Date: Thu, 16 Jul 2009 19:45:34 +0200 Message-ID: References: <7v8wip9jjw.fsf@alter.siamese.dyndns.org> Cc: Junio C Hamano , Stephen Boyd , Nicolas Sebrecht To: X-From: git-owner@vger.kernel.org Thu Jul 16 19:45:59 2009 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1MRV1p-000815-BX for gcvg-git-2@gmane.org; Thu, 16 Jul 2009 19:45:58 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932897AbZGPRpt (ORCPT ); Thu, 16 Jul 2009 13:45:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932891AbZGPRpt (ORCPT ); Thu, 16 Jul 2009 13:45:49 -0400 Received: from mail-ew0-f226.google.com ([209.85.219.226]:33250 "EHLO mail-ew0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932757AbZGPRpr (ORCPT ); Thu, 16 Jul 2009 13:45:47 -0400 Received: by mail-ew0-f226.google.com with SMTP id 26so314349ewy.37 for ; Thu, 16 Jul 2009 10:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer:in-reply-to:references; bh=xKBBTVvNl6omUCKa0zGb631g2X2IRm+Wrep8Dql3SgA=; b=sNPMr9HzXW50NncO6DjI6OTkLqyjRtgMdfrynnnaBnYRJZDUn+fUrChtZjLyrTSf7l 4a7JBrS7MiIX5MWS3NKMGvmCRrEsbr9jc3ocZNkPQ2nBqjsmfh+G9SGambnEg+Ne95Hd hFEBUepzXbQX4zaz8470ds1DMiiBmfqYDkd+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=LTOc+oeSlkv8I4KjQvt1MyMjhpLtwIhRXLTANV4UutF1TR1T7FKBHTh+ZYRZpCKhVn RXeocgR6EtDu35QvuQkhttAtEd1C8YWl09z5Vr8v7T8/5itIiPkjl1Kt+x1/gqTnNGYK 2F55ETzWnoLNxunxShGPikqu7Cpw19Al0j97A= Received: by 10.210.125.13 with SMTP id x13mr53515ebc.28.1247766347242; Thu, 16 Jul 2009 10:45:47 -0700 (PDT) Received: from localhost (88-121-124-61.rev.libertysurf.net [88.121.124.61]) by mx.google.com with ESMTPS id 28sm784699eye.56.2009.07.16.10.45.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 16 Jul 2009 10:45:43 -0700 (PDT) X-Mailer: git-send-email 1.6.4.rc1.169.gd0406 In-Reply-To: <7v8wip9jjw.fsf@alter.siamese.dyndns.org> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: We traditionally allowed a mbox file or a directory name of a maildir to be given to "git am". Even though an individual file in a maildir (or more generally, a piece of RFC2822 e-mail) is not a mbox file, it contains enough information to create a commit out of it, so there is no reason to reject one. It allows to run 'git am' with an email list argument, something like: $ git am dir/* $ git am email1 email2 This builds on top of a5a6755 (git-am foreign patch support: introduce patch_format, 2009-05-27) that introduced mailbox format detection. The codepath to deal with a mbox requires it to begin with "From " line and also allows it to begin with "From: ", but a random piece of e-mail can and often do begin with any valid RFC2822 header lines. Instead of checking the first line, we extract all the lines up to the first empty line, and make sure they look like e-mail headers. Signed-off-by: Nicolas Sebrecht --- Documentation/git-am.txt | 6 ++-- git-am.sh | 14 ++++++++++++ t/t4150-am.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index 32e689b..2a930a7 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -14,7 +14,7 @@ SYNOPSIS [--ignore-date] [--whitespace=