git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Kelly F. Hickel" <kfh@mqsoftware.com>
To: <git@vger.kernel.org>
Subject: Question about fixing windows bug reading graft data
Date: Mon, 8 Jun 2009 12:19:37 -0500	[thread overview]
Message-ID: <63BEA5E623E09F4D92233FB12A9F794303117E06@emailmn.mqsoftware.com> (raw)

Hi All,
	Ran into a bug trying to use grafts on windows with cygwin git
version 1.6.1.2.  I've verified that the bug is still there in the
latest source, and was going to submit a patch, but then I noticed that
there seem to be more occurrences in commit.c, and wondered if there was
a better way to fix it than what I had first come up with.

The bug, is that in in commit.c, the code strips '\n', but not '\r', so
the code says the graft data is bad:
struct commit_graft *read_graft_line(char *buf, int len) {
        /* The format is just "Commit Parent1 Parent2 ...\n" */
        int i;
        struct commit_graft *graft = NULL;

        if (buf[len-1] == '\n')
                buf[--len] = 0;
        if (buf[0] == '#' || buf[0] == '\0')
                return NULL;
        if ((len + 1) % 41) {
        bad_graft_data:
                error("bad graft data: %s", buf);
                free(graft);
                return NULL;
        }

My first plan was to fix it the way that xdiff-interface.c handles it,
assuming that was "the Git way" to deal with CRLF:
        /* Exclude terminating newline (and cr) from matching */
        if (len > 0 && line[len-1] == '\n') {
                if (len > 1 && line[len-2] == '\r')
                        len -= 2;
                else
                        len--;
        }

But I noticed that there seemed to be several checks for '\n' in
commit.c that didn't check for '\r', and wondered if there was a reason,
or if there'd be a better way to handle it.....



--
 
Kelly F. Hickel
Senior Product Architect
MQSoftware, Inc.
952-345-8677 Office
952-345-8721 Fax
kfh@mqsoftware.com
www.mqsoftware.com
Certified IBM SOA Specialty
Your Full Service Provider for IBM WebSphere Learn more at
www.mqsoftware.com 

             reply	other threads:[~2009-06-08 17:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 17:19 Kelly F. Hickel [this message]
2009-07-27 17:33 ` Question about fixing windows bug reading graft data Kelly F. Hickel
2009-07-27 17:55   ` Johannes Schindelin
2009-07-27 19:31     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63BEA5E623E09F4D92233FB12A9F794303117E06@emailmn.mqsoftware.com \
    --to=kfh@mqsoftware.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).