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

[BUG] fast-import crash on refs to in-flight commit SHA1

From
MBMarc Becker <marc.becker@astos.de>
Date
Apr 8, 2024, 15:18 UTC
Message-ID
<d8415e36-bdd6-4e74-8240-eb71b669f178@astos.de>
Using `from` with (not-yet-persistent) commit SHA1 crashes fast-import.
What did you do before the bug happened? (Steps to reproduce your issue)
  - use git-fast-import on a new repository
  - create an arbitrary (marked) initial commit
  - reference this commit by mark via `from` in `commit` or `reset`
  - reference same commit by SHA1 (output of `get-mark`)
What did you expect to happen? (Expected behavior)
  - in-flight commit SHA1 is usable in `from` (see doc for <commit-ish>)
What happened instead? (Actual behavior)
  - fast-import crashes when using SHA1 format, claims invalid commit ID
What's different between what you expected and what actually happened?
  - in-flight commit SHA1 is usable immediately (no need for mitigation)
Anything else you want to add:
  - referencing an in-flight commit via SHA1 in `ls` works (see below)
  - rerunning fast-import succeeds (commit already in initial data)
  - using in-flight commit SHA1 AFTER issuing `checkpoint` succeeds

... git init git fast-import <<EOF # input to trigger Git fast-import bug commit refs/heads/main mark :1234 committer Bug <bugs@git-scm.com> 1712563200 +0000 data 14 commit message M 644 inline test file data 14 dummy content

get-mark :1234 # create new ref from existing mark reset refs/heads/other from :1234 # reference file in existing commit (SHA1 is valid) ls 7f2839d29d46b5a9fff5572143f5370f152f7b33 test file # checkpoint needed to use in-flight commit via SHA1 #checkpoint # create new ref from existing commit reset refs/heads/failed from 7f2839d29d46b5a9fff5572143f5370f152f7b33 # use plain ref in commit commit refs/heads/works committer Bug <bugs@git-scm.com> 1712563300 +0000 data 18 new commit message from 7f2839d29d46b5a9fff5572143f5370f152f7b33 # finish import done EOF

[System Info] git version: git version 2.39.2 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 4.4.0-19041-Microsoft #3996-Microsoft Thu Jan 18 16:36:00 PST 2024 x86_64 compiler info: gnuc: 12.2 libc info: glibc: 2.36 $SHELL (typically, interactive shell): /bin/bash

Message 1 of 1 in “[BUG] fast-import crash on refs to in-flight commit SHA1”
  1. Marc BeckerApr 8, 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.