git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rodolphe Belouin <rodolphe.belouin@gmail.com>
To: git@vger.kernel.org
Cc: Rodolphe Belouin <rodolphe.belouin@gmail.com>
Subject: [PATCH] builtin/push.c: Add `--notes` option
Date: Fri, 20 Sep 2013 14:20:08 +0200	[thread overview]
Message-ID: <1379679608-72475-1-git-send-email-rodolphe.belouin@gmail.com> (raw)

Make the user able to call `git push --notes` instead of
`git push refs/notes/*`

Signed-off-by: Rodolphe Belouin <rodolphe.belouin@gmail.com>
---
 Documentation/git-push.txt | 9 +++++++--
 builtin/push.c             | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 9eec740..2502dbd 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -9,7 +9,7 @@ git-push - Update remote refs along with associated objects
 SYNOPSIS
 --------
 [verse]
-'git push' [--all | --mirror | --tags] [--follow-tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
+'git push' [--all | --mirror | --tags | --notes] [--follow-tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
 	   [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose] [-u | --set-upstream]
 	   [--force-with-lease[=<refname>[:<expect>]]]
 	   [--no-verify] [<repository> [<refspec>...]]
@@ -30,7 +30,7 @@ current branch is consulted to determine where to push.  If the
 configuration is missing, it defaults to 'origin'.
 
 When the command line does not specify what to push with `<refspec>...`
-arguments or `--all`, `--mirror`, `--tags` options, the command finds
+arguments or `--all`, `--mirror`, `--tags`, `--notes` options, the command finds
 the default `<refspec>` by consulting `remote.*.push` configuration,
 and if it is not found, honors `push.default` configuration to decide
 what to push (See gitlink:git-config[1] for the meaning of `push.default`).
@@ -124,6 +124,11 @@ already exists on the remote side.
 	from the remote but are pointing at commit-ish that are
 	reachable from the refs being pushed.
 
+--notes::
+	All refs under `refs/notes` are pushed, in
+	addition to refspecs explicitly listed on the command
+	line.
+
 --receive-pack=<git-receive-pack>::
 --exec=<git-receive-pack>::
 	Path to the 'git-receive-pack' program on the remote
diff --git a/builtin/push.c b/builtin/push.c
index 7b1b66c..c407ccc 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -445,6 +445,7 @@ static int option_parse_recurse_submodules(const struct option *opt,
 int cmd_push(int argc, const char **argv, const char *prefix)
 {
 	int flags = 0;
+	int notes = 0;
 	int tags = 0;
 	int rc;
 	const char *repo = NULL;	/* default repository */
@@ -455,6 +456,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 		OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
 			    (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
 		OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")),
+		OPT_BOOL( 0 , "notes", &notes, N_("push notes (can't be used with --all or --mirror)")),
 		OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
 		OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
 		OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
@@ -484,14 +486,17 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	git_config(git_default_config, NULL);
 	argc = parse_options(argc, argv, prefix, options, push_usage, 0);
 
-	if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
-		die(_("--delete is incompatible with --all, --mirror and --tags"));
+	if (deleterefs && (tags || notes || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
+		die(_("--delete is incompatible with --all, --mirror, --tags and --notes"));
 	if (deleterefs && argc < 2)
 		die(_("--delete doesn't make sense without any refs"));
 
 	if (tags)
 		add_refspec("refs/tags/*");
 
+	if (notes)
+		add_refspec("refs/notes/*");
+
 	if (argc > 0) {
 		repo = argv[0];
 		set_refspecs(argv + 1, argc - 1);
-- 
1.8.4.412.g79e46c9.dirty

             reply	other threads:[~2013-09-20 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 12:20 Rodolphe Belouin [this message]
2013-09-29 11:59 ` [PATCH] builtin/push.c: Add `--notes` option Johan Herland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379679608-72475-1-git-send-email-rodolphe.belouin@gmail.com \
    --to=rodolphe.belouin@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).