diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-12-04 17:07:10 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-12-04 17:07:10 -0800 |
commit | 9bbe6db85f368fc4f75cc9f6c4bfaf2269bf0068 (patch) | |
tree | d626f21e0b87a364d213d3fba26cc92d9fb5a3f6 /builtin-push.c | |
parent | f64c81d4282b1dacf2cf095bfb0f7708b99b3ecf (diff) | |
parent | 605b4978a105e2f40a353513f616be7d20f91c15 (diff) | |
download | git-9bbe6db85f368fc4f75cc9f6c4bfaf2269bf0068.tar.gz |
Merge branch 'sp/refspec-match'
* sp/refspec-match:
refactor fetch's ref matching to use refname_match()
push: use same rules as git-rev-parse to resolve refspecs
add refname_match()
push: support pushing HEAD to real branch name
Diffstat (limited to 'builtin-push.c')
-rw-r--r-- | builtin-push.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin-push.c b/builtin-push.c index 41df717f84..c8cb63e238 100644 --- a/builtin-push.c +++ b/builtin-push.c @@ -44,6 +44,15 @@ static void set_refspecs(const char **refs, int nr) strcat(tag, refs[i]); ref = tag; } + if (!strcmp("HEAD", ref)) { + unsigned char sha1_dummy[20]; + ref = resolve_ref(ref, sha1_dummy, 1, NULL); + if (!ref) + die("HEAD cannot be resolved."); + if (prefixcmp(ref, "refs/heads/")) + die("HEAD cannot be resolved to branch."); + ref = xstrdup(ref + 11); + } add_refspec(ref); } } |