[PATCH] git-ssh-pull: commit-id consistency

Subsystems: the rest

DORMANTno replies

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH] git-ssh-pull: commit-id consistency

From: Sven Verdoolaege <hidden>
Date: 2016-06-15 22:42:00

I thought about keeping the check for a leading dot or slash,
but then I figured that you'd get an error from the other
side pretty quickly.

skimo
--
In contrast to other plumbing tools, git-ssh-pu{sh,ll} only
allow a very restrictive form of commit-id filenames.
This patch removes this restriction.

Signed-off-by: Sven Verdoolaege <redacted>

---
commit 00437f1bafcb710bb809cd2e87cdaeae340a67b8
tree 480e77cde9afbd0b0abd33e3f272288739b01a7e
parent 641e1cac73acd67d0b1830dfd7196bca58dffbf2
author Sven Verdoolaege [off-list ref] Sun, 26 Jun 2005 19:41:44 +0200
committer Sven Verdoolaege [off-list ref] Sun, 26 Jun 2005 19:41:44 +0200

 pull.c     |    7 ++-----
 ssh-push.c |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/pull.c b/pull.c
--- a/pull.c
+++ b/pull.c
@@ -152,11 +152,8 @@ static int interpret_target(char *target
 {
 	if (!get_sha1_hex(target, sha1))
 		return 0;
-	if (!check_ref_format(target)) {
-		if (!fetch_ref(target, sha1)) {
-			return 0;
-		}
-	}
+	if (!fetch_ref(target, sha1))
+		return 0;
 	return -1;
 }
 
diff --git a/ssh-push.c b/ssh-push.c
--- a/ssh-push.c
+++ b/ssh-push.c
@@ -74,7 +74,7 @@ int serve_ref(int fd_in, int fd_out)
 			return -1;
 		posn++;
 	} while (ref[posn - 1]);
-	if (get_ref_sha1(ref, sha1))
+	if (get_sha1(ref, sha1))
 		remote = -1;
 	write(fd_out, &remote, 1);
 	if (remote)

Re: [PATCH] git-ssh-pull: commit-id consistency

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:42:00

On Sun, 26 Jun 2005, Sven Verdoolaege wrote:
I thought about keeping the check for a leading dot or slash,
but then I figured that you'd get an error from the other
side pretty quickly.

skimo
--
In contrast to other plumbing tools, git-ssh-pu{sh,ll} only
allow a very restrictive form of commit-id filenames.
This patch removes this restriction.
There are a few problems with this: not all pull methods can handle
vagueness; HTTP, for instance, needs to know exactly what URL to request,
and it can't deal with having the user request just anything. Also, it's
not particularly useful to support just anything as the hash to start
from, when you have to specify exactly the file to write the ref to (the
-w argument), which would be a lot more difficult and flaky, because we
can't just look for the only thing that works.

More generally, I think we should require explicit instructions, even when
we might be able to figure things out, when we're moving data between
repositories, similar to how we are strict about the data stored in
repositories (although, of course, we need to support a few more cases).

In addition, I think that stuff outside of objects/ and refs/ (and, when
we have something in it, info/) should be considered private, and not
transmitted from place to place.

One thing that might be a good idea, however, is to allow using symlinks
from .git/ to refs/<x>/<y> on the local side of git-ssh-push by converting
them to <x>/<y>. That way, when you push "HEAD", it will actually push
refs/heads/my-current-branch instead. Of course, the -w issue remains,
because you may have different names on the other side (i.e., on the local
side, it might be refs/heads/new-diff-algo, but the remote side might be
refs/heads/my-latest).

Really, the right solution is to keep this sort of info somewhere and have 
scripts do the right thing with exact specifications.

	-Daniel
*This .sig left intentionally blank*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help