Ok, the following is what I came up with based on your response. This is .git/hooks/update. It mostly works in my situation. See below for my discussion on what didn't work.
#!/bin/sh export PATH=/usr/local/bin:/usr/bin:/bin # cd to the root of the project directory (assume one dir up from GIT_DIR) cd $GIT_DIR/.. unset GIT_DIR if expr "$2" : '0*$' >/dev/null; then git-read-tree --reset $3 && git-checkout-cache -q -f -u -a else git-read-tree -m -u $2 $3 fi exit 0 # --- snip --- The thing that this doesn't do is remove empty directories when the last file is deleted. I once expressed the opinion in a previous thread that directories should be added and removed explicitly in git. (Thus allowing an empty directory to be added). If this were to happen then this case would get handled correctly. However, if git stays with the status quo then I think that git-read-tree -u should be changed to remove the empty directory. This would make it consistent. What do you think? Ideas? Carl On Tue, Aug 23, 2005 at 02:54:30PM -0700, Junio C Hamano wrote: > Daniel Barkalow <[EMAIL PROTECTED]> writes: > > >> > If you don't use -f, git-checkout-script removes deleted files. Using -f > >> > tells it to ignore the old index, which means that it can't tell the > >> > difference between removed files and files that weren't tracked at all. > > Yes and no. "git checkout" assumes that the index file and the > working tree somewhat resembles what is in .git/HEAD commit. > Since push operation updates .git/HEAD commit without touching > the index file, that assumption does not hold. > > The update hook gets old commit name and new commit name, so you > should be able to do (untested): > > git-read-tree -m -u $old_commit $new_commit > > there, of course after making sure that you had old_commit (the > first time push happens to a new ref you would not have that one). > -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Carl Baldwin Systems VLSI Laboratory Hewlett Packard Company MS 88 work: 970 898-1523 3404 E. Harmony Rd. work: [EMAIL PROTECTED] Fort Collins, CO 80525 home: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html