File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -341,13 +341,17 @@ static struct ref_dir *get_ref_dir(struct ref_entry *entry)
341
341
}
342
342
343
343
/*
344
- * Check if a refname is safe.
345
- * For refs that start with "refs/" we consider it safe as long they do
346
- * not try to resolve to outside of refs/.
344
+ * Return true iff refname is minimally safe. "Safe" here means that
345
+ * deleting a loose reference by this name will not do any damage, for
346
+ * example by causing a file that is not a reference to be deleted.
347
+ * This function does not check that the reference name is legal; for
348
+ * that, use check_refname_format().
347
349
*
348
- * For all other refs we only consider them safe iff they only contain
349
- * upper case characters and '_' (like "HEAD" AND "MERGE_HEAD", and not like
350
- * "config").
350
+ * We consider a refname that starts with "refs/" to be safe as long
351
+ * as any ".." components that it might contain do not escape "refs/".
352
+ * Names that do not start with "refs/" are considered safe iff they
353
+ * consist entirely of upper case characters and '_' (like "HEAD" and
354
+ * "MERGE_HEAD" but not "config" or "FOO/BAR").
351
355
*/
352
356
static int refname_is_safe (const char * refname )
353
357
{
You can’t perform that action at this time.
0 commit comments