* feature-request: git notes copy --to <ref>
@ 2014-02-20 21:03 Uwe Kleine-König
2014-03-17 10:11 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2014-02-20 21:03 UTC (permalink / raw)
To: git; +Cc: kernel, Johan Herland, Stephen Boyd, Jonathan Nieder,
Junio C Hamano
Hello,
I'm playing around with git-notes and want to share some of my notes
with my co-workers. We have a central repository for our various topic
branches and want to track upstream inclusion in git-notes. So we have
to share our notes branch somehow.
The workflow I think makes sense here is (untested):
### hack hack, add notes bla blub
### -> nice topic branch with some notes
git fetch serverrepo refs/notes/commits:refs/notes/servercommits
git notes merge refs/notes/servercommits
git rev-list origin/master.. | awk '{print $1 " " $1}' | git notes copy --to refs/notes/servercommits --stdin
git push serverrepo refs/notes/servercommits:refs/notes/commits
Then maybe:
git notes merge refs/notes/servercommits
again.
The idea here is to only include notes in refs/notes/servercommits that
are relevant for my coworkers and not all intermediate notes that were
created during development or while working on other branches.
Does this make sense? Do you have better ideas or suggestions how to
improve the workflow?
The only problem now is that git notes copy doesn't take a --to
parameter. Maybe there is a volunteer to implement it? Then I'd
volunteer to test it :-)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: feature-request: git notes copy --to <ref>
2014-02-20 21:03 feature-request: git notes copy --to <ref> Uwe Kleine-König
@ 2014-03-17 10:11 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2014-03-17 10:11 UTC (permalink / raw)
To: git; +Cc: kernel, Johan Herland, Stephen Boyd, Jonathan Nieder,
Junio C Hamano
Hello again,
On Thu, Feb 20, 2014 at 10:03:34PM +0100, Uwe Kleine-König wrote:
> I'm playing around with git-notes and want to share some of my notes
> with my co-workers. We have a central repository for our various topic
> branches and want to track upstream inclusion in git-notes. So we have
> to share our notes branch somehow.
>
> The workflow I think makes sense here is (untested):
>
> ### hack hack, add notes bla blub
> ### -> nice topic branch with some notes
>
> git fetch serverrepo refs/notes/commits:refs/notes/servercommits
> git notes merge refs/notes/servercommits
> git rev-list origin/master.. | awk '{print $1 " " $1}' | git notes copy --to refs/notes/servercommits --stdin
> git push serverrepo refs/notes/servercommits:refs/notes/commits
>
> Then maybe:
>
> git notes merge refs/notes/servercommits
>
> again.
>
> The idea here is to only include notes in refs/notes/servercommits that
> are relevant for my coworkers and not all intermediate notes that were
> created during development or while working on other branches.
>
> Does this make sense? Do you have better ideas or suggestions how to
> improve the workflow?
>
> The only problem now is that git notes copy doesn't take a --to
> parameter. Maybe there is a volunteer to implement it? Then I'd
> volunteer to test it :-)
I have implemented something now to copy notes to another branch. Here
is it for reference:
--->8---
#! /bin/sh
set -e
. git-sh-setup
# for now the remote notes rev must be a ref below refs/notes
# see id:20140220153045.GI6988@pengutronix.de for the respective plea.
remote_notes="refs/notes/servercommits"
local_notes="$(git notes get-ref)"
remote_notes_ref=$(git rev-parse --verify "$remote_notes^{commit}")
tmpfile=$(mktemp)
trap "rm \"$tmpfile\"" EXIT
git rev-list "$@" | sed 's/^/100644 blob [0-9a-f]{40}\t/' > $tmpfile
GIT_DIR=$(git rev-parse --git-dir)
GIT_INDEX_FILE="$GIT_DIR/index-rnotes" git read-tree "$remote_notes"
git ls-tree "$local_notes" | grep -E -f "$tmpfile" | GIT_INDEX_FILE="$GIT_DIR/index-rnotes" git update-index --index-info
tree=$(GIT_INDEX_FILE="$GIT_DIR/index-rnotes" git write-tree)
if test "x$tree" = "x$(git rev-parse "$remote_notes_ref^{tree}")"; then
echo "empty commit"
exit 0
fi
commit=$(git commit-tree "$tree" -p "$remote_notes_ref" << EOF
Notes added by 'git notes-copy'
source notes: $(git rev-parse $local_notes)
EOF
)
git update-ref "$remote_notes" $commit $remote_notes_ref
--->8---
It still has some edges, but I think it will do for me. Enhancements
welcome.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-17 10:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 21:03 feature-request: git notes copy --to <ref> Uwe Kleine-König
2014-03-17 10:11 ` Uwe Kleine-König
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).