Skip to content

Commit

Permalink
git-push: documentation and tests for pushing only branches
Browse files Browse the repository at this point in the history
Commit 098e711 caused git-push to match only branches when
considering which refs to push. This patch updates the
documentation accordingly and adds a test for this behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Sep 18, 2007
1 parent bf1ee63 commit 5c633a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Documentation/git-push.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ even if it does not result in a fast forward update.
Note: If no explicit refspec is found, (that is neither
on the command line nor in any Push line of the
corresponding remotes file---see below), then all the
refs that exist both on the local side and on the remote
heads that exist both on the local side and on the remote
side are updated.
+
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
Expand All @@ -61,7 +61,7 @@ the remote repository.

\--all::
Instead of naming each ref to push, specifies that all
refs be pushed.
refs under `$GIT_DIR/refs/heads/` be pushed.

\--tags::
All refs under `$GIT_DIR/refs/tags` are pushed, in
Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-send-pack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OPTIONS

\--all::
Instead of explicitly specifying which refs to update,
update all refs that locally exist.
update all heads that locally exist.

\--force::
Usually, the command refuses to update a remote ref that
Expand Down Expand Up @@ -70,7 +70,7 @@ With '--all' flag, all refs that exist locally are transferred to
the remote side. You cannot specify any '<ref>' if you use
this flag.

Without '--all' and without any '<ref>', the refs that exist
Without '--all' and without any '<ref>', the heads that exist
both on the local side and on the remote side are updated.

When one or more '<ref>' are specified explicitly, it can be either a
Expand Down
10 changes: 10 additions & 0 deletions t/t5400-send-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,14 @@ test_expect_success \
! git diff .git/refs/heads/master victim/.git/refs/heads/master
'

test_expect_success \
'pushing does not include non-head refs' '
mkdir parent && cd parent &&
git-init && touch file && git-add file && git-commit -m add &&
cd .. &&
git-clone parent child && cd child && git-push --all &&
cd ../parent &&
git-branch -a >branches && ! grep -q origin/master branches
'

test_done

0 comments on commit 5c633a4

Please sign in to comment.