From: Gavin Beatty <gavinbeatty@gmail.com>
To: git@vger.kernel.org
Subject: Problem creating commits/trees with commit-tree/mktree
Date: Mon, 11 Jan 2010 19:14:46 +0100 [thread overview]
Message-ID: <f6d77fed1001111014g73a06923na05cd14d37968b04@mail.gmail.com> (raw)
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
next reply other threads:[~2010-01-11 18:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-11 18:14 Gavin Beatty [this message]
2010-01-11 18:17 ` Problem creating commits/trees with commit-tree/mktree Shawn O. Pearce
2010-01-11 18:38 ` Avery Pennarun
2010-01-14 23:18 ` Gavin Beatty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f6d77fed1001111014g73a06923na05cd14d37968b04@mail.gmail.com \
--to=gavinbeatty@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).