[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jgit-dev] learned a lot with strace and native git
|
Hi,
while fixing jgit I was inspecting which files native git is touching
during checkout and merge. Besides the obvious opportunities to read
native git source code and debug (or ask Shawn :-)) I learned a lot
with the help of strace. Who really want's to know how git reads
objects, locks refs/indexes, updates working tree files should try the
following on linux in an empty directory. The two created *.strace
files list exactly how git deals with files in case of a non-trivial
checkout and merge:
------------------------------------------------------------------------------
#!/bin/sh
git init
echo orig > onlyMaster
echo orig > onlySide
echo -e '1\n2\n3' > bothMergeable
echo orig > bothConflicting
echo orig > nobody
sleep 1s
git add onlyMaster onlySide bothMergeable bothConflicting nobody
git commit -m initial
echo master > onlyMaster
echo -e '1master\n2\n3' > bothMergeable
echo master > bothConflicting
sleep 1s
git commit -a -m master
strace -e trace=desc,file -o checkout.strace git checkout -b side HEAD~
echo side > onlySide
echo -e '1\n2\n3side' > bothMergeable
echo side > bothConflicting
sleep 1s
git commit -a -m side
strace -e trace=desc,file -o merge.strace git merge master
------------------------------------------------------------------------------
Ciao
Chris