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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx> 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@xxxxxxxxxxx> 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

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux