aboutsummaryrefslogtreecommitdiff
path: root/builtin-name-rev.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-14 02:44:18 -0500
committerShawn O. Pearce <spearce@spearce.org>2007-01-14 02:44:18 -0500
commit1fcdd62adf81a172f45c7c6a58177212d500b9d9 (patch)
tree94acde078fd78c3d214fe09d45e85ed346a2f2d4 /builtin-name-rev.c
parent9938ffc53a15c755bbd3894c02492b940ea34c4c (diff)
parent696b1b507f8ff9e80a2edc4eced59ca8cdda920e (diff)
downloadgit-1fcdd62adf81a172f45c7c6a58177212d500b9d9.tar.gz
git-1fcdd62adf81a172f45c7c6a58177212d500b9d9.tar.xz
Merge branch 'master' into sp/fast-import
I'm bringing master in early so that the OBJ_OFS_DELTA implementation is available as part of the topic. This way git-fast-import can learn about this new slightly smaller and faster packfile format, and can generate them directly rather than needing to have them be repacked with git-pack-objects. Due to the API changes in master during the period of development of git-fast-import, a few minor tweaks to fast-import.c are needed to produce a working merge. I've done them here as part of the merge to ensure bisection always works. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'builtin-name-rev.c')
-rw-r--r--builtin-name-rev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/builtin-name-rev.c b/builtin-name-rev.c
index d44e782c9..b4f15cc38 100644
--- a/builtin-name-rev.c
+++ b/builtin-name-rev.c
@@ -1,4 +1,3 @@
-#include <stdlib.h>
#include "builtin.h"
#include "cache.h"
#include "commit.h"
@@ -75,11 +74,10 @@ copy_data:
}
}
-static int tags_only;
-
-static int name_ref(const char *path, const unsigned char *sha1)
+static int name_ref(const char *path, const unsigned char *sha1, int flags, void *cb_data)
{
struct object *o = parse_object(sha1);
+ int tags_only = *(int*)cb_data;
int deref = 0;
if (tags_only && strncmp(path, "refs/tags/", 10))
@@ -100,7 +98,7 @@ static int name_ref(const char *path, const unsigned char *sha1)
else if (!strncmp(path, "refs/", 5))
path = path + 5;
- name_rev(commit, strdup(path), 0, 0, deref);
+ name_rev(commit, xstrdup(path), 0, 0, deref);
}
return 0;
}
@@ -131,6 +129,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
{
struct object_array revs = { 0, 0, NULL };
int as_is = 0, all = 0, transform_stdin = 0;
+ int tags_only = 0;
git_config(git_default_config);
@@ -186,7 +185,7 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
add_object_array((struct object *)commit, *argv, &revs);
}
- for_each_ref(name_ref);
+ for_each_ref(name_ref, &tags_only);
if (transform_stdin) {
char buffer[2048];