git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [QGit PATCH] Remove most ASSERT warnings in Git::setStatus

From
MCMarco Costalba <mcostalba@gmail.com>
Date
May 20, 2007, 14:23 UTC
Message-ID
<e5bfff550705200723i7b4e21ebi6a2c51d66659b388@mail.gmail.com>
In-Reply-To
<200705201558.53546.barra_cuda@katamail.com>
On 5/20/07, Michael <barra_cuda@katamail.com> wrote:
Show 23 quoted lines
> "Marco Costalba" <mcostalba@gmail.com>:
> > On 5/20/07, Michael <barra_cuda@katamail.com> wrote:
> > > Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
> > > ---
> > >
> > > ...is this correct?
> > >
> > >  src/git_startup.cpp |    2 +-
> > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > >
> > > diff --git a/src/git_startup.cpp b/src/git_startup.cpp
> > > index a99edba..17312f9 100644
> > > --- a/src/git_startup.cpp
> > > +++ b/src/git_startup.cpp
> > > @@ -329,7 +329,7 @@ void Git::parseDiffFormatLine(RevFile& rf, SCRef line, int parNum) {
> > >
> > >                 // TODO rename/copy is not supported for combined merges
> > >                 appendFileName(rf, line.section('\t', -1));
> > > -               setStatus(rf, line.section(' ', 6, 6).left(1));
> > > +               setStatus(rf, line.section('\t', -2, -2).right(1));
> > >                 rf.mergeParent.append(parNum);
> > >         } else { // faster parsing in normal case
> > >
>From diff-format.txt we have that an output line is formatted this way:

------------------------------------------------ in-place edit :100644 100644 bcd1234... 0123456... M file0 copy-edit :100644 100644 abcd123... 1234567... C68 file1 file2 rename-edit :100644 100644 abcd123... 1234567... R86 file1 file3 create :000000 100644 0000000... 1234567... A file4 delete :100644 000000 1234567... 0000000... D file5 unmerged :000000 000000 0000000... 0000000... U file6 ------------------------------------------------

That is, from the left to the right:

. a colon. . mode for "src"; 000000 if creation or unmerged. . a space. . mode for "dst"; 000000 if deletion or unmerged. . a space. . sha1 for "src"; 0\{40\} if creation or unmerged. . a space. . sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree". . a space. . status, followed by optional "score" number. . a tab or a NUL when '-z' option is used. . path for "src" . a tab or a NUL when '-z' option is used; only exists for C or R. . path for "dst"; only exists for C or R. . an LF or a NUL when '-z' option is used, to terminate the record.

So I rather would prefer something like
  line.section('\t', 0, 0).section(' ', -1, -1).left(1)
because we could have more then one file separated by a tab, so
 line.section('\t', -2, -2).right(1)
it seems to me a little bit fragile. What do you think?

Also I don't understand why you consider the right most (right(1)), instead of the left most character as the status.

Thanks Marco

Previous: MichaelNext: Michael
Message 3 of 5 in “Re: [QGit PATCH] Remove most ASSERT warnings in Git::setStatus”
  1. Marco CostalbaMay 20, 2007
  2. MichaelMay 20, 2007
  3. Marco CostalbaMay 20, 2007
  4. MichaelMay 20, 2007
  5. Marco CostalbaMay 20, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.