summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-19 21:37:10 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-19 21:37:10 -0800
commit8c0db2f5193153ea8a51bb45b0512c5a3889023b (patch)
tree43a43fc4b91a35a2654684e6f140e1920f2b66b6
parent21a02335f821c89a989cf0b533d2ae0adb6da16e (diff)
parentc649657501bada28794a30102d9c13cc28ca0e5e (diff)
downloadgit-8c0db2f5193153ea8a51bb45b0512c5a3889023b.tar.gz
Merge branch 'jc/rev-list' into next
* jc/rev-list: rev-list --objects-edge Merge branch 'jc/merge-msg' Merge branch 'jc/mv' Documentation: fix typo in rev-parse --short option description.
-rw-r--r--Documentation/git-rev-parse.txt2
-rw-r--r--rev-list.c34
-rw-r--r--rev-parse.c1
3 files changed, 30 insertions, 7 deletions
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 1662e06561..29b578978a 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -80,7 +80,7 @@ OPTIONS
--git-dir::
Show `$GIT_DIR` if defined else show the path to the .git directory.
---short, short=number::
+--short, --short=number::
Instead of outputting the full SHA1 values of object names try to
abbriviate them to a shorter unique name. When no length is specified
7 is used. The minimum length is 4.
diff --git a/rev-list.c b/rev-list.c
index f2d1105cae..373549e59e 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -30,7 +30,7 @@ static const char rev_list_usage[] =
" --date-order\n"
" formatting output:\n"
" --parents\n"
-" --objects\n"
+" --objects | --objects-edge\n"
" --unpacked\n"
" --header | --pretty\n"
" --abbrev=nr | --no-abbrev\n"
@@ -44,6 +44,7 @@ static int bisect_list = 0;
static int tag_objects = 0;
static int tree_objects = 0;
static int blob_objects = 0;
+static int edge_hint = 0;
static int verbose_header = 0;
static int abbrev = DEFAULT_ABBREV;
static int show_parents = 0;
@@ -430,16 +431,30 @@ static struct commit_list *find_bisection(struct commit_list *list)
return best;
}
+static void mark_edge_parents_uninteresting(struct commit *commit)
+{
+ struct commit_list *parents;
+
+ for (parents = commit->parents; parents; parents = parents->next) {
+ struct commit *parent = parents->item;
+ if (!(parent->object.flags & UNINTERESTING))
+ continue;
+ mark_tree_uninteresting(parent->tree);
+ if (edge_hint)
+ printf("-%s\n", sha1_to_hex(parent->object.sha1));
+ }
+}
+
static void mark_edges_uninteresting(struct commit_list *list)
{
for ( ; list; list = list->next) {
- struct commit_list *parents = list->item->parents;
+ struct commit *commit = list->item;
- for ( ; parents; parents = parents->next) {
- struct commit *commit = parents->item;
- if (commit->object.flags & UNINTERESTING)
- mark_tree_uninteresting(commit->tree);
+ if (commit->object.flags & UNINTERESTING) {
+ mark_tree_uninteresting(commit->tree);
+ continue;
}
+ mark_edge_parents_uninteresting(commit);
}
}
@@ -843,6 +858,13 @@ int main(int argc, const char **argv)
blob_objects = 1;
continue;
}
+ if (!strcmp(arg, "--objects-edge")) {
+ tag_objects = 1;
+ tree_objects = 1;
+ blob_objects = 1;
+ edge_hint = 1;
+ continue;
+ }
if (!strcmp(arg, "--unpacked")) {
unpacked = 1;
limited = 1;
diff --git a/rev-parse.c b/rev-parse.c
index a5fb93c3ca..610eacb35a 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -43,6 +43,7 @@ static int is_rev_argument(const char *arg)
"--min-age=",
"--no-merges",
"--objects",
+ "--objects-edge",
"--parents",
"--pretty",
"--show-breaks",