summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-23 11:28:08 -0700
committerJunio C Hamano <gitster@pobox.com>2015-03-23 11:28:08 -0700
commitc12eca7ed24a4ccf8d1d9c3c2b84595501af4bea (patch)
treed92b7d7cb7b40ebd24feea0052f1903826eae0b4 /upload-pack.c
parenta633651d214d855a036535f6f64b5eba58892a0f (diff)
parent8ddf3ca74f40bebd79cedba5ba82ca9f2eb33860 (diff)
downloadgit-c12eca7ed24a4ccf8d1d9c3c2b84595501af4bea.tar.gz
Merge branch 'jk/smart-http-hide-refs'
The transfer.hiderefs support did not quite work for smart-http transport. * jk/smart-http-hide-refs: upload-pack: do not check NULL return of lookup_unknown_object upload-pack: fix transfer.hiderefs over smart-http
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/upload-pack.c b/upload-pack.c
index b531a325d2..aa84576500 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -681,7 +681,7 @@ static void receive_needs(void)
}
/* return non-zero if the ref is hidden, otherwise 0 */
-static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+static int mark_our_ref(const char *refname, const unsigned char *sha1)
{
struct object *o = lookup_unknown_object(sha1);
@@ -689,12 +689,16 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag
o->flags |= HIDDEN_REF;
return 1;
}
- if (!o)
- die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
o->flags |= OUR_REF;
return 0;
}
+static int check_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+{
+ mark_our_ref(refname, sha1);
+ return 0;
+}
+
static void format_symref_info(struct strbuf *buf, struct string_list *symref)
{
struct string_list_item *item;
@@ -713,7 +717,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
const char *refname_nons = strip_namespace(refname);
unsigned char peeled[20];
- if (mark_our_ref(refname, sha1, flag, NULL))
+ if (mark_our_ref(refname, sha1))
return 0;
if (capabilities) {
@@ -767,8 +771,8 @@ static void upload_pack(void)
advertise_shallow_grafts(1);
packet_flush(1);
} else {
- head_ref_namespaced(mark_our_ref, NULL);
- for_each_namespaced_ref(mark_our_ref, NULL);
+ head_ref_namespaced(check_ref, NULL);
+ for_each_namespaced_ref(check_ref, NULL);
}
string_list_clear(&symref, 1);
if (advertise_refs)