Re: Broken adding of cache entries
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 8, 2005, 22:18 UTC
- Message-ID
- <7v7ji94b1d.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20050508212202.GM9495@pasky.ji.cz>
>>>>> "PB" == Petr Baudis <pasky@ucw.cz> writes:
PB> Still, I'd like to know why the checking in write-tree is necessary.
The following is just a rephrase of what I wrote in my previous message <7vll6q70mg.fsf@assigned-by-dhcp.cox.net>.
------------ test.sh ------------ #!/bin/sh
test="++testdir" rm -fr $test mkdir $test cd $test || exit
show () {
echo "# ls ($1)"
ls -F
echo "# git-ls-files --stage ($1)"
git-ls-files --stage
case "$2" in
'') ;;
?*)
echo "# git-ls-tree -r ($1)"
git-ls-tree -r $2
;;
esac
}echo "# Original" git-init-db date >not-so-interesting git-update-cache --add not-so-interesting original=$(echo Original | git-commit-tree $(git-write-tree)) show Original $original rm -rf path not-so-interesting
echo "# Branch A"
git-read-tree $original
git-checkout-cache -f -a
date >path
git-update-cache --add path
branchA=$(echo Branch A Changes |
git-commit-tree $(git-write-tree) -p $original)
show 'Branch A' $branchA
rm -rf path not-so-interestingecho "# Branch B"
git-read-tree $original
git-checkout-cache -f -a
mkdir path
date >path/file
git-update-cache --add path/file
branchB=$(echo Branch B Changes |
git-commit-tree $(git-write-tree) -p $original)
show 'Branch B' $branchB
rm -rf path not-so-interestingecho "# Attempt merge O A B" mb=$(git-merge-base $branchA $branchB) echo "Original $original" echo "Branch-A $branchA" echo "Branch-B $branchB" echo "MergeBase $mb"
git-read-tree -m $mb $branchA $branchB show "Merge" ------------ test.out ------------ # Original defaulting to local storage area Committing initial tree 682c2247823f37e4cf64f240009c9ba932b04fe0 # ls (Original) not-so-interesting # git-ls-files --stage (Original) 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 not-so-interesting # git-ls-tree -r (Original) 100644 blob 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 not-so-interesting # Branch A # ls (Branch A) not-so-interesting path # git-ls-files --stage (Branch A) 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 not-so-interesting 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 path # git-ls-tree -r (Branch A) 100644 blob 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 not-so-interesting 100644 blob 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 path # Branch B # ls (Branch B) not-so-interesting path/ # git-ls-files --stage (Branch B) 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 not-so-interesting 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 path/file # git-ls-tree -r (Branch B) 100644 blob 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 not-so-interesting 040000 tree f4e939c9b65aff9a59118f3f3f299ef30744adfa path 100644 blob 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 path/file # Attempt merge O A B Original 40c1d8a0e79df9e681667e0074664266b6bd9935 Branch-A 88b3e7e4ce0ba55c60fe4de6523968ecabb1cc78 Branch-B 0faa7f6b7f68ce2951fe3f26f937766ee53dc11c MergeBase 40c1d8a0e79df9e681667e0074664266b6bd9935 # ls (Merge) # git-ls-files --stage (Merge) 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 0 not-so-interesting 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 2 path 100644 9bcc8fabbbb587ba312a45b144dce8f4d9191da5 3 path/file