git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Barr <david.barr@cordelta.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	Ramkumar Ramachandra <artagnon@gmail.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	David Barr <david.barr@cordelta.com>
Subject: [PATCH 3/7] fast-import: Allow cat command with empty path
Date: Wed, 13 Oct 2010 00:50:20 +1100	[thread overview]
Message-ID: <1286891424-2067-4-git-send-email-david.barr@cordelta.com> (raw)
In-Reply-To: <1286891424-2067-1-git-send-email-david.barr@cordelta.com>

From: Jonathan Nieder <jrnieder@gmail.com>

Rather than erroring out, treat an empty path as the path to
the root of a tree so frontends can be simplified a little.

While at it, fix a typo in an error message: the cat command is used
to examine paths within trees, not branches.

Cc: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 fast-import.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fast-import.c b/fast-import.c
index 099f63e..f3c4123 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2702,9 +2702,13 @@ static void quoted_path_sha1(unsigned char sha1[20], struct tree_entry *root,
 		die("Invalid path: %s", line);
 	if (*x)
 		die("Garbage after path: %s", line);
+	if (uq.len == 0) {
+		hashcpy(sha1, root->versions[1].sha1);
+		return;
+	}
 	tree_content_get(root, uq.buf, &leaf);
 	if (!leaf.versions[1].mode)
-		die("Path %s not in branch", uq.buf);
+		die("Path %s not in tree", uq.buf);
 	hashcpy(sha1, leaf.versions[1].sha1);
 }
 
-- 
1.7.3.1

  parent reply	other threads:[~2010-10-12 13:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 13:50 [PATCH/RFC] Add support for subversion dump format v3 David Barr
2010-10-12 13:50 ` [PATCH 1/7] Teach fast-import to print the id of each imported commit David Barr
2010-10-12 14:42   ` Sverre Rabbelier
2010-10-12 18:48     ` Jonathan Nieder
2010-10-12 18:57       ` Sverre Rabbelier
2010-10-12 19:07         ` Jonathan Nieder
2010-10-12 22:06   ` Jonathan Nieder
2010-10-12 23:05     ` Sverre Rabbelier
2010-10-12 13:50 ` [PATCH 2/7] fast-import: Let importers retrieve the objects being written David Barr
2010-10-12 22:38   ` Jonathan Nieder
2010-10-12 23:07     ` Sverre Rabbelier
2010-10-13  0:07       ` Jonathan Nieder
2010-10-13 13:10         ` Sverre Rabbelier
2010-10-12 13:50 ` David Barr [this message]
2010-10-12 22:47   ` [PATCH 3/7] fast-import: Allow cat command with empty path Jonathan Nieder
2010-10-12 13:50 ` [PATCH 4/7] fast-import: Allow cat requests at arbitrary points in stream David Barr
2010-10-12 22:50   ` Jonathan Nieder
2010-10-12 13:50 ` [PATCH 5/7] vcs-svn: extend svndump to parse version 3 format David Barr
2010-10-12 22:56   ` Jonathan Nieder
2010-10-12 13:50 ` [PATCH 6/7] vcs-svn: implement prop-delta handling David Barr
2010-10-12 22:59   ` Jonathan Nieder
2010-10-12 13:50 ` [PATCH 7/7] svn-fe: Use the --report-fd feature David Barr
2010-10-12 14:55   ` Sverre Rabbelier
2010-10-12 23:03     ` Jonathan Nieder
2010-10-12 23:11       ` Sverre Rabbelier
2010-10-12 23:36         ` Jonathan Nieder
2010-10-12 23:59   ` Jonathan Nieder
2010-10-13  2:24 ` [PATCH/RFC] Add support for subversion dump format v3 Jonathan Nieder

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1286891424-2067-4-git-send-email-david.barr@cordelta.com \
    --to=david.barr@cordelta.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=srabbelier@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).