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>
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>
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>
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.
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>
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.
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.
"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.
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".
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.