git-push: fix --tags and document it.
Previously 'git-push --tags dst', used information from remotes/dst to determine which refs to push; this patch corrects it, and also documents the --tags option. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 15, 2006 at 23:27 UTC
42301e34a2736b091738d4ca6a23fd90bd1f1837
2 files changed
+21
-13
Documentation/git-push.txt
+6
-1
@@ -8,7 +8,7 @@ git-push - Update remote refs along with associated objects.
8
9
SYNOPSIS
10
--------
11
-'git-push' [--all] [--force] <repository> <refspec>...
11
+'git-push' [--all] [--tags] [--force] <repository> <refspec>...
12
13
DESCRIPTION
14
-----------
@@ -29,6 +29,11 @@ include::pull-fetch-param.txt[]
29
Instead of naming each ref to push, specifies all refs
30
to be pushed.
31
32
+\--tags::
33
+ All refs under `$GIT_DIR/refs/tags` are pushed, in
34
+ addition to refspecs explicitly listed on the command
35
+ line.
36
+
37
-f, \--force::
38
Usually, the command refuses to update a local ref that is
39
not an ancestor of the remote ref used to overwrite it.
git-push.sh
+15
-12
@@ -1,6 +1,6 @@
1
#!/bin/sh
2
3
-USAGE='[--all] [--force] <repository> [<refspec>...]'
3
+USAGE='[--all] [--tags] [--force] <repository> [<refspec>...]'
4
. git-sh-setup
5
6
# Parse out parameters and then stop at remote, so that we can
@@ -36,23 +36,26 @@ case "$#" in
36
echo "Where would you want to push today?"
37
usage ;;
38
esac
39
-if test ",$has_all,$do_tags," = ",--all,yes,"
40
-then
41
- do_tags=
42
-fi
39
40
. git-parse-remote
41
remote=$(get_remote_url "$@")
42
+
43
case "$has_all" in
47
---all) set x ;;
48
-'') set x $(get_remote_refs_for_push "$@") ;;
44
+--all)
45
+ set x ;;
46
+'')
47
+ case "$do_tags,$#" in
48
+ yes,1)
49
+ set x $(cd "$GIT_DIR/refs" && find tags -type f -print) ;;
50
+ yes,*)
51
+ set x $(cd "$GIT_DIR/refs" && find tags -type f -print) \
52
+ $(get_remote_refs_for_push "$@") ;;
53
+ ,*)
54
+ set x $(get_remote_refs_for_push "$@") ;;
55
+ esac
56
esac
50
-shift
57
52
-case "$do_tags" in
53
-yes)
54
- set "$@" $(cd "$GIT_DIR/refs" && find tags -type f -print) ;;
55
-esac
58
+shift ;# away the initial 'x'
59
60
# Now we have explicit refs from the command line or from remotes/
61
# shorthand, or --tags. Falling back on the current branch if we still