Thread (14 messages) flat view 14 messages, 3 authors, 2016-06-15

Re: [PATCH 7/7] sha1_name: implement finding @{push}

From: Ramkumar Ramachandra <hidden>
Date: 2016-06-15 22:57:26

Duy Nguyen wrote:
On Thu, May 23, 2013 at 10:12 PM, Ramkumar Ramachandra
[off-list ref] wrote:
quoted
Try this now: configure your current branch's pushremote to push to
"refs/heads/*:refs/heads/rr/*".  Now, type 'git show @{p}'.  Voila!
Voila what? Why not avoid guessing game and describe what the patch is for?
If you're on branch master, it'll output refs/heads/rr/master.  The
topic is about having a @{push} corresponding to @{upstream}
quoted
+static void find_push_ref(struct branch *branch) {
+       struct remote *remote = pushremote_get(NULL);
+       const struct refspec *pat = NULL;
+       char raw_ref[PATH_MAX];
+       struct ref *this_ref;
+       char *dst_name;
+       int len;
+
+       sprintf(raw_ref, "refs/heads/%s", branch->name);
+       len = strlen(raw_ref) + 1;
+       this_ref = xcalloc(1, sizeof(*this_ref) + len);
+       memcpy(this_ref->name, raw_ref, len);
+
+       dst_name = get_ref_match(remote->push, remote->push_refspec_nr,
+                               this_ref, MATCH_REFS_ALL, 0, &pat);
+       printf("dst_name = %s\n", dst_name);
+}
+
Isn't this an abuse of extended sha-1 syntax? How can I combine this
with other @{}, ^, ~...?
I'm unsure what you mean.  How can I be on branch master^1?  Did you
read the cover-letter?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help