diff options
author | Jeff King <peff@peff.net> | 2015-01-12 21:28:58 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-01-14 10:28:02 -0800 |
commit | f6786c8dcba34d0cea54a065efd79af678cb8dea (patch) | |
tree | beb04e01913421fe714de1b937ba90e612db7c19 /contrib/mw-to-git | |
parent | Merge branch 'maint-2.0' into maint-2.1 (diff) | |
download | tgif-f6786c8dcba34d0cea54a065efd79af678cb8dea.tar.xz |
http-push: trim trailing newline from remote symref
When we fetch a symbolic ref file from the remote, we get
the whole string "ref: refs/heads/master\n", recognize it by
skipping past the "ref: ", and store the rest. We should
chomp the trailing newline.
This bug was introduced in ae021d8 (use skip_prefix to avoid
magic numbers, 2014-06-18), which did not notice that the
length computation fed to xmemdupz was quietly tweaked by 1
to account for this.
We can solve it by explicitly trimming the newline, which is
more obvious. Note that we use strbuf_rtrim here, which will
actually cut off any trailing whitespace, not just a single
newline. This is a good thing, though, as it makes our
parsing more liberal (and spaces are not valid in refnames
anyway).
Signed-off-by: Jeff King <peff@peff.net>
Tested-by: Kyle J. McKay <mackyle@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/mw-to-git')
0 files changed, 0 insertions, 0 deletions