Skip to content

git-cinnabar chokes on pre-epoch dates #355

@riastradh

Description

@riastradh
#!/usr/bin/env cram

Set up an initial hgrc for non-interactive use in this script:

  $ export HGRCPATH="$(pwd)/.hgrc"
  $ cat <<EOF >$HGRCPATH
  > [ui]
  > interactive = no
  > quiet = yes
  > verbose = no
  > EOF

Create an hg repository:

  $ hg init repo.hg
  $ echo hello >repo.hg/README
  $ hg -R repo.hg commit -u alice@example.com -d "2025-12-07T22:14:51Z" -Am foo

git-cinnabar can clone it just fine:

  $ git -c fetch.prune=true clone -q hg::$(pwd)/repo.hg repo.git
  $ git -C repo.git log --graph
  * commit 40a85d90856979ac2ba4aa55a786cf3e7d1cf10f
    Author:  <alice@example.com>
    Date:   Sun Dec 7 22:14:51 2025 +0000
    
        foo

Create a changeset with a pre-epoch date:

  $ echo world >>repo.hg/README
  $ hg -R repo.hg commit -u alice@example.com -d "1969-12-31T23:59:58Z" -m bar

git-cinnabar can't handle it:

  $ git -C repo.git fetch origin
  fatal: called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }
  Run the command again with `git -c cinnabar.check=traceback <command>` to see the full traceback.
  error: git-remote-hg died of signal 6
  fatal: could not read ref refs/cinnabar/refs/heads/branches/default/tip
  [128]

Maybe it's not reasonable for git-cinnabar to accept such dates, but if so, at least it would be nice to fail gracefully rather than crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions