From: Johan Herland <johan@herland.net>
To: Stefan Naewe <stefan.naewe@atlas-elektronik.com>
Cc: git@vger.kernel.org
Subject: Re: Q. about usage of notes
Date: Tue, 31 Aug 2010 11:07:31 +0200 [thread overview]
Message-ID: <201008311107.32278.johan@herland.net> (raw)
In-Reply-To: <4C7CB8AF.5080008@atlas-elektronik.com>
On Tuesday 31 August 2010, Stefan Naewe wrote:
> Hi,
>
> I was playing around with 'git notes' these days (after reading S.Chacons
> post to this list and hist blog post at progit.org).
>
> Some things came to my mind when doing some 'git notes add' and
> 'git notes remove':
>
> How do I really get rid of git notes ? 'git notes remove' doesn't really
> remove the notes but creates a new commit (like 'git rm file ; git
> commit..' does).
Well, how do you "really" get rid of a file on a "regular" Git branch? The
answer is that Git doesn't let you do this without rewriting history (e.g.
using 'git filter-branch' to create a new history where that file never
existed). The same argument goes for notes: If you want to remove all traces
of notes for a given object, you must rewrite the notes history so that
those notes never existed.
At least that's how the 'git notes' porcelain behaves. At the plumbing
level, it's possible to create notes commits that don't point to the
preceding notes history (every notes commit is a root commit), and thus end
up with "history-less" notes. An example of this is the notes-cache code.
> And why does 'git remove' do that repetetively (is that even a word...?),
> i.e. 'git add -m"Note" ; git remove; git remove; git remove; git remove'
> creates 5 commit objects under 'refs/notes/commits' Is that the intended
> behaviour ?
(I assume your meant to put "notes" in all those commands: git notes add,
git notes remove, etc.)
Yes, this is the intended behaviour. Otherwise you would need a separate
notes index where you could stage notes changes (with git notes add/remove),
and then later commit those notes changes with (the imaginary) git notes
commit. This was deemed too cumbersome/complicated, and we settled for the
current approach instead.
If you want to make several adds/removes per notes commit, you could:
1. Use git-fast-import and its 'N' command (search the manual page for
"notemodify").
2. Check out the notes ref into your working tree ("git checkout
refs/notes/commits"). You can now edit notes directly, like you would edit
your "regular" files. (Ideally, you should have some knowledge about the
format of notes trees before you add/rename files). When you're done, you
stage and commit as you would do in your regular checkout.
> I'm a little bit puzzled....
Hope this helps, :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
next prev parent reply other threads:[~2010-08-31 9:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-31 8:09 Q. about usage of notes Stefan Naewe
2010-08-31 9:07 ` Johan Herland [this message]
2010-08-31 10:13 ` Stefan Naewe
2010-08-31 10:15 ` Stefan Naewe
2010-08-31 15:16 ` [RFC] notes: avoid recommitting identical trees Michael J Gruber
2010-08-31 16:01 ` Jeff King
2010-08-31 16:15 ` Michael J Gruber
2010-08-31 16:44 ` Junio C Hamano
2010-08-31 18:26 ` Michael J Gruber
2010-08-31 18:29 ` Jeff King
2010-08-31 18:45 ` Michael J Gruber
2010-08-31 18:43 ` Junio C Hamano
2010-08-31 16:08 ` Johan Herland
2010-08-31 15:53 ` Q. about usage of notes Johan Herland
2010-08-31 15:56 ` [PATCH 1/2] notes: Don't create (empty) commit when removing non-existing notes Johan Herland
2010-08-31 15:59 ` [PATCH 2/2] notes.h: Extend remove_note to return the SHA1 of the removed note, if any Johan Herland
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=201008311107.32278.johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.org \
--cc=stefan.naewe@atlas-elektronik.com \
/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).