@matheusbsbs / matheus-bagliano / commits / 0fe51391a8
Fork 0

Retire git-export.

git-export was done as a concept example on how easy it is to export the git data to something else. It's much less powerful than any number of trivial one-liner scripts now, and real exporters would not ever use git-export. It's obviously much less powerful than "git-whatchanged", or just about any combination of git-rev-list + git-diff-tree. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 16, 2005 at 22:21 UTC 0fe51391a80919870f94ddb442df234bb2223f3b
5 files changed +1 -117
.gitignore
-1
@@ -24,7 +24,6 @@ git-diff-helper
24 git-diff-index
25 git-diff-stages
26 git-diff-tree
27 -git-export
27 git-fetch
28 git-fetch-pack
29 git-format-patch
Documentation/git-export.txt deleted
-31
@@ -1,31 +0,0 @@
1 -git-export(1)
2 -=============
3 -v0.1, May 2005
4 -
5 -NAME
6 -----
7 -git-export - Exports each commit and a diff against each of its parents
8 -
9 -
10 -SYNOPSIS
11 ---------
12 -'git-export' top [base]
13 -
14 -DESCRIPTION
15 ------------
16 -Exports each commit and diff against each of its parents, between
17 -top and base. If base is not specified it exports everything.
18 -
19 -
20 -Author
21 -------
22 -Written by Linus Torvalds <torvalds@osdl.org>
23 -
24 -Documentation
25 ---------------
26 -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
27 -
28 -GIT
29 ----
30 -Part of the gitlink:git[7] suite
31 -
Documentation/git.txt
-3
@@ -118,9 +118,6 @@ gitlink:git-diff-stages[1]::
118 gitlink:git-diff-tree[1]::
119 Compares the content and mode of blobs found via two tree objects
120
121 -gitlink:git-export[1]::
122 - Exports each commit and a diff against each of its parents
123 -
121 gitlink:git-fsck-objects[1]::
122 Verifies the connectivity and validity of the objects in the database
123 Previously this command was known as git-fsck-cache.
Makefile
+1 -1
@@ -103,7 +103,7 @@ PROGRAMS = \
103 git-checkout-index git-clone-pack git-commit-tree \
104 git-convert-objects git-diff-files \
105 git-diff-helper git-diff-index git-diff-stages \
106 - git-diff-tree git-export git-fetch-pack git-fsck-objects \
106 + git-diff-tree git-fetch-pack git-fsck-objects \
107 git-hash-object git-init-db \
108 git-local-fetch git-ls-files git-ls-tree git-merge-base \
109 git-merge-index git-mktag git-pack-objects git-patch-id \
export.c deleted
-81
@@ -1,81 +0,0 @@
1 -#include "cache.h"
2 -#include "commit.h"
3 -
4 -/*
5 - * Show one commit
6 - */
7 -static void show_commit(struct commit *commit)
8 -{
9 - char cmdline[400];
10 - char hex[100];
11 -
12 - strcpy(hex, sha1_to_hex(commit->object.sha1));
13 - printf("Id: %s\n", hex);
14 - fflush(NULL);
15 - sprintf(cmdline, "git-cat-file commit %s", hex);
16 - system(cmdline);
17 - if (commit->parents) {
18 - char *against = sha1_to_hex(commit->parents->item->object.sha1);
19 - printf("\n\n======== diff against %s ========\n", against);
20 - fflush(NULL);
21 - sprintf(cmdline, "git-diff-tree -p %s %s", against, hex);
22 - system(cmdline);
23 - }
24 - printf("======== end ========\n\n");
25 -}
26 -
27 -/*
28 - * Show all unseen commits, depth-first
29 - */
30 -static void show_unseen(struct commit *top)
31 -{
32 - struct commit_list *parents;
33 -
34 - if (top->object.flags & 2)
35 - return;
36 - top->object.flags |= 2;
37 - parents = top->parents;
38 - while (parents) {
39 - show_unseen(parents->item);
40 - parents = parents->next;
41 - }
42 - show_commit(top);
43 -}
44 -
45 -static void export(struct commit *top, struct commit *base)
46 -{
47 - mark_reachable(&top->object, 1);
48 - if (base)
49 - mark_reachable(&base->object, 2);
50 - show_unseen(top);
51 -}
52 -
53 -static struct commit *get_commit(unsigned char *sha1)
54 -{
55 - struct commit *commit = lookup_commit(sha1);
56 - if (!commit->object.parsed) {
57 - struct commit_list *parents;
58 -
59 - if (parse_commit(commit) < 0)
60 - die("unable to parse commit %s", sha1_to_hex(sha1));
61 - parents = commit->parents;
62 - while (parents) {
63 - get_commit(parents->item->object.sha1);
64 - parents = parents->next;
65 - }
66 - }
67 - return commit;
68 -}
69 -
70 -int main(int argc, char **argv)
71 -{
72 - unsigned char base_sha1[20];
73 - unsigned char top_sha1[20];
74 -
75 - if (argc < 2 || argc > 4 ||
76 - get_sha1(argv[1], top_sha1) ||
77 - (argc == 3 && get_sha1(argv[2], base_sha1)))
78 - usage("git-export top [base]");
79 - export(get_commit(top_sha1), argc==3 ? get_commit(base_sha1) : NULL);
80 - return 0;
81 -}