git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>, Git List <git@vger.kernel.org>
Subject: [PATCH] fast-import: Don't barf if import-marks file is missing
Date: Tue, 11 Jan 2011 22:44:18 +0530	[thread overview]
Message-ID: <1294766058-29739-1-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <7vwrmd7kxe.fsf@alter.siamese.dyndns.org>

The --import-marks option used to barf when the specified marks file
doesn't exist. Change its meaning to "read marks file if it exists" so
that callers don't have to handle bootstraping as a special case.

Requested-by: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 Documentation/git-fast-import.txt |    2 +-
 fast-import.c                     |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt
index f56dfca..94fbe54 100644
--- a/Documentation/git-fast-import.txt
+++ b/Documentation/git-fast-import.txt
@@ -72,7 +72,7 @@ OPTIONS
 
 --import-marks=<file>::
 	Before processing any input, load the marks specified in
-	<file>.  The input file must exist, must be readable, and
+	<file>, if it exists.  The input file must be readable, and
 	must use the same format as produced by \--export-marks.
 	Multiple options may be supplied to import more than one
 	set of marks.  If a mark is defined to different values,
diff --git a/fast-import.c b/fast-import.c
index 7857760..cbd5124 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1795,7 +1795,11 @@ static void read_marks(void)
 {
 	char line[512];
 	FILE *f = fopen(import_marks_file, "r");
-	if (!f)
+	if (f)
+		;
+	else if (errno == ENOENT)
+		return; /* Marks file does not exist */
+	else
 		die_errno("cannot read '%s'", import_marks_file);
 	while (fgets(line, sizeof(line), f)) {
 		uintmax_t mark;
-- 
1.7.2.2.409.gdbb11.dirty

  reply	other threads:[~2011-01-11 17:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-09 19:33 [PATCH] fast-import: Create import-marks file when necessary Ramkumar Ramachandra
2011-01-09 22:48 ` Junio C Hamano
2011-01-11 17:14   ` Ramkumar Ramachandra [this message]
2011-01-11 17:51     ` [PATCH] fast-import: Don't barf if import-marks file is missing Jonathan Nieder
2011-01-15  6:31       ` [PATCH] fast-import: Introduce --import-marks-if-exists Ramkumar Ramachandra
2011-01-11 20:05     ` [PATCH] fast-import: Don't barf if import-marks file is missing Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294766058-29739-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).