GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — diff: -U/-C given with -u/-c uses the wrong context length · Issue #340 · uutils/diffutils

diff: -U/-C given with -u/-c uses the wrong context length #340

New issue
Copy link
New issue
Copy link
Open
#341
Open
diff: -U/-C given with -u/-c uses the wrong context length#340
#341
Copy link

Description

@qodelicious
qodelicious
opened on Nov 7, 2026
Issue body actions

When more than one context length is given, GNU diff uses the biggest one, and a plain -u or -c counts as 3. We just keep the last number that was given, and a plain -u or -c doesn't count at all. So -U1 -u gives 1 line of context here and 3 with GNU.

$ printf 'a\nb\nc\nd\ne\nf\ng\nh\n' > a
$ printf 'a\nB\nc\nd\ne\nf\nG\nh\n' > b
$ diff -U1 -u a b | sed -n 3p        # GNU diff 3.10
@@ -1,8 +1,8 @@
$ diffutils diff -U1 -u a b | sed -n 3p
@@ -1,3 +1,3 @@

Same thing with -U2 -U1 (GNU uses 2, we use 1) and with -C1 -c.

Activity

  1. qodelicious
    added 2 commits that reference this issue on Nov 8, 2026

    diff: move the context length tests to test_diff.rs

    74e4f83

    diff: move the context length tests to test_diff.rs

    59741a1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.