git/refs
Junio C Hamano 145136a95a C: use skip_prefix() to avoid hardcoded string length
We often skip an optional prefix in a string with a hardcoded
constant, e.g.

	if (starts_with(string, "prefix"))
		string += 6;

which is less error prone when written

	skip_prefix(string, "prefix", &string);

Note that this changes a few error messages from "git reflog expire
--expire=nonsense.timestamp", which used to complain by saying

    '--expire=nonsense.timestamp' is not a valid timestamp

but with this change, we say

    'nonsense.timestamp' is not a valid timestamp

which is more technically correct (the string with --expire= as
a prefix obviously cannot be a valid timestamp, but the error is
about the part of the input without that prefix).

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-01-31 13:03:45 -08:00
..
files-backend.c C: use skip_prefix() to avoid hardcoded string length 2020-01-31 13:03:45 -08:00
iterator.c refs.c: migrate internal ref iteration to pass thru repository argument 2018-08-21 10:22:50 -07:00
packed-backend.c pack-refs: always refresh after taking the lock file 2019-08-02 09:59:05 -07:00
packed-backend.h refs/packed-backend.h: add missing declaration (hdr-check) 2018-09-20 11:50:00 -07:00
ref-cache.c convert "oidcmp() != 0" to "!oideq()" 2018-08-29 11:32:49 -07:00
ref-cache.h refs/ref-cache.h: add missing declarations (hdr-check) 2018-09-20 11:50:00 -07:00
refs-internal.h Fix spelling errors in code comments 2019-11-10 16:00:54 +09:00