diff options
| author | Junio C Hamano <gitster@pobox.com> | 2008-11-05 11:33:19 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2008-11-05 11:33:19 -0800 |
| commit | efcce2e1f0b37aed045d3e2b747380adf418bdd2 (patch) | |
| tree | 709170cd9b9dbb34b9873bd482bf5f5f03ffd414 /builtin-update-ref.c | |
| parent | 7bc9ed0d5b3dd2fb61cad033bb19e72358d54227 (diff) | |
| parent | 045a476f91a9a308c823a2709977163238baa3fd (diff) | |
| download | git-efcce2e1f0b37aed045d3e2b747380adf418bdd2.tar.gz | |
Merge branch 'mv/maint-branch-m-symref'
* mv/maint-branch-m-symref:
update-ref --no-deref -d: handle the case when the pointed ref is packed
git branch -m: forbid renaming of a symref
Fix git update-ref --no-deref -d.
rename_ref(): handle the case when the reflog of a ref does not exist
Fix git branch -m for symrefs.
Diffstat (limited to 'builtin-update-ref.c')
| -rw-r--r-- | builtin-update-ref.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin-update-ref.c b/builtin-update-ref.c index 56a0b1b39c..378dc1b7a6 100644 --- a/builtin-update-ref.c +++ b/builtin-update-ref.c @@ -13,7 +13,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) { const char *refname, *oldval, *msg=NULL; unsigned char sha1[20], oldsha1[20]; - int delete = 0, no_deref = 0; + int delete = 0, no_deref = 0, flags = 0; struct option options[] = { OPT_STRING( 'm', NULL, &msg, "reason", "reason of the update"), OPT_BOOLEAN('d', NULL, &delete, "deletes the reference"), @@ -47,9 +47,11 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) if (oldval && *oldval && get_sha1(oldval, oldsha1)) die("%s: not a valid old SHA1", oldval); + if (no_deref) + flags = REF_NODEREF; if (delete) - return delete_ref(refname, oldval ? oldsha1 : NULL); + return delete_ref(refname, oldval ? oldsha1 : NULL, flags); else return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL, - no_deref ? REF_NODEREF : 0, DIE_ON_ERR); + flags, DIE_ON_ERR); } |
