Git development
 help / color / mirror / Atom feed
* [RFC][PATCH] Allow transfer of any valid sha1
@ 2006-05-24  7:51 Eric W. Biederman
  2006-05-24  9:07 ` Junio C Hamano
  0 siblings, 1 reply; 18+ messages in thread
From: Eric W. Biederman @ 2006-05-24  7:51 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


While working on git-quiltimport I decided to see if
I could transform Andrews patches where he imports git tress into
git-pull commands, which should result in better history and better
attribution.

To be accurate of his source Andrew records the sha1 of the commit
and the git tree he pulled from.  Which looks like:

GIT b307e8548921c686d2eb948ca418ab2941876daa \
 git+ssh://master.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

So I figured I would transform the above line into the obvious
git-pull command:

 git-pull \
  git+ssh://master.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git \
  b307e8548921c686d2eb948ca418ab2941876daa

To my surprise that didn't work.  There were a couple of little places
in the scripts where git-fetch and git-fetch-pack never expected to be
given a sha1 but that was easy to fix up, and had no real repercussions.  

More problematic was the little bit in git-upload pack that only
allows you to a sha1 if it was on the list of sha1 generated from
looking at the heads.  I'm not at all certain of the sense of
that check as you can get everything by just cloning the repository.

Can we fix the check in upload-pack.c something like my
patch below does?  Are there any security implications for
doing that?

Could we just make the final check before dying if (!o) ?





		/* We have sent all our refs already, and the other end
		 * should have chosen out of them; otherwise they are
		 * asking for nonsense.
		 *
		 * Hmph.  We may later want to allow "want" line that
		 * asks for something like "master~10" (symbolic)...
		 * would it make sense?  I don't know.
		 */

diff --git a/upload-pack.c b/upload-pack.c
index 47560c9..0f2e544 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -207,7 +207,9 @@ static int receive_needs(void)
 		 * would it make sense?  I don't know.
 		 */
 		o = lookup_object(sha1_buf);
-		if (!o || !(o->flags & OUR_REF))
+		if (!o)
+			o = parse_object(sha1_buf);
+		if (!o || ((o->type != commit_type) && (o->type != tag_type)))
 			die("git-upload-pack: not our ref %s", line+5);
 		if (!(o->flags & WANTED)) {
 			o->flags |= WANTED;

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-06-08  9:33 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-24  7:51 [RFC][PATCH] Allow transfer of any valid sha1 Eric W. Biederman
2006-05-24  9:07 ` Junio C Hamano
2006-05-25  5:09   ` Eric W. Biederman
2006-05-25  6:36     ` Junio C Hamano
2006-05-25 17:00       ` Eric W. Biederman
2006-05-25 17:28         ` Linus Torvalds
2006-05-25 17:59           ` Eric W. Biederman
2006-05-25 18:28           ` Junio C Hamano
2006-05-25 18:36             ` Linus Torvalds
2006-05-25 20:30               ` Eric W. Biederman
2006-05-25 20:53                 ` Junio C Hamano
2006-05-26  8:27                   ` Eric W. Biederman
2006-05-26 10:04                 ` Junio C Hamano
2006-05-26 17:32                   ` Eric W. Biederman
2006-05-25 20:50             ` Eric W. Biederman
2006-05-25 21:04               ` Junio C Hamano
2006-05-26  8:32                 ` Eric W. Biederman
2006-06-08  9:33                 ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox