diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-08-12 13:19:07 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-08-12 13:19:08 -0700 |
| commit | 8faaf690f7174a9b56438788308de4fa195893e2 (patch) | |
| tree | 578b0a325694973abf3d1f766b6712fea55407c5 /builtin | |
| parent | Sync with Git 2.37.2 (diff) | |
| parent | symbolic-ref: refuse to set syntactically invalid target (diff) | |
| download | git-8faaf690f7174a9b56438788308de4fa195893e2.tar.gz git-8faaf690f7174a9b56438788308de4fa195893e2.zip | |
Merge branch 'lt/symbolic-ref-sanity'
"git symbolic-ref symref non..sen..se" is now diagnosed as an error.
* lt/symbolic-ref-sanity:
symbolic-ref: refuse to set syntactically invalid target
Diffstat (limited to 'builtin')
| -rw-r--r-- | builtin/symbolic-ref.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index e547a08d6c..1b0f10225f 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -71,6 +71,8 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) if (!strcmp(argv[0], "HEAD") && !starts_with(argv[1], "refs/")) die("Refusing to point HEAD outside of refs/"); + if (check_refname_format(argv[1], REFNAME_ALLOW_ONELEVEL) < 0) + die("Refusing to set '%s' to invalid ref '%s'", argv[0], argv[1]); ret = !!create_symref(argv[0], argv[1], msg); break; default: |
