Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
To: git@vger.kernel.org
Subject: [bug report] `git log` with several `-L` might produce error
Date: Thu, 2 May 2024 21:29:04 +0300	[thread overview]
Message-ID: <CAP9Eqm1PsYBdjoVKgomJZe79_ZCOAtP4p7uvprUOerdjrcUjmQ@mail.gmail.com> (raw)

This is a bug report as per https://git-scm.com/community

# What did you do before the bug happened? (Steps to reproduce your issue)

Calling `git log` with several `-L` flags can result in an error.

Steps to reproduce (on Linux):
- Set up repo with a history:
    - `mkdir log-line-assert`
    - `cd log-line-assert`
    - `git init`
    - `echo "Line 1\nLine 2" > file`
    - `git add .`
    - `git commit -m 'Commit 1'`
    - `echo "Line 3\nLine 4\nLine 5" >> file`
    - `git add .`
    - `git commit -m 'Commit 2'`
- Execute the following command: `git log -L2,2:file -L4,4:file`

# What did you expect to happen? (Expected behavior)

Show log with evolution of lines 2 and 4.

# What happened instead? (Actual behavior)

An error with the following text:

```
git: line-log.c:73: range_set_append: Assertion `rs->nr == 0 ||
rs->ranges[rs->nr-1].end <= a' failed.
zsh: IOT instruction (core dumped)  git log -L2,2:file -L4,4:file
```

# What's different between what you expected and what actually happened?

An error for what looks like a valid command (as some other similar
commands work as expected, like `git log -L2,2:file -L3,3:file` or
`git log -L1,1:file -L4,4:file`).

# Anything else you want to add:

-

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.44.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.8.7-arch1-2 #1 SMP PREEMPT_DYNAMIC Fri, 19 Apr 2024
09:51:31 +0000 x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.39
$SHELL (typically, interactive shell): /usr/bin/zsh


[Enabled Hooks]
not run from a git repository - no hooks to show

                 reply	other threads:[~2024-05-02 18:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

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

  git send-email \
    --in-reply-to=CAP9Eqm1PsYBdjoVKgomJZe79_ZCOAtP4p7uvprUOerdjrcUjmQ@mail.gmail.com \
    --to=evgeni.chasnovski@gmail.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.
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).