From: Mark Levedahl <mdl123@verizon.net>
To: Johannes.Schindelin@gmx.de
Cc: junkio@cox.net, git@vger.kernel.org, Mark Levedahl <mdl123@verizon.net>
Subject: [PATCH] git-bundle: die if the bundle is empty.
Date: Thu, 08 Mar 2007 22:51:56 -0500 [thread overview]
Message-ID: <11734123161927-git-send-email-mdl123@verizon.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0703090348300.22628@wbgn013.biozentrum.uni-wuerzburg.de>
A common use of bundle is to schedule nightly emailed updates to a remote
system containing all updates made over a given period. We want bundle
to complain only if the resulting bundle would be empty, but not if at
least one of the given refs has an update resulting in a non-empty bundle.
Signed-off-by: Mark Levedahl <mdl123@verizon.net>
---
builtin-bundle.c | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/builtin-bundle.c b/builtin-bundle.c
index c85f996..b888a9f 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -261,6 +261,7 @@ static int create_bundle(struct bundle_header *header, const char *path,
int argc, const char **argv)
{
int bundle_fd = -1;
+ int isempty = 1;
const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));
const char **argv_pack = xmalloc(5 * sizeof(const char *));
int pid, in, out, i, status;
@@ -328,17 +329,17 @@ static int create_bundle(struct bundle_header *header, const char *path,
* other limiting options could have prevented all the tips
* from getting output.
*/
- if (!(e->item->flags & SHOWN)) {
- warn("ref '%s' is excluded by the rev-list options",
- e->name);
- continue;
+ if ((e->item->flags & SHOWN)) {
+ isempty = 0;
+ write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40);
+ write_or_die(bundle_fd, " ", 1);
+ write_or_die(bundle_fd, ref, strlen(ref));
+ write_or_die(bundle_fd, "\n", 1);
}
- write_or_die(bundle_fd, sha1_to_hex(e->item->sha1), 40);
- write_or_die(bundle_fd, " ", 1);
- write_or_die(bundle_fd, ref, strlen(ref));
- write_or_die(bundle_fd, "\n", 1);
free(ref);
}
+ if (isempty)
+ die("Bundle is empty");
/* end header */
write_or_die(bundle_fd, "\n", 1);
--
1.5.0.3.927.g2432c-dirty
prev parent reply other threads:[~2007-03-09 3:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-09 2:48 [PATCH 2/3] git-bundle: die if a given ref is not included in bundle Johannes Schindelin
2007-03-09 3:17 ` Mark Levedahl
2007-03-09 7:17 ` Junio C Hamano
2007-03-09 13:40 ` Mark Levedahl
2007-03-09 15:36 ` Mark Levedahl
2007-03-09 16:30 ` [PATCH] git-bundle: only die if pack would be empty, warn if ref is skipped Johannes Schindelin
2007-03-10 5:44 ` Mark Levedahl
2007-03-09 23:37 ` [PATCH 2/3] git-bundle: die if a given ref is not included in bundle Junio C Hamano
2007-03-10 5:48 ` Mark Levedahl
2007-03-10 15:39 ` Johannes Schindelin
2007-03-10 16:14 ` Mark Levedahl
2007-03-10 16:53 ` Johannes Schindelin
2007-03-10 18:30 ` Mark Levedahl
2007-03-11 1:08 ` Johannes Schindelin
2007-03-11 1:29 ` Junio C Hamano
2007-03-11 1:54 ` Johannes Schindelin
2007-03-11 14:51 ` Mark Levedahl
2007-03-11 19:58 ` Junio C Hamano
2007-03-11 22:28 ` Johannes Schindelin
2007-03-13 3:16 ` Mark Levedahl
2007-03-09 3:51 ` Mark Levedahl [this message]
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=11734123161927-git-send-email-mdl123@verizon.net \
--to=mdl123@verizon.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).