From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Santi B?jar <sbejar@gmail.com>, gitster@pobox.com
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [REPLACEMENT PATCH] bundle create: keep symbolic refs' names instead of resolving them
Date: Thu, 22 Nov 2007 12:24:59 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.64.0711221224230.27959@racer.site> (raw)
In-Reply-To: <Pine.LNX.4.64.0711211652470.27959@racer.site>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2101 bytes --]
When creating a bundle, symbolic refs used to be resolved to the
non-symbolic refs they point to before being written to the list
of contained refs. I.e. "git bundle create a1.bundle HEAD master"
would show something like
388afe7881b33102fada216dd07806728773c011 refs/heads/master
388afe7881b33102fada216dd07806728773c011 refs/heads/master
instead of
388afe7881b33102fada216dd07806728773c011 HEAD
388afe7881b33102fada216dd07806728773c011 refs/heads/master
Introduce a special handling so that the symbolic refs are listed
with the names passed on the command line.
Noticed by Santi Béjar.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
... and this patch actually does not break the test suite.
bundle.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/bundle.c b/bundle.c
index e4d60cd..9b9b916 100644
--- a/bundle.c
+++ b/bundle.c
@@ -6,6 +6,7 @@
#include "revision.h"
#include "list-objects.h"
#include "run-command.h"
+#include "refs.h"
static const char bundle_signature[] = "# v2 git bundle\n";
@@ -232,11 +233,17 @@ int create_bundle(struct bundle_header *header, const char *path,
struct object_array_entry *e = revs.pending.objects + i;
unsigned char sha1[20];
char *ref;
+ const char *display_ref;
+ int flag;
if (e->item->flags & UNINTERESTING)
continue;
if (dwim_ref(e->name, strlen(e->name), sha1, &ref) != 1)
continue;
+ if (!resolve_ref(e->name, sha1, 1, &flag))
+ flag = 0;
+ display_ref = (flag & REF_ISSYMREF) ? e->name : ref;
+
/*
* Make sure the refs we wrote out is correct; --max-count and
* other limiting options could have prevented all the tips
@@ -287,7 +294,7 @@ int create_bundle(struct bundle_header *header, const char *path,
ref_count++;
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, display_ref, strlen(display_ref));
write_or_die(bundle_fd, "\n", 1);
free(ref);
}
--
1.5.3.6.1977.g54d30
next prev parent reply other threads:[~2007-11-22 12:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 14:54 Wishlist for a bundle-only transport mode Santi Béjar
2007-11-21 15:04 ` Jakub Narebski
2007-11-21 15:24 ` Santi Béjar
2007-11-21 15:46 ` Johannes Schindelin
2007-11-21 16:52 ` Jakub Narebski
2007-11-21 16:59 ` Johannes Schindelin
2007-11-21 17:11 ` Jakub Narebski
2007-11-21 17:26 ` Johannes Schindelin
2007-11-21 17:52 ` Jakub Narebski
2007-11-22 9:42 ` Santi Béjar
2007-11-22 10:02 ` Junio C Hamano
2007-11-23 9:18 ` Jakub Narebski
2007-11-23 9:31 ` Junio C Hamano
2007-11-23 10:04 ` Jakub Narebski
2007-11-23 10:13 ` Santi Béjar
2007-11-23 12:18 ` Johannes Schindelin
2007-11-23 15:06 ` Junio C Hamano
2007-11-23 15:34 ` Santi Béjar
2007-11-23 16:05 ` Junio C Hamano
2007-11-23 16:39 ` Santi Béjar
2007-11-24 19:15 ` Junio C Hamano
2007-11-23 19:09 ` Jakub Narebski
2007-11-21 15:59 ` Johannes Schindelin
2007-11-21 16:15 ` Santi Béjar
2007-11-21 16:36 ` Johannes Schindelin
2007-11-21 16:44 ` Santi Béjar
2007-11-21 16:53 ` [PATCH] bundle create: keep symbolic refs' names instead of resolving them Johannes Schindelin
2007-11-22 12:03 ` Johannes Schindelin
2007-11-22 12:24 ` Johannes Schindelin [this message]
2007-11-21 16:23 ` Wishlist for a bundle-only transport mode Kristian Høgsberg
2007-11-21 17:07 ` Johannes Schindelin
2007-11-21 17:06 ` Jakub Narebski
2007-11-21 17:29 ` Johannes Schindelin
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=Pine.LNX.4.64.0711221224230.27959@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sbejar@gmail.com \
/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).