{"thread":{"id":"61294","subject":"[BUG] fast-import crash on refs to in-flight commit SHA1","startedAt":"2024-04-08T15:25:26Z","lastAt":"2024-04-08T15:25:26Z","messageCount":1,"participants":["Marc Becker"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"492541","messageId":"d8415e36-bdd6-4e74-8240-eb71b669f178@astos.de","threadId":"61294","inReplyTo":null,"subject":"[BUG] fast-import crash on refs to in-flight commit SHA1","fromName":"Marc Becker","fromEmail":"marc.becker@astos.de","sentAt":"2024-04-08T15:18:04Z","receivedAt":"2024-04-08T15:25:26Z","isPatch":false,"sender":{"key":"marc.becker@astos.de","avatar":null},"body":"Using `from` with (not-yet-persistent) commit SHA1 crashes fast-import.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n  - use git-fast-import on a new repository\n  - create an arbitrary (marked) initial commit\n  - reference this commit by mark via `from` in `commit` or `reset`\n  - reference same commit by SHA1 (output of `get-mark`)\n\nWhat did you expect to happen? (Expected behavior)\n  - in-flight commit SHA1 is usable in `from` (see doc for <commit-ish>)\n\nWhat happened instead? (Actual behavior)\n  - fast-import crashes when using SHA1 format, claims invalid commit ID\n\nWhat's different between what you expected and what actually happened?\n  - in-flight commit SHA1 is usable immediately (no need for mitigation)\n\nAnything else you want to add:\n  - referencing an in-flight commit via SHA1 in `ls` works (see below)\n  - rerunning fast-import succeeds (commit already in initial data)\n  - using in-flight commit SHA1 AFTER issuing `checkpoint` succeeds\n\n...\ngit init\ngit fast-import <<EOF\n# input to trigger Git fast-import bug\ncommit refs/heads/main\nmark :1234\ncommitter Bug <bugs@git-scm.com> 1712563200 +0000\ndata 14\ncommit message\nM 644 inline test file\ndata 14\ndummy content\n\nget-mark :1234\n# create new ref from existing mark\nreset refs/heads/other\nfrom :1234\n# reference file in existing commit (SHA1 is valid)\nls 7f2839d29d46b5a9fff5572143f5370f152f7b33 test file\n# checkpoint needed to use in-flight commit via SHA1\n#checkpoint\n# create new ref from existing commit\nreset refs/heads/failed\nfrom 7f2839d29d46b5a9fff5572143f5370f152f7b33\n# use plain ref in commit\ncommit refs/heads/works\ncommitter Bug <bugs@git-scm.com> 1712563300 +0000\ndata 18\nnew commit message\nfrom 7f2839d29d46b5a9fff5572143f5370f152f7b33\n# finish import\ndone\nEOF\n\n\n[System Info]\ngit version:\ngit version 2.39.2\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 4.4.0-19041-Microsoft #3996-Microsoft Thu Jan 18 16:36:00 \nPST 2024 x86_64\ncompiler info: gnuc: 12.2\nlibc info: glibc: 2.36\n$SHELL (typically, interactive shell): /bin/bash\n\n"}]}