Commit Graph

70 Commits

Author SHA1 Message Date
Junio C Hamano
40b64d47c3 send-pack: handle partial pushes correctly.
When pushing into multi-user repository, or when pushing to a
repository from a local repository that has rebased branches
that has been pruned, the destination repository can have head
commits that are missing from the local repository.

This should not matter as long as the local head of the branch
being pushed is a proper superset of the destination branch, but
we ended up trying to run rev-list telling it to exclude objects
reachable from those heads missing from the local repository,
causing it to barf.  Prune those heads from the rev-list
parameter list, and make sure we do not try to push a branch
whose remote head is something we lack.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-03 12:41:12 -07:00
Junio C Hamano
0bc3cdfc82 Make send-pack --all and explicit ref mutually exclusive.
send-pack had a confusing misfeature that "send-pack --all
master" updated all refs, while "send-pack --all" did not do
anything.  Make --all and explicit refs mutually exclusive, and
make sure "send-pack --all" updates all refs.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-02 22:51:07 -07:00
Linus Torvalds
bdf25142aa Fix potential send-pack SIGSEGV
The check that the source is ahead of the destination incorrectly expects 
pop_most_recent_commit() to gracefully handle an empty list. 

Fix by just checking the list itself, rather than the return value of the 
pop function.

[jc: I did the test script that demonstrated the problem]

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-07-26 22:23:18 -07:00
Linus Torvalds
2a9c3fe838 git-send-pack: verify that sender is a proper superset of receiver
This should make sure that if you have multiple people pushing to the
same tree, they cannot overwrite each others work, but have to merge
before being able to update the common reference tree.
2005-07-19 07:03:47 -04:00
Linus Torvalds
d1c133f5d4 Merge three separate "fetch refs" functions
It really just boils down to one "get_remote_heads()" function, and a
common "struct ref" structure definition.
2005-07-16 13:55:50 -07:00
Linus Torvalds
d089391c00 git-send-pack: add "--all" option to send all refs to the other side
This affects only refs that the other side doesn't already have. The
ones it has are still filtered by the ref selection.
2005-07-16 13:26:33 -07:00
Junio C Hamano
2a24501363 [PATCH] Documentation: send/receive.
This adds documentation for 'smarter push' family of commands.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-14 08:54:31 -07:00
Linus Torvalds
e33b2ef8f5 git-send-pack: Fix duplicate refname match
Cut-and-paste dup noticed by Junio.  It's not even harmless, since a
match also causes that match to be invalidated, so this made it
impossible to update an existing branch by name.

I'd only tested the case of "ref doesn't exist at all on the other end",
which worked fine.
2005-07-11 18:03:34 -07:00
Linus Torvalds
584c6cc91a Teach 'git-send-pack' to send new branches and tags.
The protocol always supported it, but send-pack didn't actually know how
to tell the other side about a new branch/tag.

NOTE! You'll have to name it explicitly on the command line: if you
don't name any branches, git-send-pack will default to the branches that
already exist.
2005-07-08 13:58:40 -07:00
Linus Torvalds
723c31fea2 Add "git_path()" and "head_ref()" helper functions.
"git_path()" returns a static pathname pointer into the git directory
using a printf-like format specifier.

"head_ref()" works like "for_each_ref()", except for just the HEAD.
2005-07-05 11:31:32 -07:00
Linus Torvalds
013e7c7ff4 Move ref path matching to connect.c library
It's a generic thing for matching refs from the other side.
2005-07-04 13:24:30 -07:00
Linus Torvalds
f71925983d Factor out the ssh connection stuff from send-pack.c
I want to use it for git-fetch-pack too.
2005-07-04 11:57:58 -07:00
Linus Torvalds
7ec4e60819 Fix gcc warning in send-pack.c
send_pack() was declared to return "int" (although nobody cared), but
didn't actually return anything.
2005-07-03 10:00:01 -07:00
Linus Torvalds
d0efc8a71d Do ref matching on the sender side rather than on receiver
This makes the receiver always send a full list of valid refs, which
will allow us to do better packs, as well as handle creation of new
refs.  Eventually.  Right now we just moved the matching and enabled it.

So now you can do

	git-send-pack host:path branch1 branch2

to only send branches "branch1" and "branch2".
2005-06-30 12:28:24 -07:00
Linus Torvalds
94fdb7aa17 git-send-pack: actually send the object pack
This concludes this lesson.  I've actually successfully sent an update
using the git-send-pack command.

Probably tons of work still to do, and nasty debugging, but it's now
actually potentially useful.
2005-06-30 10:17:39 -07:00
Linus Torvalds
56b6ed8881 Add comment on what send-pack still needs to do
Me tired.
2005-06-29 23:07:01 -07:00
Linus Torvalds
7f8e982834 Slow but steady progress on git pack receive/send 2005-06-29 22:50:48 -07:00
Linus Torvalds
e4b5c7fff4 git-send-pack: start parsing local/remote reference differences
Right now it just shows which refs it picks up, and whether they are
the same or changed on the remote end. Getting there..
2005-06-29 22:31:41 -07:00
Linus Torvalds
f3a3214e83 Make send/receive-pack be closer to doing something interesting 2005-06-29 20:50:15 -07:00
Linus Torvalds
61221472a5 Start of "git-send-pack", the local part of sending off a pack
Like git-receive-pack, this is only partway done.
2005-06-29 19:09:05 -07:00