Skip to content

Commit 5c633a4

Browse files
peffgitster
authored andcommitted
git-push: documentation and tests for pushing only branches
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>
1 parent bf1ee63 commit 5c633a4

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Documentation/git-push.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ even if it does not result in a fast forward update.
4848
Note: If no explicit refspec is found, (that is neither
4949
on the command line nor in any Push line of the
5050
corresponding remotes file---see below), then all the
51-
refs that exist both on the local side and on the remote
51+
heads that exist both on the local side and on the remote
5252
side are updated.
5353
+
5454
`tag <tag>` means the same as `refs/tags/<tag>:refs/tags/<tag>`.
@@ -61,7 +61,7 @@ the remote repository.
6161

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

6666
\--tags::
6767
All refs under `$GIT_DIR/refs/tags` are pushed, in

Documentation/git-send-pack.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ OPTIONS
3232

3333
\--all::
3434
Instead of explicitly specifying which refs to update,
35-
update all refs that locally exist.
35+
update all heads that locally exist.
3636

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

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

7676
When one or more '<ref>' are specified explicitly, it can be either a

t/t5400-send-pack.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,14 @@ test_expect_success \
113113
! git diff .git/refs/heads/master victim/.git/refs/heads/master
114114
'
115115

116+
test_expect_success \
117+
'pushing does not include non-head refs' '
118+
mkdir parent && cd parent &&
119+
git-init && touch file && git-add file && git-commit -m add &&
120+
cd .. &&
121+
git-clone parent child && cd child && git-push --all &&
122+
cd ../parent &&
123+
git-branch -a >branches && ! grep -q origin/master branches
124+
'
125+
116126
test_done

0 commit comments

Comments
 (0)