git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem creating commits/trees with commit-tree/mktree
@ 2010-01-11 18:14 Gavin Beatty
  2010-01-11 18:17 ` Shawn O. Pearce
  2010-01-11 18:38 ` Avery Pennarun
  0 siblings, 2 replies; 4+ messages in thread
From: Gavin Beatty @ 2010-01-11 18:14 UTC (permalink / raw)
  To: git

Hello,

I want to write commits to a branch without touching the index or
having a checkout (for a git subcommand I'm writing).

I can create new blobs and trees but can't figure out how to commit a
new tree/blob _with_ the old tree.

Currently, I do something a lot like:

objsha=$(echo 'contents' | git hash-object -w --stdin)
objtreesha=$(printf "100644 blob $objsha\tfile.txt\000" | git mktree -z)
newtreesha=$(printf "040000 tree $objtreesha\ttreefileisin\000" | git mktree -z)
echo 'commit msg' | git commit-tree $newtreesha -p $(git rev-parse
refs/heads/new)

I get a commit with treefileisin/file.txt. I haven't included the
other trees/files so they are gone in this commit. How do I include
them? Is commit-tree the wrong tool?

Is there some way to use git ls-tree that I don't know about?

Gavin

-- 
Gavin Beatty

SEMPER UBI SUB UBI

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-14 23:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 18:14 Problem creating commits/trees with commit-tree/mktree Gavin Beatty
2010-01-11 18:17 ` Shawn O. Pearce
2010-01-11 18:38 ` Avery Pennarun
2010-01-14 23:18   ` Gavin Beatty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).