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

[bug report] `git log` with several `-L` might produce error

From
ECEvgeni Chasnovski <evgeni.chasnovski@gmail.com>
Date
May 2, 2024, 18:29 UTC
Message-ID
<CAP9Eqm1PsYBdjoVKgomJZe79_ZCOAtP4p7uvprUOerdjrcUjmQ@mail.gmail.com>
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

Message 1 of 1 in “[bug report] `git log` with several `-L` might produce error”
  1. Evgeni ChasnovskiMay 2, 2024

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.