Re: Problem creating commits/trees with commit-tree/mktree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gavin Beatty <gavinbeatty@xxxxxxxxx> wrote:
> 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)

You aren't feeding in the old tree contents as part of this command.

If you are really doing this via a script, you should look at
git-fast-import.  Its faster, and its language better supports
this notion of editing an existing tree.

-- 
Shawn.
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]