527
return 1;
528
}
529
530
-/*
531
- * Find the place in `snapshot->buf` where the start of the record for
532
- * `refname` starts. If `mustexist` is true and the reference doesn't
533
- * exist, then return NULL. If `mustexist` is false and the reference
534
- * doesn't exist, then return the point where that reference would be
535
- * inserted, or `snapshot->eof` (which might be NULL) if it would be
536
- * inserted at the end of the file. In the latter mode, `refname`
537
- * doesn't have to be a proper reference name; for example, one could
538
- * search for "refs/replace/" to find the start of any replace
539
- * references.
540
- *
541
- * The record is sought using a binary search, so `snapshot->buf` must
542
- * be sorted.
543
- */
544
-static const char *find_reference_location(struct snapshot *snapshot,
545
- const char *refname, int mustexist)
530
+static const char *find_reference_location_1(struct snapshot *snapshot,
531
+ const char *refname, int mustexist)
532
{
533
/*
534
* This is not *quite* a garden-variety binary search, because
574
return lo;
575
}
576
577
+/*
578
+ * Find the place in `snapshot->buf` where the start of the record for
579
+ * `refname` starts. If `mustexist` is true and the reference doesn't
580
+ * exist, then return NULL. If `mustexist` is false and the reference
581
+ * doesn't exist, then return the point where that reference would be
582
+ * inserted, or `snapshot->eof` (which might be NULL) if it would be
583
+ * inserted at the end of the file. In the latter mode, `refname`
584
+ * doesn't have to be a proper reference name; for example, one could
585
+ * search for "refs/replace/" to find the start of any replace
586
+ * references.
587
+ *
588
+ * The record is sought using a binary search, so `snapshot->buf` must
589
+ * be sorted.
590
+ */
591
+static const char *find_reference_location(struct snapshot *snapshot,
592
+ const char *refname, int mustexist)
593
+{
594
+ return find_reference_location_1(snapshot, refname, mustexist);
595
+}
596
+
597
/*
598
* Create a newly-allocated `snapshot` of the `packed-refs` file in
599
* its current state and return it. The return value will already have