This causes git-fetch to auto-follow notes in the same fashion that tags
are auto-followed by default.
Pretty much all the code in this patch is about doing the same thing for
notes as what is already done for tags.
Signed-off-by: Johan Herland <johan@herland.net>
---
builtin-fetch--tool.c | 11 +++++++++++
git-fetch.sh | 27 +++++++++++++++++++++++++++
git-parse-remote.sh | 4 ++--
3 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index ed4d5de..71ddc6d 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -82,6 +82,8 @@ static int update_local_ref(const char *name,
/* new ref */
if (!strncmp(name, "refs/tags/", 10))
msg = "storing tag";
+ else if (!strncmp(name, "refs/notes/", 11))
+ msg = "storing note";
else
msg = "storing head";
fprintf(stderr, "* %s: storing %s\n",
@@ -103,6 +105,11 @@ static int update_local_ref(const char *name,
show_new(type, sha1_new);
return update_ref("updating tag", name, sha1_new, NULL);
}
+ else if (!strncmp(name, "refs/notes/", 11)) {
+ fprintf(stderr, "* %s: updating with %s\n", name, note);
+ show_new(type, sha1_new);
+ return update_ref("updating note", name, sha1_new, NULL);
+ }
current = lookup_commit_reference(sha1_old);
updated = lookup_commit_reference(sha1_new);
@@ -163,6 +170,10 @@ static int append_fetch_head(FILE *fp,
kind = "tag";
what = remote_name + 10;
}
+ else if (!strncmp(remote_name, "refs/notes/", 11)) {
+ kind = "note";
+ what = remote_name + 11;
+ }
else if (!strncmp(remote_name, "refs/remotes/", 13)) {
kind = "remote branch";
what = remote_name + 13;
diff --git a/git-fetch.sh b/git-fetch.sh
index 0e05cf1..a2a7874 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -353,6 +353,33 @@ case "$no_tags$tags" in
esac
esac
+# automated note following
+case "" in # --notes and --no-notes options?
+'')
+ case "$reflist" in
+ *:refs/*)
+ # effective only when we are following remote branch
+ # using local tracking branch.
+ notelist=$(IFS=' ' &&
+ echo "$ls_remote_result" |
+ git-show-ref --exclude-existing=refs/notes/ |
+ while read sha1 name
+ do
+ git-cat-file -t "$sha1" >/dev/null 2>&1 || continue
+ echo >&2 "Auto-following $name"
+ echo ".${name}:${name}"
+ done)
+ esac
+ case "$notelist" in
+ '') ;;
+ ?*)
+ # do not deepen a shallow tree when following notes
+ shallow_depth=
+ fetch_main "$notelist" || exit ;;
+ esac
+esac
+
+
# If the original head was empty (i.e. no "master" yet), or
# if we were told not to worry, we do not have to check.
case "$orig_head" in
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 0506b12..95dcc10 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -144,13 +144,13 @@ canon_refs_list_for_fetch () {
case "$remote" in
'' | HEAD ) remote=HEAD ;;
refs/*) ;;
- heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
+ heads/* | tags/* | notes/* | remotes/* ) remote="refs/$remote" ;;
*) remote="refs/heads/$remote" ;;
esac
case "$local" in
'') local= ;;
refs/*) ;;
- heads/* | tags/* | remotes/* ) local="refs/$local" ;;
+ heads/* | tags/* | notes/* | remotes/* ) local="refs/$local" ;;
*) local="refs/heads/$local" ;;
esac
--
1.5.2.101.gee49f
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| David Miller | Slow DOWN, please!!! |
| Florian Schmidt | blacklist kernel boot option |
| Ryan Hope | reiser4 for 2.6.27-rc1 |
| Nick Piggin | [rfc] x86: optimise page fault path a little |
git: | |
| Ken Pratt | pack operation is thrashing my server |
| Karl | Re: Git checkout preserve timestamp? |
| Greg KH | Re: [ANNOUNCE] pg - A patch porcelain for GIT |
| Johannes Schindelin | Re: [PATCH] RFC: git lazy clone proof-of-concept |
| Richard Stallman | Real men don't attack straw men |
| new_guy | Longest Uptime? |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Steve B | Intel Atom and D945GCLF2 |
| Sam Fourman Jr. | amd64 NVIDIA support in FreeBSD 7 |
| Peter Schuller | Re: When will ZFS become stable? |
| Justin Hibbits | Re: [ANNOUNCEMENT] Wiki for discussing P35/IHC9(R)/SATA issues set up |
| Kostik Belousov | Re: sbrk(2) broken |
| VPN's on NetBSD | 3 hours ago | NetBSD |
| Why does uClinux 2.6.18 bootup block SuperIO UART IRQs that BIOS configured | 4 hours ago | Linux kernel |
| USB statistics | 6 hours ago | Linux kernel |
| Block Sub System query | 10 hours ago | Linux kernel |
| kernel module to intercept socket creation | 11 hours ago | Linux kernel |
| Image size changing during each build | 11 hours ago | Linux kernel |
| Soft lock bug | 16 hours ago | Linux kernel |
| sysctl - dynamic registration problem | 22 hours ago | Linux kernel |
| Question on swap as ramdisk partition | 1 day ago | Linux kernel |
| serial driver xmit problem | 1 day ago | Linux kernel |
