From: "Shawn O. Pearce" <spearce@spearce.org>
To: Don Zickus <dzickus@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: committing empty diffs
Date: Mon, 12 Feb 2007 15:10:57 -0500 [thread overview]
Message-ID: <20070212201057.GC30440@spearce.org> (raw)
In-Reply-To: <20070212200324.GB30440@spearce.org>
"Shawn O. Pearce" <spearce@spearce.org> wrote:
> Don Zickus <dzickus@gmail.com> wrote:
> > Considering git-commit doesn't allow this (probably for good reason),
> > is it technically safe to do the following sequence of events?
> >
> > tree=$(git-write-tree) #basically the same tree HEAD points to
> > commit=$(echo $IDEAS | git-commit-tree $tree -p HEAD)
> > git-update-ref HEAD $commit HEAD
This can also be written shorter, and safer:
head=$(git-rev-parse --verify HEAD^0)
commit=$(echo $IDEAS | git-commit-tree $head^{tree} -p $head)
git-update-ref HEAD $commit $head
The reason you do it like this is it prevents a HEAD which was
modified between the time you did git-commit-tree and git-update-ref
from being lost.
And the write-tree is completely unnecessary, and might actually
write out a dirty-index, which would make your ideas commit actually
modifying files - not what you wanted.
--
Shawn.
next prev parent reply other threads:[~2007-02-12 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-12 19:49 committing empty diffs Don Zickus
2007-02-12 20:03 ` Shawn O. Pearce
2007-02-12 20:10 ` Shawn O. Pearce [this message]
2007-02-12 20:19 ` Don Zickus
2007-02-12 20:10 ` Linus Torvalds
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=20070212201057.GC30440@spearce.org \
--to=spearce@spearce.org \
--cc=dzickus@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