git filter branch - git ignores $GIT_AUTHOR_DATE -- is this a bug? -
edit: summary: git not allow dates before 1973/03/03 09:46:40 (epoch+100000000s) given in "internal date format" (seconds since epoch). allow "20110224" short form of "2011-02-24". -- this no bug: not really, not documented well. -- workaround: not rely on git internal date when cannot. -- thanks to: hobbs
hi all,
i have issues git filter-branch have tracked down git commit-tree. consider script:
#!/bin/bash # please run these commands in empty directory # (should not destroy existing repo, though. think # few dangling objects) set -e -o pipefail git init tree=$(git write-tree) commit=$(echo "my first commit -- tree empty" | env git_author_date="0 +0000" git commit-tree $tree) echo "this commit $commit:" git cat-file commit $commit
note env git_author_date="0 +0000"
sets date using "git internal format" -- see git-commit-tree's manpage details -- 1970-01-01.
but output of script (the raw commit) is
tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 author jane doe <jane> 1298477214 +0100 committer jane doe <jane> 1298477214 +0100 first commit -- tree empty
now why git ignoring $git_author_date? if of significance, git --version
gives git version 1.7.1
.
found in git date parser code:
/* * seconds since 1970? trigger on numbers * more 8 digits. because don't want rule out * numbers 20070606 yyyymmdd date. */ if (num >= 100000000 && nodate(tm)) {
since code explicitly rejects small numbers possible unix-dates, , string doesn't parse other date format, git_author_date
treated invalid , ignored entirely (and apparently, silently).
your method should work fine though long stick synthesizing commits took place after 1973. otherwise, use 1 of other date formats :)
Comments
Post a Comment