On Fri, Feb 12, 2010 at 7:47 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Mark Lodato <lodatom@xxxxxxxxx> writes: > >> The basic steps are: >> >> backup .git/index >> git add -a >> git write-tree >> git commit-tree >> restore .git/index > > Instead of doing that, you might want to consider > > GIT_INDEX_FILE=...some-temporary-file... > export GIT_INDEX_FILE > > and run everything as if that is the index throughout your script. That > way, if your script ever failed in the middle, you won't have to worry > about a broken index file. In the actual script, I copied the index file back if any error occured. Still, your idea sounds better, so I just updated it to use this variable instead. I still remove the temporary file on error, but if something goes wrong, at least the index won't be hosed. On Sat, Feb 13, 2010 at 2:01 AM, Ron Garret <ron1@xxxxxxxxxxx> wrote: > Moving the index around seems kinda hacky. You probably want git-mktree. git-mktree is way too complicated. I would have to parse the index and call git-mktree for each directory. There is already a program to do this: git-write-tree :) Besides, using GIT_INDEX_FILE as suggested by Junio allows me to leave the original index file intact. -- Mark -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html