* Re: I want to release a "git-1.0"
From: Petr Baudis @ 2005-06-03 9:47 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Linus Torvalds, Eric W. Biederman, Git Mailing List
In-Reply-To: <Pine.LNX.4.21.0506011742560.30848-100000@iabervon.org>
Dear diary, on Thu, Jun 02, 2005 at 12:00:55AM CEST, I got a letter
where Daniel Barkalow <barkalow@iabervon.org> told me that...
> It shouldn't be hard to do one, except that locking with rsync is going to
> be a pain. I had a patch to make it work with the rpush/rpull pair, but I
> didn't get its dependancies in at the time.
Was that the patch I was replying to recently? It didn't seem to have
any dependencies.
> I can dust those patches off again if you want that functionality included.
>
> The patches are essentially:
>
> - make the transport protocol handle things other than objects
> - library procedure for locking atomic update of refs files
> - fetching refs in general
> - rpull/rpush that updates a specified ref file atomically
>
> At least the first would be very nice to get in before 1.0, since it is an
> incompatible change to the protocol.
I would like to have this a lot too. Pulling tags now is a PITA, and I
definitively want to go in this way. So it will land at least in git-pb.
:-) (But that's a little troublesome if you say it's incompatible
change.)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* [PATCH 4/4] diff: Update -B heuristics.
From: Junio C Hamano @ 2005-06-03 8:40 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vis0vq1rz.fsf_-_@assigned-by-dhcp.cox.net>
As Linus pointed out on the mailing list discussion, -B should
break a files that has many inserts even if it still keeps
enough of the original contents, so that the broken pieces can
later be matched with other files by -M or -C. However, if such
a broken pair does not get picked up by -M or -C, we would want
to apply different criteria; namely, regardless of the amount of
new material in the result, the determination of "rewrite"
should be done by looking at the amount of original material
still left in the result. If you still have the original 97
lines from a 100-line document, it does not matter if you add
your own 13 lines to make a 110-line document, or if you add 903
lines to make a 1000-line document. It is not a rewrite but an
in-place edit. On the other hand, if you did lose 97 lines from
the original, it does not matter if you added 27 lines to make a
30-line document or if you added 997 lines to make a 1000-line
document. You did a complete rewrite in either case.
This patch introduces a post-processing phase that runs after
diffcore-rename matches up broken pairs diffcore-break creates.
The purpose of this post-processing is to pick up these broken
pieces and merge them back into in-place modifications. For
this, the score parameter -B option takes is changed into a pair
of numbers, and it takes "-B99/80" format when fully spelled
out. The first number is the minimum amount of "edit" (same
definition as what diffcore-rename uses, which is "sum of
deletion and insertion") that a modification needs to have to be
broken, and the second number is the minimum amount of "delete"
a surviving broken pair must have to avoid being merged back
together. It can be abbreviated to "-B" to use default for
both, "-B9" or "-B9/" to use 90% for "edit" but default (80%)
for merge avoidance, or "-B/75" to use default (99%) "edit" and
75% for merge avoidance.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diffcore.h | 11 ++
diff.c | 18 ++++
diffcore-break.c | 240 +++++++++++++++++++++++++++++++++++++++++++++---------
3 files changed, 225 insertions(+), 44 deletions(-)
diff --git a/diffcore.h b/diffcore.h
--- a/diffcore.h
+++ b/diffcore.h
@@ -8,9 +8,19 @@
* (e.g. diffcore-rename, diffcore-pickaxe). Never include this header
* in anything else.
*/
+
+/* We internally use unsigned short as the score value,
+ * and rely on an int capable to hold 32-bits. -B can take
+ * -Bmerge_score/break_score format and the two scores are
+ * passed around in one int (high 16-bit for merge and low 16-bit
+ * for break).
+ */
#define MAX_SCORE 60000
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
#define DEFAULT_BREAK_SCORE 59400 /* minimum for break to happen (99%)*/
+#define DEFAULT_MERGE_SCORE 48000 /* maximum for break-merge to happen (80%)*/
+
+#define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */
struct diff_filespec {
unsigned char sha1[20];
@@ -76,6 +86,7 @@ extern void diff_q(struct diff_queue_str
extern void diffcore_pathspec(const char **pathspec);
extern void diffcore_break(int);
extern void diffcore_rename(int rename_copy, int);
+extern void diffcore_merge_broken(void);
extern void diffcore_pickaxe(const char *needle, int opts);
extern void diffcore_order(const char *orderfile);
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -614,7 +614,7 @@ static int parse_num(const char **cp_p)
int diff_scoreopt_parse(const char *opt)
{
- int opt1, cmd;
+ int opt1, opt2, cmd;
if (*opt++ != '-')
return -1;
@@ -623,9 +623,21 @@ int diff_scoreopt_parse(const char *opt)
return -1; /* that is not a -M, -C nor -B option */
opt1 = parse_num(&opt);
+ if (cmd != 'B')
+ opt2 = 0;
+ else {
+ if (*opt == 0)
+ opt2 = 0;
+ else if (*opt != '/')
+ return -1; /* we expect -B80/99 or -B80 */
+ else {
+ opt++;
+ opt2 = parse_num(&opt);
+ }
+ }
if (*opt != 0)
return -1;
- return opt1;
+ return opt1 | (opt2 << 16);
}
struct diff_queue_struct diff_queued_diff;
@@ -955,6 +967,8 @@ void diffcore_std(const char **paths,
diffcore_break(break_opt);
if (detect_rename)
diffcore_rename(detect_rename, rename_score);
+ if (0 <= break_opt)
+ diffcore_merge_broken();
if (pickaxe)
diffcore_pickaxe(pickaxe, pickaxe_opts);
if (orderfile)
diff --git a/diffcore-break.c b/diffcore-break.c
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -7,28 +7,58 @@
#include "delta.h"
#include "count-delta.h"
-static int very_different(struct diff_filespec *src,
- struct diff_filespec *dst,
- int min_score)
+static int should_break(struct diff_filespec *src,
+ struct diff_filespec *dst,
+ int break_score,
+ int *merge_score_p)
{
/* dst is recorded as a modification of src. Are they so
* different that we are better off recording this as a pair
- * of delete and create? min_score is the minimum amount of
- * new material that must exist in the dst and not in src for
- * the pair to be considered a complete rewrite, and recommended
- * to be set to a very high value, 99% or so.
- *
- * The value we return represents the amount of new material
- * that is in dst and not in src. We return 0 when we do not
- * want to get the filepair broken.
+ * of delete and create?
+ *
+ * There are two criteria used in this algorithm. For the
+ * purposes of helping later rename/copy, we take both delete
+ * and insert into account and estimate the amount of "edit".
+ * If the edit is very large, we break this pair so that
+ * rename/copy can pick the pieces up to match with other
+ * files.
+ *
+ * On the other hand, we would want to ignore inserts for the
+ * pure "complete rewrite" detection. As long as most of the
+ * existing contents were removed from the file, it is a
+ * complete rewrite, and if sizable chunk from the original
+ * still remains in the result, it is not a rewrite. It does
+ * not matter how much or how little new material is added to
+ * the file.
+ *
+ * The score we leave for such a broken filepair uses the
+ * latter definition so that later clean-up stage can find the
+ * pieces that should not have been broken according to the
+ * latter definition after rename/copy runs, and merge the
+ * broken pair that have a score lower than given criteria
+ * back together. The break operation itself happens
+ * according to the former definition.
+ *
+ * The minimum_edit parameter tells us when to break (the
+ * amount of "edit" required for us to consider breaking the
+ * pair). We leave the amount of deletion in *merge_score_p
+ * when we return.
+ *
+ * The value we return is 1 if we want the pair to be broken,
+ * or 0 if we do not.
*/
void *delta;
unsigned long delta_size, base_size, src_copied, literal_added;
+ int to_break = 0;
+
+ *merge_score_p = 0; /* assume no deletion --- "do not break"
+ * is the default.
+ */
if (!S_ISREG(src->mode) || !S_ISREG(dst->mode))
return 0; /* leave symlink rename alone */
- if (diff_populate_filespec(src, 1) || diff_populate_filespec(dst, 1))
+ if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
return 0; /* error but caught downstream */
delta_size = ((src->size < dst->size) ?
@@ -40,53 +70,95 @@ static int very_different(struct diff_fi
*/
base_size = ((src->size < dst->size) ? dst->size : src->size);
- /*
- * If file size difference is too big compared to the
- * base_size, we declare this a complete rewrite.
- */
- if (base_size * min_score < delta_size * MAX_SCORE)
- return MAX_SCORE;
-
- if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
- return 0; /* error but caught downstream */
-
delta = diff_delta(src->data, src->size,
dst->data, dst->size,
&delta_size);
- /* A delta that has a lot of literal additions would have
- * big delta_size no matter what else it does.
- */
- if (base_size * min_score < delta_size * MAX_SCORE)
- return MAX_SCORE;
-
/* Estimate the edit size by interpreting delta. */
- if (count_delta(delta, delta_size, &src_copied, &literal_added)) {
+ if (count_delta(delta, delta_size,
+ &src_copied, &literal_added)) {
free(delta);
- return 0;
+ return 0; /* we cannot tell */
}
free(delta);
- /* Extent of damage */
- if (src->size + literal_added < src_copied)
- delta_size = 0;
+ /* Compute merge-score, which is "how much is removed
+ * from the source material". The clean-up stage will
+ * merge the surviving pair together if the score is
+ * less than the minimum, after rename/copy runs.
+ */
+ if (src->size <= src_copied)
+ delta_size = 0; /* avoid wrapping around */
+ else
+ delta_size = src->size - src_copied;
+ *merge_score_p = delta_size * MAX_SCORE / src->size;
+
+ /* Extent of damage, which counts both inserts and
+ * deletes.
+ */
+ if (src->size + literal_added <= src_copied)
+ delta_size = 0; /* avoid wrapping around */
else
delta_size = (src->size - src_copied) + literal_added;
+
+ /* We break if the edit exceeds the minimum.
+ * i.e. (break_score / MAX_SCORE < delta_size / base_size)
+ */
+ if (break_score * base_size < delta_size * MAX_SCORE)
+ to_break = 1;
- if (base_size < delta_size)
- return MAX_SCORE;
-
- return delta_size * MAX_SCORE / base_size;
+ return to_break;
}
-void diffcore_break(int min_score)
+void diffcore_break(int break_score)
{
struct diff_queue_struct *q = &diff_queued_diff;
struct diff_queue_struct outq;
+
+ /* When the filepair has this much edit (insert and delete),
+ * it is first considered to be a rewrite and broken into a
+ * create and delete filepair. This is to help breaking a
+ * file that had too much new stuff added, possibly from
+ * moving contents from another file, so that rename/copy can
+ * match it with the other file.
+ *
+ * int break_score; we reuse incoming parameter for this.
+ */
+
+ /* After a pair is broken according to break_score and
+ * subjected to rename/copy, both of them may survive intact,
+ * due to lack of suitable rename/copy peer. Or, the caller
+ * may be calling us without using rename/copy. When that
+ * happens, we merge the broken pieces back into one
+ * modification together if the pair did not have more than
+ * this much delete. For this computation, we do not take
+ * insert into account at all. If you start from a 100-line
+ * file and delete 97 lines of it, it does not matter if you
+ * add 27 lines to it to make a new 30-line file or if you add
+ * 997 lines to it to make a 1000-line file. Either way what
+ * you did was a rewrite of 97%. On the other hand, if you
+ * delete 3 lines, keeping 97 lines intact, it does not matter
+ * if you add 3 lines to it to make a new 100-line file or if
+ * you add 903 lines to it to make a new 1000-line file.
+ * Either way you did a lot of additions and not a rewrite.
+ * This merge happens to catch the latter case. A merge_score
+ * of 80% would be a good default value (a broken pair that
+ * has score lower than merge_score will be merged back
+ * together).
+ */
+ int merge_score;
int i;
- if (!min_score)
- min_score = DEFAULT_BREAK_SCORE;
+ /* See comment on DEFAULT_BREAK_SCORE and
+ * DEFAULT_MERGE_SCORE in diffcore.h
+ */
+ merge_score = (break_score >> 16) & 0xFFFF;
+ break_score = (break_score & 0xFFFF);
+
+ if (!break_score)
+ break_score = DEFAULT_BREAK_SCORE;
+ if (!merge_score)
+ merge_score = DEFAULT_MERGE_SCORE;
outq.nr = outq.alloc = 0;
outq.queue = NULL;
@@ -101,12 +173,22 @@ void diffcore_break(int min_score)
if (DIFF_FILE_VALID(p->one) && DIFF_FILE_VALID(p->two) &&
!S_ISDIR(p->one->mode) && !S_ISDIR(p->two->mode) &&
!strcmp(p->one->path, p->two->path)) {
- score = very_different(p->one, p->two, min_score);
- if (min_score <= score) {
+ if (should_break(p->one, p->two,
+ break_score, &score)) {
/* Split this into delete and create */
struct diff_filespec *null_one, *null_two;
struct diff_filepair *dp;
+ /* Set score to 0 for the pair that
+ * needs to be merged back together
+ * should they survive rename/copy.
+ * Also we do not want to break very
+ * small files.
+ */
+ if ((score < merge_score) ||
+ (p->one->size < MINIMUM_BREAK_SIZE))
+ score = 0;
+
/* deletion of one */
null_one = alloc_filespec(p->one->path);
dp = diff_queue(&outq, p->one, null_one);
@@ -132,3 +214,77 @@ void diffcore_break(int min_score)
return;
}
+
+static void merge_broken(struct diff_filepair *p,
+ struct diff_filepair *pp,
+ struct diff_queue_struct *outq)
+{
+ /* p and pp are broken pairs we want to merge */
+ struct diff_filepair *c = p, *d = pp;
+ if (DIFF_FILE_VALID(p->one)) {
+ /* this must be a delete half */
+ d = p; c = pp;
+ }
+ /* Sanity check */
+ if (!DIFF_FILE_VALID(d->one))
+ die("internal error in merge #1");
+ if (DIFF_FILE_VALID(d->two))
+ die("internal error in merge #2");
+ if (DIFF_FILE_VALID(c->one))
+ die("internal error in merge #3");
+ if (!DIFF_FILE_VALID(c->two))
+ die("internal error in merge #4");
+
+ diff_queue(outq, d->one, c->two);
+ diff_free_filespec_data(d->two);
+ diff_free_filespec_data(c->one);
+ free(d);
+ free(c);
+}
+
+void diffcore_merge_broken(void)
+{
+ struct diff_queue_struct *q = &diff_queued_diff;
+ struct diff_queue_struct outq;
+ int i, j;
+
+ outq.nr = outq.alloc = 0;
+ outq.queue = NULL;
+
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ if (!p)
+ /* we already merged this with its peer */
+ continue;
+ else if (p->broken_pair &&
+ p->score == 0 &&
+ !strcmp(p->one->path, p->two->path)) {
+ /* If the peer also survived rename/copy, then
+ * we merge them back together.
+ */
+ for (j = i + 1; j < q->nr; j++) {
+ struct diff_filepair *pp = q->queue[j];
+ if (pp->broken_pair &&
+ p->score == 0 &&
+ !strcmp(pp->one->path, pp->two->path) &&
+ !strcmp(p->one->path, pp->two->path)) {
+ /* Peer survived. Merge them */
+ merge_broken(p, pp, &outq);
+ q->queue[j] = NULL;
+ break;
+ }
+ }
+ if (q->nr <= j)
+ /* The peer did not survive, so we keep
+ * it in the output.
+ */
+ diff_q(&outq, p);
+ }
+ else
+ diff_q(&outq, p);
+ }
+ free(q->queue);
+ *q = outq;
+
+ return;
+}
------------
^ permalink raw reply
* [PATCH 3/4] diff: Clean up diff_scoreopt_parse().
From: Junio C Hamano @ 2005-06-03 8:37 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vis0vq1rz.fsf_-_@assigned-by-dhcp.cox.net>
This cleans up diff_scoreopt_parse() function that is used to
parse the fractional notation -B, -C and -M option takes. The
callers are modified to check for errors and complain. Earlier
they silently ignored malformed input and falled back on the
default.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff-cache.c | 9 ++++++---
diff-files.c | 15 +++++++++++----
diff-tree.c | 9 ++++++---
diff.c | 39 +++++++++++++++++++++++++++++++++++++++
diffcore-rename.c | 18 ------------------
5 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/diff-cache.c b/diff-cache.c
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -191,17 +191,20 @@ int main(int argc, const char **argv)
continue;
}
if (!strncmp(arg, "-B", 2)) {
- diff_break_opt = diff_scoreopt_parse(arg);
+ if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_cache_usage);
continue;
}
if (!strncmp(arg, "-M", 2)) {
detect_rename = DIFF_DETECT_RENAME;
- diff_score_opt = diff_scoreopt_parse(arg);
+ if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_cache_usage);
continue;
}
if (!strncmp(arg, "-C", 2)) {
detect_rename = DIFF_DETECT_COPY;
- diff_score_opt = diff_scoreopt_parse(arg);
+ if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_cache_usage);
continue;
}
if (!strcmp(arg, "-z")) {
diff --git a/diff-files.c b/diff-files.c
--- a/diff-files.c
+++ b/diff-files.c
@@ -61,14 +61,21 @@ int main(int argc, const char **argv)
orderfile = argv[1] + 2;
else if (!strcmp(argv[1], "--pickaxe-all"))
pickaxe_opts = DIFF_PICKAXE_ALL;
- else if (!strncmp(argv[1], "-B", 2))
- diff_break_opt = diff_scoreopt_parse(argv[1]);
+ else if (!strncmp(argv[1], "-B", 2)) {
+ if ((diff_break_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
+ }
else if (!strncmp(argv[1], "-M", 2)) {
- diff_score_opt = diff_scoreopt_parse(argv[1]);
+ if ((diff_score_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
detect_rename = DIFF_DETECT_RENAME;
}
else if (!strncmp(argv[1], "-C", 2)) {
- diff_score_opt = diff_scoreopt_parse(argv[1]);
+ if ((diff_score_opt =
+ diff_scoreopt_parse(argv[1])) == -1)
+ usage(diff_files_usage);
detect_rename = DIFF_DETECT_COPY;
}
else
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -459,16 +459,19 @@ int main(int argc, const char **argv)
}
if (!strncmp(arg, "-M", 2)) {
detect_rename = DIFF_DETECT_RENAME;
- diff_score_opt = diff_scoreopt_parse(arg);
+ if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_tree_usage);
continue;
}
if (!strncmp(arg, "-C", 2)) {
detect_rename = DIFF_DETECT_COPY;
- diff_score_opt = diff_scoreopt_parse(arg);
+ if ((diff_score_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_tree_usage);
continue;
}
if (!strncmp(arg, "-B", 2)) {
- diff_break_opt = diff_scoreopt_parse(arg);
+ if ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)
+ usage(diff_tree_usage);
continue;
}
if (!strcmp(arg, "-z")) {
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -589,6 +589,45 @@ void diff_setup(int flags)
}
+static int parse_num(const char **cp_p)
+{
+ int num, scale, ch, cnt;
+ const char *cp = *cp_p;
+
+ cnt = num = 0;
+ scale = 1;
+ while ('0' <= (ch = *cp) && ch <= '9') {
+ if (cnt++ < 5) {
+ /* We simply ignore more than 5 digits precision. */
+ scale *= 10;
+ num = num * 10 + ch - '0';
+ }
+ *cp++;
+ }
+ *cp_p = cp;
+
+ /* user says num divided by scale and we say internally that
+ * is MAX_SCORE * num / scale.
+ */
+ return (MAX_SCORE * num / scale);
+}
+
+int diff_scoreopt_parse(const char *opt)
+{
+ int opt1, cmd;
+
+ if (*opt++ != '-')
+ return -1;
+ cmd = *opt++;
+ if (cmd != 'M' && cmd != 'C' && cmd != 'B')
+ return -1; /* that is not a -M, -C nor -B option */
+
+ opt1 = parse_num(&opt);
+ if (*opt != 0)
+ return -1;
+ return opt1;
+}
+
struct diff_queue_struct diff_queued_diff;
void diff_q(struct diff_queue_struct *queue, struct diff_filepair *dp)
diff --git a/diffcore-rename.c b/diffcore-rename.c
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -229,24 +229,6 @@ static int score_compare(const void *a_,
return b->score - a->score;
}
-int diff_scoreopt_parse(const char *opt)
-{
- int diglen, num, scale, i;
- if (opt[0] != '-' || (opt[1] != 'M' && opt[1] != 'C' && opt[1] != 'B'))
- return -1; /* that is not a -M, -C nor -B option */
- diglen = strspn(opt+2, "0123456789");
- if (diglen == 0 || strlen(opt+2) != diglen)
- return 0; /* use default */
- sscanf(opt+2, "%d", &num);
- for (i = 0, scale = 1; i < diglen; i++)
- scale *= 10;
-
- /* user says num divided by scale and we say internally that
- * is MAX_SCORE * num / scale.
- */
- return MAX_SCORE * num / scale;
-}
-
void diffcore_rename(int detect_rename, int minimum_score)
{
struct diff_queue_struct *q = &diff_queued_diff;
------------
^ permalink raw reply
* [PATCH 2/4] diff: Fix docs and add -O to diff-helper.
From: Junio C Hamano @ 2005-06-03 8:36 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vis0vq1rz.fsf_-_@assigned-by-dhcp.cox.net>
This patch updates diff documentation and usage strings:
- clarify the semantics of -R. It is not "output in reverse";
rather, it is "I will feed diff backwards". Semantically
they are different when -C is involved.
- describe -O in usage strings of diff-* brothers. It was
implemented, documented but not described in usage text.
Also it adds -O to diff-helper. Like -S (and unlike -M/-C/-B),
this option can work on sanitized diff-raw output produced by
the diff-* brothers. While we are at it, the call it makes to
diffcore is cleaned up to use the diffcore_std() like everybody
else, and the declaration for the low level diffcore routines
are moved from diff.h (public) to diffcore.h (private between
diff.c and diffcore backends).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
Documentation/git-diff-cache.txt | 3 ++-
Documentation/git-diff-files.txt | 3 ++-
Documentation/git-diff-helper.txt | 5 ++++-
Documentation/git-diff-tree.txt | 2 +-
diff.h | 10 +---------
diffcore.h | 6 ++++++
diff-cache.c | 2 +-
diff-files.c | 2 +-
diff-helper.c | 25 ++++++++++++++-----------
diff-tree.c | 2 +-
10 files changed, 33 insertions(+), 27 deletions(-)
diff --git a/Documentation/git-diff-cache.txt b/Documentation/git-diff-cache.txt
--- a/Documentation/git-diff-cache.txt
+++ b/Documentation/git-diff-cache.txt
@@ -57,7 +57,8 @@ OPTIONS
<orderfile>, which has one shell glob pattern per line.
-R::
- Output diff in reverse.
+ Swap two inputs; that is, show differences from cache or
+ on-disk file to tree contents.
--cached::
do not consider the on-disk file at all
diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt
--- a/Documentation/git-diff-files.txt
+++ b/Documentation/git-diff-files.txt
@@ -27,7 +27,8 @@ OPTIONS
Remain silent even on nonexisting files
-R::
- Output diff in reverse.
+ Swap two inputs; that is, show differences from on-disk files
+ to cache contents.
-B::
Break complete rewrite changes into pairs of delete and create.
diff --git a/Documentation/git-diff-helper.txt b/Documentation/git-diff-helper.txt
--- a/Documentation/git-diff-helper.txt
+++ b/Documentation/git-diff-helper.txt
@@ -9,7 +9,7 @@ git-diff-helper - Generates patch format
SYNOPSIS
--------
-'git-diff-helper' [-z] [-S<string>]
+'git-diff-helper' [-z] [-S<string>] [-O<orderfile>]
DESCRIPTION
-----------
@@ -24,6 +24,9 @@ OPTIONS
-S<string>::
Look for differences that contains the change in <string>.
+-O<orderfile>::
+ Output the patch in the order specified in the
+ <orderfile>, which has one shell glob pattern per line.
See Also
--------
diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -43,7 +43,7 @@ OPTIONS
Detect copies as well as renames.
-R::
- Output diff in reverse.
+ Swap two input trees.
-S<string>::
Look for differences that contains the change in <string>.
diff --git a/diff.h b/diff.h
--- a/diff.h
+++ b/diff.h
@@ -35,21 +35,13 @@ extern int diff_scoreopt_parse(const cha
#define DIFF_SETUP_REVERSE 1
#define DIFF_SETUP_USE_CACHE 2
#define DIFF_SETUP_USE_SIZE_CACHE 4
+
extern void diff_setup(int flags);
#define DIFF_DETECT_RENAME 1
#define DIFF_DETECT_COPY 2
-extern void diffcore_rename(int rename_copy, int minimum_score);
-
#define DIFF_PICKAXE_ALL 1
-extern void diffcore_pickaxe(const char *needle, int opts);
-
-extern void diffcore_pathspec(const char **pathspec);
-
-extern void diffcore_order(const char *orderfile);
-
-extern void diffcore_break(int max_score);
extern void diffcore_std(const char **paths,
int detect_rename, int rename_score,
diff --git a/diffcore.h b/diffcore.h
--- a/diffcore.h
+++ b/diffcore.h
@@ -73,6 +73,12 @@ extern struct diff_filepair *diff_queue(
struct diff_filespec *);
extern void diff_q(struct diff_queue_struct *, struct diff_filepair *);
+extern void diffcore_pathspec(const char **pathspec);
+extern void diffcore_break(int);
+extern void diffcore_rename(int rename_copy, int);
+extern void diffcore_pickaxe(const char *needle, int opts);
+extern void diffcore_order(const char *orderfile);
+
#define DIFF_DEBUG 0
#if DIFF_DEBUG
void diff_debug_filespec(struct diff_filespec *, int, const char *);
diff --git a/diff-cache.c b/diff-cache.c
--- a/diff-cache.c
+++ b/diff-cache.c
@@ -157,7 +157,7 @@ static void mark_merge_entries(void)
}
static char *diff_cache_usage =
-"git-diff-cache [-p] [-r] [-z] [-m] [-M] [-C] [-R] [-S<string>] [--cached] <tree-ish> [<path>...]";
+"git-diff-cache [-p] [-r] [-z] [-m] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [--cached] <tree-ish> [<path>...]";
int main(int argc, const char **argv)
{
diff --git a/diff-files.c b/diff-files.c
--- a/diff-files.c
+++ b/diff-files.c
@@ -7,7 +7,7 @@
#include "diff.h"
static const char *diff_files_usage =
-"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [-S<string>] [paths...]";
+"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [paths...]";
static int diff_output_format = DIFF_FORMAT_HUMAN;
static int detect_rename = 0;
diff --git a/diff-helper.c b/diff-helper.c
--- a/diff-helper.c
+++ b/diff-helper.c
@@ -7,11 +7,22 @@
static const char *pickaxe = NULL;
static int pickaxe_opts = 0;
+static const char *orderfile = NULL;
static int line_termination = '\n';
static int inter_name_termination = '\t';
+static void flush_them(int ac, const char **av)
+{
+ diffcore_std(av + 1,
+ 0, 0, /* no renames */
+ pickaxe, pickaxe_opts,
+ -1, /* no breaks */
+ orderfile);
+ diff_flush(DIFF_FORMAT_PATCH, 0);
+}
+
static const char *diff_helper_usage =
- "git-diff-helper [-z] [-S<string>] paths...";
+ "git-diff-helper [-z] [-S<string>] [-O<orderfile>] paths...";
int main(int ac, const char **av) {
struct strbuf sb;
@@ -131,17 +142,9 @@ int main(int ac, const char **av) {
new_path);
continue;
}
- if (1 < ac)
- diffcore_pathspec(av + 1);
- if (pickaxe)
- diffcore_pickaxe(pickaxe, pickaxe_opts);
- diff_flush(DIFF_FORMAT_PATCH, 0);
+ flush_them(ac, av);
printf(garbage_flush_format, sb.buf);
}
- if (1 < ac)
- diffcore_pathspec(av + 1);
- if (pickaxe)
- diffcore_pickaxe(pickaxe, pickaxe_opts);
- diff_flush(DIFF_FORMAT_PATCH, 0);
+ flush_them(ac, av);
return 0;
}
diff --git a/diff-tree.c b/diff-tree.c
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -397,7 +397,7 @@ static int diff_tree_stdin(char *line)
}
static char *diff_tree_usage =
-"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish>";
+"git-diff-tree [-p] [-r] [-z] [--stdin] [-M] [-C] [-R] [-S<string>] [-O<orderfile>] [-m] [-s] [-v] [-t] <tree-ish> <tree-ish>";
int main(int argc, const char **argv)
{
------------
^ permalink raw reply
* [PATCH 1/4] Tweak count-delta interface
From: Junio C Hamano @ 2005-06-03 8:36 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vis0vq1rz.fsf_-_@assigned-by-dhcp.cox.net>
Make it return copied source and insertion separately, so that
later implementation of heuristics can use them more flexibly.
This does not change the heuristics implemented in
diffcore-rename nor diffcore-break in any way.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
count-delta.h | 3 ++-
diffcore.h | 2 --
count-delta.c | 30 ++++++++++++++++--------------
diffcore-break.c | 15 +++++++++++----
diffcore-rename.c | 15 +++++++++++----
5 files changed, 40 insertions(+), 25 deletions(-)
diff --git a/count-delta.h b/count-delta.h
--- a/count-delta.h
+++ b/count-delta.h
@@ -4,6 +4,7 @@
#ifndef COUNT_DELTA_H
#define COUNT_DELTA_H
-unsigned long count_delta(void *, unsigned long);
+int count_delta(void *, unsigned long,
+ unsigned long *src_copied, unsigned long *literal_added);
#endif
diff --git a/diffcore.h b/diffcore.h
--- a/diffcore.h
+++ b/diffcore.h
@@ -12,8 +12,6 @@
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
#define DEFAULT_BREAK_SCORE 59400 /* minimum for break to happen (99%)*/
-#define RENAME_DST_MATCHED 01
-
struct diff_filespec {
unsigned char sha1[20];
char *path;
diff --git a/count-delta.c b/count-delta.c
--- a/count-delta.c
+++ b/count-delta.c
@@ -29,15 +29,18 @@ static unsigned long get_hdr_size(const
/*
* NOTE. We do not _interpret_ delta fully. As an approximation, we
* just count the number of bytes that are copied from the source, and
- * the number of literal data bytes that are inserted. Number of
- * bytes that are _not_ copied from the source is deletion, and number
- * of inserted literal bytes are addition, so sum of them is what we
- * return. xdelta can express an edit that copies data inside of the
- * destination which originally came from the source. We do not count
- * that in the following routine, so we are undercounting the source
- * material that remains in the final output that way.
+ * the number of literal data bytes that are inserted.
+ *
+ * Number of bytes that are _not_ copied from the source is deletion,
+ * and number of inserted literal bytes are addition, so sum of them
+ * is the extent of damage. xdelta can express an edit that copies
+ * data inside of the destination which originally came from the
+ * source. We do not count that in the following routine, so we are
+ * undercounting the source material that remains in the final output
+ * that way.
*/
-unsigned long count_delta(void *delta_buf, unsigned long delta_size)
+int count_delta(void *delta_buf, unsigned long delta_size,
+ unsigned long *src_copied, unsigned long *literal_added)
{
unsigned long copied_from_source, added_literal;
const unsigned char *data, *top;
@@ -46,7 +49,7 @@ unsigned long count_delta(void *delta_bu
/* the smallest delta size possible is 6 bytes */
if (delta_size < 6)
- return UINT_MAX;
+ return -1;
data = delta_buf;
top = delta_buf + delta_size;
@@ -83,13 +86,12 @@ unsigned long count_delta(void *delta_bu
/* sanity check */
if (data != top || out != dst_size)
- return UINT_MAX;
+ return -1;
/* delete size is what was _not_ copied from source.
* edit size is that and literal additions.
*/
- if (src_size + added_literal < copied_from_source)
- /* we ended up overcounting and underflowed */
- return 0;
- return (src_size - copied_from_source) + added_literal;
+ *src_copied = copied_from_source;
+ *literal_added = added_literal;
+ return 0;
}
diff --git a/diffcore-break.c b/diffcore-break.c
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -23,7 +23,7 @@ static int very_different(struct diff_fi
* want to get the filepair broken.
*/
void *delta;
- unsigned long delta_size, base_size;
+ unsigned long delta_size, base_size, src_copied, literal_added;
if (!S_ISREG(src->mode) || !S_ISREG(dst->mode))
return 0; /* leave symlink rename alone */
@@ -61,10 +61,17 @@ static int very_different(struct diff_fi
return MAX_SCORE;
/* Estimate the edit size by interpreting delta. */
- delta_size = count_delta(delta, delta_size);
+ if (count_delta(delta, delta_size, &src_copied, &literal_added)) {
+ free(delta);
+ return 0;
+ }
free(delta);
- if (delta_size == UINT_MAX)
- return 0; /* error in delta computation */
+
+ /* Extent of damage */
+ if (src->size + literal_added < src_copied)
+ delta_size = 0;
+ else
+ delta_size = (src->size - src_copied) + literal_added;
if (base_size < delta_size)
return MAX_SCORE;
diff --git a/diffcore-rename.c b/diffcore-rename.c
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -135,7 +135,7 @@ static int estimate_similarity(struct di
* call into this function in that case.
*/
void *delta;
- unsigned long delta_size, base_size;
+ unsigned long delta_size, base_size, src_copied, literal_added;
int score;
/* We deal only with regular files. Symlink renames are handled
@@ -174,10 +174,17 @@ static int estimate_similarity(struct di
return 0;
/* Estimate the edit size by interpreting delta. */
- delta_size = count_delta(delta, delta_size);
- free(delta);
- if (delta_size == UINT_MAX)
+ if (count_delta(delta, delta_size, &src_copied, &literal_added)) {
+ free(delta);
return 0;
+ }
+ free(delta);
+
+ /* Extent of damage */
+ if (src->size + literal_added < src_copied)
+ delta_size = 0;
+ else
+ delta_size = (src->size - src_copied) + literal_added;
/*
* Now we will give some score to it. 100% edit gets 0 points
------------
^ permalink raw reply
* [PATCH 0/4] Fix -B "very-different" logic.
From: Junio C Hamano @ 2005-06-03 8:32 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vis0wusv5.fsf@assigned-by-dhcp.cox.net>
I am sending the following four patch series:
[PATCH 1/4] Tweak count-delta interface
[PATCH 2/4] diff: Fix docs and add -O to diff-helper.
[PATCH 3/4] diff: Clean up diff_scoreopt_parse().
[PATCH 4/4] diff: Update -B heuristics.
The first three are preparations and cleanups I found necessary
while I was working on the last one, which is the gem of this
series. It addresses the concerns you raised in your message
"Careful." while keeping the semantics I wanted to have "if you
keep 97 lines out of original 100-line document, it does not
matter if the end result is a 110-line or 1000-line document.
You did not do a rewrite."
You may have to remove the warning about git-status with this
change, though.
^ permalink raw reply
* Re: Problem with cogito and Linux tree tags
From: Petr Baudis @ 2005-06-03 7:28 UTC (permalink / raw)
To: Radoslaw Szkodzinski; +Cc: Dan Holmsand, git
In-Reply-To: <429F92CA.9060908@gorzow.mm.pl>
Dear diary, on Fri, Jun 03, 2005 at 01:14:18AM CEST, I got a letter
where Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> told me that...
> Radoslaw Szkodzinski wrote:
>
> >Dan Holmsand wrote:
> >
> >
> >
> >>$ git-cat-file tag 06f6d9e2f140466eeb41e494e14167f90210f89d
> >>
> >>which tells you that v2.6.12-rc5 is commit
> >>2a24ab628aa7b190be32f63dfb6d96f3fb61580a
> >>
> >>
> >>
> >Ok. This doesn't work too. That cogito version really works fine, but I
> >had that branch cloned from a local repository gotten from rsync and
> >probably that's the problem.
> >The tags weren't propagated, but they should be.
> >
> >AstralStorm
> >
> >
> Well, new cogito-0.11.1 (300ab153620d2492e824cb3561c32debb5e80bf8) has
> this fixed and picked up missing objects automatically.
Oh yes, I wanted to mention it in this thread but forgot.
However note that what it does now is awful and it's just a
quick'n'dirty fix to make it mostly work. I guess a better way would be
to teach the pull tools to download refs/ files too and do the proper
dependency things from them too (in addition to the passed commit id).
I will need to go back and look again at the set of Daniel's patches
which implemented something like that.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* Re: documentation polish
From: Petr Baudis @ 2005-06-03 7:26 UTC (permalink / raw)
To: Sebastian Kuzminsky; +Cc: git
In-Reply-To: <E1De6Mp-0001AD-OQ@highlab.com>
Dear diary, on Fri, Jun 03, 2005 at 09:13:19AM CEST, I got a letter
where Sebastian Kuzminsky <seb@highlab.com> told me that...
> This large but repetitive patch polishes the docs a bit. It does not
> touch any files outside the Documentation directory.
>
>
> It's against cogito-0.11.1, I can split it out into separate patches
> for git and cogito if people want - let me know.
That'd be really great. :-)
Thanks,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* documentation polish
From: Sebastian Kuzminsky @ 2005-06-03 7:13 UTC (permalink / raw)
To: git
This large but repetitive patch polishes the docs a bit. It does not
touch any files outside the Documentation directory.
It's against cogito-0.11.1, I can split it out into separate patches
for git and cogito if people want - let me know.
Here's the change list:
Added a txt target to Documentation/Makefile, to explicitly make
cogito.txt and the cg-*.txt files.
Fixed what looked like a typo in Documentation/git-commit-tree.txt
Fixed an incorrect manpage section in Documentation/make-cg-asciidoc
The git and cogito manpages have links to other manpages, and
those links are often missing the section, (1) or (7). Fixed that
everywhere it seemed appropriate.
Makefile | 4 +
git-apply-patch-script.txt | 2
git-cat-file.txt | 2
git-check-files.txt | 4 -
git-checkout-cache.txt | 2
git-commit-tree.txt | 6 +-
git-convert-cache.txt | 2
git-diff-cache.txt | 2
git-diff-files.txt | 2
git-diff-helper.txt | 4 -
git-diff-tree.txt | 2
git-export.txt | 2
git-fsck-cache.txt | 2
git-http-pull.txt | 2
git-init-db.txt | 2
git-local-pull.txt | 2
git-ls-files.txt | 2
git-ls-tree.txt | 2
git-merge-base.txt | 2
git-merge-cache.txt | 2
git-merge-one-file-script.txt | 2
git-mkdelta.txt | 2
git-mktag.txt | 2
git-prune-script.txt | 2
git-pull-script.txt | 2
git-read-tree.txt | 4 -
git-resolve-script.txt | 2
git-rev-list.txt | 2
git-rev-tree.txt | 2
git-rpull.txt | 2
git-rpush.txt | 2
git-tag-script.txt | 2
git-tar-tree.txt | 2
git-unpack-file.txt | 2
git-update-cache.txt | 2
git-write-blob.txt | 2
git-write-tree.txt | 2
git.txt | 86 +++++++++++++++++++++---------------------
make-cg-asciidoc | 4 -
make-cogito-asciidoc | 19 ++++++---
40 files changed, 102 insertions(+), 93 deletions(-)
diff --git a/Documentation/Makefile b/Documentation/Makefile
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -18,7 +18,9 @@ DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT
# yourself - yes, all 6 characters of it!
#
-all: html man
+all: txt html man
+
+txt: $(MAN1_TXT) $(MAN7_TXT)
html: $(DOC_HTML)
diff --git a/Documentation/git-apply-patch-script.txt b/Documentation/git-apply-patch-script.txt
--- a/Documentation/git-apply-patch-script.txt
+++ b/Documentation/git-apply-patch-script.txt
@@ -28,5 +28,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-cat-file.txt b/Documentation/git-cat-file.txt
--- a/Documentation/git-cat-file.txt
+++ b/Documentation/git-cat-file.txt
@@ -51,5 +51,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-check-files.txt b/Documentation/git-check-files.txt
--- a/Documentation/git-check-files.txt
+++ b/Documentation/git-check-files.txt
@@ -33,7 +33,7 @@ up-to-date.
See Also
--------
-link:git-update-cache.html[git-update-cache]
+link:git-update-cache.html[git-update-cache(1)]
Author
@@ -46,5 +46,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-checkout-cache.txt b/Documentation/git-checkout-cache.txt
--- a/Documentation/git-checkout-cache.txt
+++ b/Documentation/git-checkout-cache.txt
@@ -102,5 +102,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-commit-tree.txt b/Documentation/git-commit-tree.txt
--- a/Documentation/git-commit-tree.txt
+++ b/Documentation/git-commit-tree.txt
@@ -9,7 +9,7 @@ git-commit-tree - Creates a new commit o
SYNOPSIS
--------
-'git-commit-tree' <tree> [-p <parent commit>]\ < changelog
+'git-commit-tree' <tree> [-p <parent commit>] < changelog
DESCRIPTION
-----------
@@ -71,7 +71,7 @@ You don't exist. Go away!::
See Also
--------
-link:git-write-tree.html[git-write-tree]
+link:git-write-tree.html[git-write-tree(1)]
Author
@@ -84,5 +84,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-convert-cache.txt b/Documentation/git-convert-cache.txt
--- a/Documentation/git-convert-cache.txt
+++ b/Documentation/git-convert-cache.txt
@@ -26,5 +26,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-diff-cache.txt b/Documentation/git-diff-cache.txt
--- a/Documentation/git-diff-cache.txt
+++ b/Documentation/git-diff-cache.txt
@@ -163,5 +163,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt
--- a/Documentation/git-diff-files.txt
+++ b/Documentation/git-diff-files.txt
@@ -71,5 +71,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-diff-helper.txt b/Documentation/git-diff-helper.txt
--- a/Documentation/git-diff-helper.txt
+++ b/Documentation/git-diff-helper.txt
@@ -27,7 +27,7 @@ OPTIONS
See Also
--------
-The section on generating patches in link:git-diff-cache.html[git-diff-cache]
+The section on generating patches in link:git-diff-cache.html[git-diff-cache(1)]
Author
@@ -41,5 +41,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt
--- a/Documentation/git-diff-tree.txt
+++ b/Documentation/git-diff-tree.txt
@@ -153,5 +153,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-export.txt b/Documentation/git-export.txt
--- a/Documentation/git-export.txt
+++ b/Documentation/git-export.txt
@@ -27,5 +27,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-fsck-cache.txt b/Documentation/git-fsck-cache.txt
--- a/Documentation/git-fsck-cache.txt
+++ b/Documentation/git-fsck-cache.txt
@@ -124,5 +124,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-http-pull.txt b/Documentation/git-http-pull.txt
--- a/Documentation/git-http-pull.txt
+++ b/Documentation/git-http-pull.txt
@@ -35,5 +35,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-init-db.txt b/Documentation/git-init-db.txt
--- a/Documentation/git-init-db.txt
+++ b/Documentation/git-init-db.txt
@@ -36,5 +36,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-local-pull.txt b/Documentation/git-local-pull.txt
--- a/Documentation/git-local-pull.txt
+++ b/Documentation/git-local-pull.txt
@@ -36,5 +36,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt
--- a/Documentation/git-ls-files.txt
+++ b/Documentation/git-ls-files.txt
@@ -104,5 +104,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
--- a/Documentation/git-ls-tree.txt
+++ b/Documentation/git-ls-tree.txt
@@ -51,5 +51,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-merge-base.txt b/Documentation/git-merge-base.txt
--- a/Documentation/git-merge-base.txt
+++ b/Documentation/git-merge-base.txt
@@ -30,5 +30,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-merge-cache.txt b/Documentation/git-merge-cache.txt
--- a/Documentation/git-merge-cache.txt
+++ b/Documentation/git-merge-cache.txt
@@ -80,5 +80,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-merge-one-file-script.txt b/Documentation/git-merge-one-file-script.txt
--- a/Documentation/git-merge-one-file-script.txt
+++ b/Documentation/git-merge-one-file-script.txt
@@ -26,5 +26,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-mkdelta.txt b/Documentation/git-mkdelta.txt
--- a/Documentation/git-mkdelta.txt
+++ b/Documentation/git-mkdelta.txt
@@ -41,5 +41,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-mktag.txt b/Documentation/git-mktag.txt
--- a/Documentation/git-mktag.txt
+++ b/Documentation/git-mktag.txt
@@ -44,5 +44,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-prune-script.txt b/Documentation/git-prune-script.txt
--- a/Documentation/git-prune-script.txt
+++ b/Documentation/git-prune-script.txt
@@ -28,5 +28,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-pull-script.txt b/Documentation/git-pull-script.txt
--- a/Documentation/git-pull-script.txt
+++ b/Documentation/git-pull-script.txt
@@ -27,5 +27,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-read-tree.txt b/Documentation/git-read-tree.txt
--- a/Documentation/git-read-tree.txt
+++ b/Documentation/git-read-tree.txt
@@ -135,7 +135,7 @@ and never used.
See Also
--------
-link:git-write-tree.html[git-write-tree]; link:git-ls-files.html[git-ls-files]
+link:git-write-tree.html[git-write-tree(1)]; link:git-ls-files.html[git-ls-files(1)]
Author
@@ -148,5 +148,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-resolve-script.txt b/Documentation/git-resolve-script.txt
--- a/Documentation/git-resolve-script.txt
+++ b/Documentation/git-resolve-script.txt
@@ -26,5 +26,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -28,5 +28,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-rev-tree.txt b/Documentation/git-rev-tree.txt
--- a/Documentation/git-rev-tree.txt
+++ b/Documentation/git-rev-tree.txt
@@ -84,5 +84,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-rpull.txt b/Documentation/git-rpull.txt
--- a/Documentation/git-rpull.txt
+++ b/Documentation/git-rpull.txt
@@ -39,5 +39,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-rpush.txt b/Documentation/git-rpush.txt
--- a/Documentation/git-rpush.txt
+++ b/Documentation/git-rpush.txt
@@ -26,5 +26,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-tag-script.txt b/Documentation/git-tag-script.txt
--- a/Documentation/git-tag-script.txt
+++ b/Documentation/git-tag-script.txt
@@ -28,5 +28,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-tar-tree.txt b/Documentation/git-tar-tree.txt
--- a/Documentation/git-tar-tree.txt
+++ b/Documentation/git-tar-tree.txt
@@ -28,5 +28,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-unpack-file.txt b/Documentation/git-unpack-file.txt
--- a/Documentation/git-unpack-file.txt
+++ b/Documentation/git-unpack-file.txt
@@ -33,5 +33,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-update-cache.txt b/Documentation/git-update-cache.txt
--- a/Documentation/git-update-cache.txt
+++ b/Documentation/git-update-cache.txt
@@ -104,5 +104,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-write-blob.txt b/Documentation/git-write-blob.txt
--- a/Documentation/git-write-blob.txt
+++ b/Documentation/git-write-blob.txt
@@ -29,5 +29,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git-write-tree.txt b/Documentation/git-write-tree.txt
--- a/Documentation/git-write-tree.txt
+++ b/Documentation/git-write-tree.txt
@@ -48,5 +48,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/git.txt b/Documentation/git.txt
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -18,8 +18,8 @@ This is reference information for the co
The Discussion section below contains much useful definition and
clarification info - read that first. And of the commands, I suggest
-reading link:git-update-cache.html[git-update-cache] and
-link:git-read-tree.html[git-read-tree] first - I wish I had!
+reading link:git-update-cache.html[git-update-cache(1)] and
+link:git-read-tree.html[git-read-tree(1)] first - I wish I had!
David Greaves <david@dgreaves.com>
08/05/05
@@ -39,78 +39,78 @@ SCMs layered over git.
Manipulation commands
~~~~~~~~~~~~~~~~~~~~~
-link:git-checkout-cache.html[git-checkout-cache]::
+link:git-checkout-cache.html[git-checkout-cache(1)]::
Copy files from the cache to the working directory
-link:git-commit-tree.html[git-commit-tree]::
+link:git-commit-tree.html[git-commit-tree(1)]::
Creates a new commit object
-link:git-init-db.html[git-init-db]::
+link:git-init-db.html[git-init-db(1)]::
Creates an empty git object database
-link:git-merge-base.html[git-merge-base]::
+link:git-merge-base.html[git-merge-base(1)]::
Finds as good a common ancestor as possible for a merge
-link:git-mkdelta.html[git-mkdelta]::
+link:git-mkdelta.html[git-mkdelta(1)]::
Creates a delta object
-link:git-mktag.html[git-mktag]::
+link:git-mktag.html[git-mktag(1)]::
Creates a tag object
-link:git-read-tree.html[git-read-tree]::
+link:git-read-tree.html[git-read-tree(1)]::
Reads tree information into the directory cache
-link:git-update-cache.html[git-update-cache]::
+link:git-update-cache.html[git-update-cache(1)]::
Modifies the index or directory cache
-link:git-write-blob.html[git-write-blob]::
+link:git-write-blob.html[git-write-blob(1)]::
Creates a blob from a file
-link:git-write-tree.html[git-write-tree]::
+link:git-write-tree.html[git-write-tree(1)]::
Creates a tree from the current cache
Interrogation commands
~~~~~~~~~~~~~~~~~~~~~~
-link:git-cat-file.html[git-cat-file]::
+link:git-cat-file.html[git-cat-file(1)]::
Provide content or type information for repository objects
-link:git-check-files.html[git-check-files]::
+link:git-check-files.html[git-check-files(1)]::
Verify a list of files are up-to-date
-link:git-diff-cache.html[git-diff-cache]::
+link:git-diff-cache.html[git-diff-cache(1)]::
Compares content and mode of blobs between the cache and repository
-link:git-diff-files.html[git-diff-files]::
+link:git-diff-files.html[git-diff-files(1)]::
Compares files in the working tree and the cache
-link:git-diff-tree.html[git-diff-tree]::
+link:git-diff-tree.html[git-diff-tree(1)]::
Compares the content and mode of blobs found via two tree objects
-link:git-export.html[git-export]::
+link:git-export.html[git-export(1)]::
Exports each commit and a diff against each of its parents
-link:git-fsck-cache.html[git-fsck-cache]::
+link:git-fsck-cache.html[git-fsck-cache(1)]::
Verifies the connectivity and validity of the objects in the database
-link:git-ls-files.html[git-ls-files]::
+link:git-ls-files.html[git-ls-files(1)]::
Information about files in the cache/working directory
-link:git-ls-tree.html[git-ls-tree]::
+link:git-ls-tree.html[git-ls-tree(1)]::
Displays a tree object in human readable form
-link:git-merge-cache.html[git-merge-cache]::
+link:git-merge-cache.html[git-merge-cache(1)]::
Runs a merge for files needing merging
-link:git-rev-list.html[git-rev-list]::
+link:git-rev-list.html[git-rev-list(1)]::
Lists commit objects in reverse chronological order
-link:git-rev-tree.html[git-rev-tree]::
+link:git-rev-tree.html[git-rev-tree(1)]::
Provides the revision tree for one or more commits
-link:git-tar-tree.html[git-tar-tree]::
+link:git-tar-tree.html[git-tar-tree(1)]::
Creates a tar archive of the files in the named tree
-link:git-unpack-file.html[git-unpack-file]::
+link:git-unpack-file.html[git-unpack-file(1)]::
Creates a temporary file with a blob's contents
The interrogate commands may create files - and you can force them to
@@ -121,42 +121,42 @@ Ancilliary Commands
-------------------
Manipulators:
-link:git-apply-patch-script.html[git-apply-patch-script]::
+link:git-apply-patch-script.html[git-apply-patch-script(1)]::
Sample script to apply the diffs from git-diff-*
-link:git-convert-cache.html[git-convert-cache]::
+link:git-convert-cache.html[git-convert-cache(1)]::
Converts old-style GIT repository
-link:git-http-pull.html[git-http-pull]::
+link:git-http-pull.html[git-http-pull(1)]::
Downloads a remote GIT repository via HTTP
-link:git-local-pull.html[git-local-pull]::
+link:git-local-pull.html[git-local-pull(1)]::
Duplicates another GIT repository on a local system
-link:git-merge-one-file-script.html[git-merge-one-file-script]::
+link:git-merge-one-file-script.html[git-merge-one-file-script(1)]::
The standard helper program to use with "git-merge-cache"
-link:git-pull-script.html[git-pull-script]::
+link:git-pull-script.html[git-pull-script(1)]::
Script used by Linus to pull and merge a remote repository
-link:git-prune-script.html[git-prune-script]::
+link:git-prune-script.html[git-prune-script(1)]::
Prunes all unreachable objects from the object database
-link:git-resolve-script.html[git-resolve-script]::
+link:git-resolve-script.html[git-resolve-script(1)]::
Script used to merge two trees
-link:git-tag-script.html[git-tag-script]::
+link:git-tag-script.html[git-tag-script(1)]::
An example script to create a tag object signed with GPG
-link:git-rpull.html[git-rpull]::
+link:git-rpull.html[git-rpull(1)]::
Pulls from a remote repository over ssh connection
Interogators:
-link:git-diff-helper.html[git-diff-helper]::
+link:git-diff-helper.html[git-diff-helper(1)]::
Generates patch format output for git-diff-*
-link:git-rpush.html[git-rpush]::
+link:git-rpush.html[git-rpush(1)]::
Helper "server-side" program used by git-rpull
@@ -279,16 +279,16 @@ git Commits
'GIT_AUTHOR_DATE'::
'GIT_COMMITTER_NAME'::
'GIT_COMMITTER_EMAIL'::
- see link:git-commit-tree.html[git-commit-tree]
+ see link:git-commit-tree.html[git-commit-tree(1)]
git Diffs
~~~~~~~~~
'GIT_DIFF_OPTS'::
'GIT_EXTERNAL_DIFF'::
see the "generating patches" section in :
- link:git-diff-cache.html[git-diff-cache];
- link:git-diff-files.html[git-diff-files];
- link:git-diff-tree.html[git-diff-tree]
+ link:git-diff-cache.html[git-diff-cache(1)];
+ link:git-diff-files.html[git-diff-files(1)];
+ link:git-diff-tree.html[git-diff-tree(1)]
Discussion
----------
@@ -304,5 +304,5 @@ Documentation by David Greaves, Junio C
GIT
---
-Part of the link:git.html[git] suite
+Part of the link:git.html[git(7)] suite
diff --git a/Documentation/make-cg-asciidoc b/Documentation/make-cg-asciidoc
--- a/Documentation/make-cg-asciidoc
+++ b/Documentation/make-cg-asciidoc
@@ -40,7 +40,7 @@ CAPTION=$(echo "$HEADER" | head -n 1 | t
# were referenced as "`cg-command`". This way references from cg-* combos in
# code listings will be ignored.
BODY=$(echo "$HEADER" | sed '0,/^$/d' \
- | sed 's/`\(cg-[a-z-]\+\)`/link:\1.html[\1]/')
+ | sed 's/`\(cg-[a-z-]\+\)`/link:\1.html[\1(1)]/')
DESCRIPTION=
OPTIONS=
@@ -109,5 +109,5 @@ $COPYRIGHT
SEE ALSO
--------
$COMMAND command is part of link:cogito.html[cogito(7)],
-a toolkit for managing link:git.html[git(1)] trees.
+a toolkit for managing link:git.html[git(7)] trees.
__END__
diff --git a/Documentation/make-cogito-asciidoc b/Documentation/make-cogito-asciidoc
--- a/Documentation/make-cogito-asciidoc
+++ b/Documentation/make-cogito-asciidoc
@@ -11,7 +11,14 @@ HELPER_COMMANDS="$(ls ../cg-X*) $(ls ../
link()
{
command="$1"
- echo "link:$command.html['$command']"
+
+ if [ ! -z "$2" ]; then
+ section="($2)"
+ else
+ section=""
+ fi
+
+ echo "link:$command.html['$command$section']"
}
# Print description list entry.
@@ -62,7 +69,7 @@ storage system. Amongst some of the note
for branching, tagging and multiple backends for distributing repositories
(local files, rsync, HTTP, ssh).
-'Cogito' is implemented as a series of 'bash(1)' scripts on top of $(link git)
+'Cogito' is implemented as a series of 'bash(1)' scripts on top of $(link git 7)
(a content-tracking filesystem) with the goal of providing an interface for
working with the 'GIT' database in a manner similar to other SCM tools (like
'CVS', 'BitKeeper' or 'Monotone').
@@ -107,21 +114,21 @@ $(print_command_listing $HELPER_COMMANDS
Command Identifiers
-------------------
BRANCH_NAME::
- Indicates a branch name added with the $(link cg-branch-add) command.
+ Indicates a branch name added with the $(link cg-branch-add 1) command.
COMMAND::
Indicates a 'Cogito' command. The \`cg-\` prefix is optional.
LOCATION::
- Indicates a local file path or a URI. See $(link cg-branch-add) for a
+ Indicates a local file path or a URI. See $(link cg-branch-add 1) for a
list of supported URI schemes.
COMMIT_ID, FROM_ID, TO_ID, BASE_COMMIT::
Indicates an ID resolving to a commit. The following expressions can
be used interchangably as IDs:
- empty string, 'this' or 'HEAD' (current HEAD)
- - branch name (as registered with $(link cg-branch-add))
- - tag name (as registered with $(link cg-tag))
+ - branch name (as registered with $(link cg-branch-add 1))
+ - tag name (as registered with $(link cg-tag 1))
- shortcut object hash (shorted unambiguous hash lead)
- commit object hash (as returned by 'commit-id')
- tree object hash (as returned by 'tree-id')
--
Sebastian Kuzminsky
^ permalink raw reply
* Re: [PATCH] git-tar-tree: add a test case (resent)
From: Rene Scharfe @ 2005-06-03 5:34 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0506021830340.1876@ppc970.osdl.org>
Linus Torvalds schrieb:
>
> On Thu, 2 Jun 2005, Rene Scharfe wrote:
>
>>git-tar-tree: add a simple test case.
>
>
> I get:
>
> * FAIL 6: extract tar archive (cd b && tar xf -) <b.tar
> * FAIL 7: validate filenames (cd b/a && find .) | sort >b.lst &&
> * FAIL 8: validate file contents diff -r a b/a
> * FAIL 11: validate filenames with prefix (cd c/prefix/a && find .) | sort >c.lst &&
> * FAIL 12: validate file contents with prefix diff -r a c/prefix/a
What version of tar do you use? Also, can you please send me the output
the following?
cd t; sh t5000-tar-tree.sh; cd trash; tar tvf b.tar
Thanks,
Rene
^ permalink raw reply
* Re: qgit-0.3
From: Benjamin Herrenschmidt @ 2005-06-03 3:55 UTC (permalink / raw)
To: Marco Costalba; +Cc: git, berkus
In-Reply-To: <20050601111949.90043.qmail@web26303.mail.ukl.yahoo.com>
On Wed, 2005-06-01 at 13:19 +0200, Marco Costalba wrote:
> New version of qgit, the QT/C++ git viewer.
>
> Download at:
>
> http://prdownloads.sourceforge.net/qgit/qgit-0.3.tar.gz?download
>
> This time we use scons instead of qmake as build system (many thanks to Stanislav Karchebny), I
> hope people have less problems compiling it.
>
> As before just run make and copy the bin in the path.
>
> New feature is async loading of diff and file blobs, should be much faster navigate the logs with
> secondary windows (double click on logs or file names to show) opened.
I spent 1/2h and never managed to build it. When it doesn't find some
includes, it doesn't look for some Qt related binaries in the right
path, or whatever, it's just basically unbuildable.
Ben.
^ permalink raw reply
* Re: I want to release a "git-1.0"
From: Adam Kropelin @ 2005-06-03 1:34 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0506021745310.1876@ppc970.osdl.org>
Linus Torvalds wrote:
> On Thu, 2 Jun 2005, Linus Torvalds wrote:
>>
>> Yeah, I'll try to clarify.
>
> Adam, do you find the current version a bit more clear on this?
Absolutely. I especially like the new digression explaining that
the --cached flag controls where file _content_ is fetched from and
reinforcing that the index file always governs which files are involved
in the diff.
Thanks!
--Adam
^ permalink raw reply
* Re: [PATCH] Fix -B "very-different" logic.
From: Junio C Hamano @ 2005-06-03 1:33 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0506021716140.1876@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> Careful.
LT> I think the amount of new code _should_ matter. Otherwise, an old empty
LT> file would always be considered the source of a new file, since the diff
LT> doesn't remove anything. Similarly, just because we have a boilerplate
LT> file shouldn't make that always be considered a "wonderful source", when
LT> people add the real meat to it.
Yes, I agree that rename/copy logic should use different
heuristics from the one I proposed for breaking.
It is my assumption that people in practice tend to make only
small edits after a rename/copy just to adjust things like:
- filenames mentioned in the comment of the file itself,
- include paths that refer other files if the file was
moved/copied from a different directory,
- names of functions and variables.
and making sure there would not be too much new stuff is quite
useful to detect rename/copy source correctly as the current
similarity estimator in diffcore-rename does. I do not intend
to touch that.
The boilderplate example you mention is a very good reason not
to dismiss the amount of new material when doing rename/copy
detection.
LT> In particular, let's say that I used to have two files:
LT> a.c - small helper functions
LT> b.c - the "meat" of the thing
LT> and I end up deciding that I might as well collapse it all into one file,
LT> a.c. What happens? There's almost no deletes from a.c, but there's a lot
LT> of new code in it.
LT> See what I'm saying?
Yes. I think I do.
When git-diff-tree -B -C runs your example, it feeds diffcore
with these:
:100644 100644 sha1-a-helper-only sha1-a-and-meat M a.c
:100644 000000 sha1-b-stale-meat 0{40} D b.c
The ideal diffcore-break breaks a.c because it looks at
insertions as well:
:100644 000000 sha1-a-helper-only 0{40} D a.c
:000000 100644 0{40} sha1-a-and-meat N a.c
:100644 000000 sha1-b-stale-meat 0{40} D b.c
Then diffcore-rename notices that sha1-b-stale-meat is better
match than sha1-a-helper-only to produce sha1-a-and-meat, and
resolves the above to:
:100644 100644 sha1-b-stale-meat sha1-a-and-meat R b.c a.c
Up to this point is just a demonstration that I see your point.
But I still want to keep the example I gave in the original
commit message. Suppose you did not have b.c file under version
control, and did the same operation. I.e. a.c acquired a lot of
good stuff. git-diff-tree -B -C feeds:
:100644 100644 sha1-a-helper-only sha1-a-and-meat M a.c
which is broken into:
:100644 000000 sha1-a-helper-only 0{40} D a.c
:000000 100644 0{40} sha1-a-and-meat N a.c
Unfortunately, in this case nobody absorbs these pairs. I want
to allow you to add 1000 lines of new stuff to a file (which was
originally 100 lines long) as long as you do not remove too many
lines from the original 100 lines without triggering "this is a
rewrite" logic in this case. So after rename/copy runs, we need
to match these up and merge them back into the original.
:100644 100644 sha1-a-helper-only sha1-a-and-meat M a.c
We should carry a bit more information about broken entries than
we currently do. We would break a pair based on both deletion
and insertion, just like the current code (i.e. without the
patch you are responding to) does. But when we do break a pair,
we need to mark them if the "new" side have enough original
source material remaining. If we have such mark to tell us that
"these were broken but there are a good chunk of source material
remaining", the clean-up phase, to run after diffcore-rename
finishes, should be able to notice surviving broken pairs and
merge them back accordingly.
^ permalink raw reply
* Re: [PATCH] git-tar-tree: add a test case (resent)
From: Linus Torvalds @ 2005-06-03 1:34 UTC (permalink / raw)
To: Rene Scharfe; +Cc: git
In-Reply-To: <20050602185046.GA3717@lsrfire.ath.cx>
On Thu, 2 Jun 2005, Rene Scharfe wrote:
>
> git-tar-tree: add a simple test case.
I get:
* FAIL 6: extract tar archive (cd b && tar xf -) <b.tar
* FAIL 7: validate filenames (cd b/a && find .) | sort >b.lst &&
* FAIL 8: validate file contents diff -r a b/a
* FAIL 11: validate filenames with prefix (cd c/prefix/a && find .) | sort >c.lst &&
* FAIL 12: validate file contents with prefix diff -r a c/prefix/a
Hmm?
Linus
^ permalink raw reply
* Re: I want to release a "git-1.0"
From: Linus Torvalds @ 2005-06-03 0:47 UTC (permalink / raw)
To: Adam Kropelin; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0506021705520.1876@ppc970.osdl.org>
On Thu, 2 Jun 2005, Linus Torvalds wrote:
>
> Yeah, I'll try to clarify.
Adam, do you find the current version a bit more clear on this?
Linus
^ permalink raw reply
* Re: [PATCH] Fix -B "very-different" logic.
From: Linus Torvalds @ 2005-06-03 0:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vll5sz54z.fsf_-_@assigned-by-dhcp.cox.net>
On Thu, 2 Jun 2005, Junio C Hamano wrote:
>
> However I think the diffcore-break algorithm itself was basing
> its "very_different" computation on numbers somewhat bogus. It
> was counting newly inserted bytes into account, but amount of
> those bytes should not make any difference when determining if
> the change is a complete rewrite.
Careful.
I think the amount of new code _should_ matter. Otherwise, an old empty
file would always be considered the source of a new file, since the diff
doesn't remove anything. Similarly, just because we have a boilerplate
file shouldn't make that always be considered a "wonderful source", when
people add the real meat to it.
So I think you're on the right track, but I don't think you should
entirely dismiss "lots of stuff added" as a reason for a "break". I think
that if the new stuff is _much_ larger than the old stuff, it might as
well be considered a rewrite.
In particular, let's say that I used to have two files:
a.c - small helper functions
b.c - the "meat" of the thing
and I end up deciding that I might as well collapse it all into one file,
a.c. What happens? There's almost no deletes from a.c, but there's a lot
of new code in it.
Wouldn't it be _better_ if you considered the new "a.c" a new file, so
that you might notice that it's actually _closer_ to the old removed "b.c"
than the old "a.c"?
See what I'm saying?
Linus
^ permalink raw reply
* Re: I want to release a "git-1.0"
From: Linus Torvalds @ 2005-06-03 0:06 UTC (permalink / raw)
To: Adam Kropelin; +Cc: Git Mailing List
In-Reply-To: <00e101c567cc$80c0de80$03c8a8c0@kroptech.com>
On Thu, 2 Jun 2005, Adam Kropelin wrote:
> What confuses me is the following:
Yeah, I'll try to clarify.
git-diff-cache can show the difference between a tree and either the index
_or_ the working directory. Will fix up.
Linus
^ permalink raw reply
* [PATCH] Fix -B "very-different" logic.
From: Junio C Hamano @ 2005-06-02 23:54 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vmzqau3es.fsf@assigned-by-dhcp.cox.net>
>>>>> "JCH" == Junio C Hamano <junkio@cox.net> writes:
> (Btw, current versions of git will consider the change
> in question to be so big that it's considered a whole
> new file, since the diff is actually bigger than the
> file.
JCH> Do you want me to do something about this with -B (and possibly
JCH> -C/-M), like skipping the comparison altogether if the file size
JCH> is smaller than, say, 1k bytes or something silly like that? Or
JCH> not having special case for this kind of "contrived example"
JCH> preferrable?
I was looking at the -B code. The reason it thinks change is
too big is because xdelta tells us to reconstruct the
destination by all new literal bytes in this small string case.
There is not much I can do about it.
However I think the diffcore-break algorithm itself was basing
its "very_different" computation on numbers somewhat bogus. It
was counting newly inserted bytes into account, but amount of
those bytes should not make any difference when determining if
the change is a complete rewrite.
I suspect that -M/-C heuristics has similar (if not the same)
issues, but I would like to address that separately.
Here is a proposed fix for -B. It also tells diffcore-break not
to break a file smaller than 400 bytes. I did not make this
number configurable, since that would be too many knobs to
tweak. If somebody feels strong enough about it, it can be made
into an option later, but for now that size "feels" reasonable.
-- >8 -- cut here -- >8 --
------------
What we are interested in here is how much the original source
material remains in the final result, and it does not really
matter how much new contents are added as part of the edit. If
you remove 97 lines from an original 100-line document, it does
not matter if you add 47 lines of your own to make a 50-line
document, or if you add 997 lines to make a 1000-line document.
Either way, you did a complete rewrite.
Earlier code counted both new material and deletions to detect
complete rewrites. This patch fixes it. With its default
setting, it detects three such complete rewrites in the core-GIT
repository.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
count-delta.h | 1 +
diffcore.h | 4 ++-
count-delta.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
diffcore-break.c | 55 +++++++++++++++---------------------------
4 files changed, 92 insertions(+), 38 deletions(-)
diff --git a/count-delta.h b/count-delta.h
--- a/count-delta.h
+++ b/count-delta.h
@@ -5,5 +5,6 @@
#define COUNT_DELTA_H
unsigned long count_delta(void *, unsigned long);
+unsigned long count_excluded_source_material(void *, unsigned long);
#endif
diff --git a/diffcore.h b/diffcore.h
--- a/diffcore.h
+++ b/diffcore.h
@@ -10,9 +10,9 @@
*/
#define MAX_SCORE 60000
#define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
-#define DEFAULT_BREAK_SCORE 59400 /* minimum for break to happen (99%)*/
+#define DEFAULT_BREAK_SCORE 48000 /* minimum for break to happen (80%) */
-#define RENAME_DST_MATCHED 01
+#define DIFF_MINIMUM_BREAK 400 /* minimum size of source that -B breaks */
struct diff_filespec {
unsigned char sha1[20];
diff --git a/count-delta.c b/count-delta.c
--- a/count-delta.c
+++ b/count-delta.c
@@ -93,3 +93,73 @@ unsigned long count_delta(void *delta_bu
return 0;
return (src_size - copied_from_source) + added_literal;
}
+
+
+/*
+ * What we are interested in here is how much the original source
+ * material remains in the final result, and it does not really matter
+ * how much new contents are added as part of the edit. If you remove
+ * 97 lines from an original 100-line document, it does not matter if
+ * you add 47 lines of your own to make a 50-line document, or if you
+ * add 997 lines to make a 1000-line document. Either way, you did a
+ * complete rewrite.
+ *
+ * Note. We do not interprete delta fully. Instead, we look at xdelta
+ * instructions that copy bytes from the source, and count those copied
+ * bytes. Subtracting this number from the original source size yields
+ * the number of bytes not used from the source material. In the above
+ * example, this number corresponds to 97-line (but we count in bytes).
+ */
+unsigned long count_excluded_source_material(void *delta_buf,
+ unsigned long delta_size)
+{
+ unsigned long copied_from_source;
+ const unsigned char *data, *top;
+ unsigned char cmd;
+ unsigned long src_size, dst_size, out;
+
+ /* the smallest delta size possible is 6 bytes */
+ if (delta_size < 6)
+ return UINT_MAX;
+
+ data = delta_buf;
+ top = delta_buf + delta_size;
+
+ src_size = get_hdr_size(&data);
+ dst_size = get_hdr_size(&data);
+
+ copied_from_source = out = 0;
+ while (data < top) {
+ cmd = *data++;
+ if (cmd & 0x80) {
+ unsigned long cp_off = 0, cp_size = 0;
+ if (cmd & 0x01) cp_off = *data++;
+ if (cmd & 0x02) cp_off |= (*data++ << 8);
+ if (cmd & 0x04) cp_off |= (*data++ << 16);
+ if (cmd & 0x08) cp_off |= (*data++ << 24);
+ if (cmd & 0x10) cp_size = *data++;
+ if (cmd & 0x20) cp_size |= (*data++ << 8);
+ if (cp_size == 0) cp_size = 0x10000;
+
+ if (cmd & 0x40)
+ /* copy from dst */
+ ;
+ else
+ copied_from_source += cp_size;
+ out += cp_size;
+ } else {
+ /* write literal into dst */
+ out += cmd;
+ data += cmd;
+ }
+ }
+
+ /* sanity check */
+ if (data != top || out != dst_size)
+ return UINT_MAX;
+
+ if (src_size < copied_from_source)
+ /* we ended up overcounting and underflowed; I dunno why */
+ return 0;
+ return src_size - copied_from_source;
+}
diff --git a/diffcore-break.c b/diffcore-break.c
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -13,63 +13,46 @@ static int very_different(struct diff_fi
{
/* dst is recorded as a modification of src. Are they so
* different that we are better off recording this as a pair
- * of delete and create? min_score is the minimum amount of
- * new material that must exist in the dst and not in src for
- * the pair to be considered a complete rewrite, and recommended
- * to be set to a very high value, 99% or so.
+ * of delete and create?
*
- * The value we return represents the amount of new material
- * that is in dst and not in src. We return 0 when we do not
- * want to get the filepair broken.
+ * We base the score on the amount of material originally from
+ * src that still remains in the dst. If src was 100-line
+ * file among which only 3-line remains in the dst, then it is
+ * a complete rewrite with 97% "change", and it does not
+ * matter if the resulting file is a 15-line file or a
+ * 2000-line file. On the other hand, if 40-line remains
+ * among those 100-lines, even if the resulting file is a
+ * 2000-lines file, it still is an edit with 60% "change",
+ * which may sound counter-intuitive at first but that is the
+ * right number to use.
*/
+
void *delta;
- unsigned long delta_size, base_size;
+ unsigned long delta_size;
if (!S_ISREG(src->mode) || !S_ISREG(dst->mode))
return 0; /* leave symlink rename alone */
- if (diff_populate_filespec(src, 1) || diff_populate_filespec(dst, 1))
- return 0; /* error but caught downstream */
-
- delta_size = ((src->size < dst->size) ?
- (dst->size - src->size) : (src->size - dst->size));
-
- /* Notice that we use max of src and dst as the base size,
- * unlike rename similarity detection. This is so that we do
- * not mistake a large addition as a complete rewrite.
- */
- base_size = ((src->size < dst->size) ? dst->size : src->size);
-
- /*
- * If file size difference is too big compared to the
- * base_size, we declare this a complete rewrite.
- */
- if (base_size * min_score < delta_size * MAX_SCORE)
- return MAX_SCORE;
-
if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
return 0; /* error but caught downstream */
+ if (src->size < DIFF_MINIMUM_BREAK)
+ return 0; /* Too small to consider breaking */
+
delta = diff_delta(src->data, src->size,
dst->data, dst->size,
&delta_size);
- /* A delta that has a lot of literal additions would have
- * big delta_size no matter what else it does.
- */
- if (base_size * min_score < delta_size * MAX_SCORE)
- return MAX_SCORE;
-
/* Estimate the edit size by interpreting delta. */
- delta_size = count_delta(delta, delta_size);
+ delta_size = count_excluded_source_material(delta, delta_size);
free(delta);
if (delta_size == UINT_MAX)
return 0; /* error in delta computation */
- if (base_size < delta_size)
+ if (src->size < delta_size)
return MAX_SCORE;
- return delta_size * MAX_SCORE / base_size;
+ return delta_size * MAX_SCORE / src->size;
}
void diffcore_break(int min_score)
------------
^ permalink raw reply
* Re: I want to release a "git-1.0"
From: Adam Kropelin @ 2005-06-02 23:40 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0505312002160.1876@ppc970.osdl.org>
Linus Torvalds wrote:
> Anyway, I wrote just a _very_ introductory thing in
> Documentation/tutorial.txt, I'll try to update and expand on it later.
> It
> basically has a really stupid example of "how to set up a new
> project".
I've been working my way thru the tutorial, trying to up my git clue
level a bit. One part where things start to go a bit pear-shaped for me
is in the description of git-diff-files vs. git-diff-cache. The tutorial
takes pains to emphasize the difference between "working directory
contents", "index file", and "committed tree", and I'm on board with
that. What confuses me is the following:
> Unlike "git-diff-files", which showed the difference between the index
> file and the working directory, "git-diff-cache" shows the differences
> between a committed _tree_ and the index file.
> ...
> [example where git-diff-cache shows difference between working
> directory and committed tree]
> ...
> "git-diff-cache" also has a specific flag "--cached", which is used to
> tell it to show the differences purely with the index file, and ignore
> the current working directory state entirely
The example and the description of --cached seem to contradict the first
sentence's description the tool's purpose in life. If it shows you
differences between a committed tree and the index file, why is it
looking in my working directory at all? In order to get the behavior the
first sentence describes you actually have to use --cached.
Am I on right track?
--Adam
^ permalink raw reply
* Re: Problem with cogito and Linux tree tags
From: Radoslaw Szkodzinski @ 2005-06-02 23:14 UTC (permalink / raw)
To: Dan Holmsand; +Cc: git
In-Reply-To: <429F73E4.1020502@gorzow.mm.pl>
Radoslaw Szkodzinski wrote:
>Dan Holmsand wrote:
>
>
>
>>$ git-cat-file tag 06f6d9e2f140466eeb41e494e14167f90210f89d
>>
>>which tells you that v2.6.12-rc5 is commit
>>2a24ab628aa7b190be32f63dfb6d96f3fb61580a
>>
>>
>>
>Ok. This doesn't work too. That cogito version really works fine, but I
>had that branch cloned from a local repository gotten from rsync and
>probably that's the problem.
>The tags weren't propagated, but they should be.
>
>AstralStorm
>
>
Well, new cogito-0.11.1 (300ab153620d2492e824cb3561c32debb5e80bf8) has
this fixed and picked up missing objects automatically.
AstralStorm
^ permalink raw reply
* Re: [PATCH 1/2] Handle deltified object correctly in git-*-pull family.
From: Linus Torvalds @ 2005-06-02 22:48 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nicolas Pitre, git
In-Reply-To: <7vu0kg1jxn.fsf_-_@assigned-by-dhcp.cox.net>
On Thu, 2 Jun 2005, Junio C Hamano wrote:
>
> Like this...
Yup. Applied, thanks,
Linus
^ permalink raw reply
* Re: [PATCH] Find size of SHA1 object without inflating everything.
From: Junio C Hamano @ 2005-06-02 22:47 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.58.0506021508020.1876@ppc970.osdl.org>
>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
LT> On Thu, 2 Jun 2005, Junio C Hamano wrote:
>>
>> +int sha1_file_size(const unsigned char *sha1, unsigned long *sizep)
LT> ...
>> + ret = unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr));
LT> ...
>> + delta_data_head = unpack_sha1_rest(&stream, hdr, 200);
LT> Why do you do this?
Because I was not thinking when I wrote "char hdr[1024]".
Nico pointed out the same problem and you have a fixed version
of both in your mailbox.
^ permalink raw reply
* Re: [ANNOUNCE] cogito-0.11
From: Chris Wright @ 2005-06-02 22:38 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <20050602222329.GJ32189@pasky.ji.cz>
* Petr Baudis (pasky@ucw.cz) wrote:
> Hello,
>
> so I'm happy to finally announce cogito-0.11, a SCMish interface to
> Linus' git storage system. (It's actually 0.11.1 because I forgot to do
> some stuff before the release.) Get it at
>
> kernel.org/pub/software/scm/cogito/
RPMS are now being uploaded as well.
thanks,
-chris
^ permalink raw reply
* [ANNOUNCE] cogito-0.11
From: Petr Baudis @ 2005-06-02 22:23 UTC (permalink / raw)
To: git
Hello,
so I'm happy to finally announce cogito-0.11, a SCMish interface to
Linus' git storage system. (It's actually 0.11.1 because I forgot to do
some stuff before the release.) Get it at
kernel.org/pub/software/scm/cogito/
or just pull it if you have your Cogito tree Cogito-tracked.
There's probably too many things which have changed since cg-0.10.
There were plenty of bugfixes, the diff format changed, the git side of
stuff made a giant leap forward, etc. It's just better. :-) (Hopefully.)
Note that I tried to take all the seemingly-important bugfixes I've
noticed, but my feature patches queue is just huge so if your patch is
not inside (it probably isn't unless I notified you over email), don't
panic. If you think it's an important bugfix which should go in now,
please resend it. And if it's a feature patch but older than a week or
two, resend it too. I will try to process my queue as fast as I will be
able to.
This release wasn't extensively tested and there were some last-minute
changes. So handle it with a little bit of care and expect cogito-0.11.2
possibly following soon with some more bugfixes (if there are any
problems found).
Another thing to note if you are pulling - there are might be some
obsolete or (in case of the git-pb tree) completely nonsensical tags
in your tree, and they will slow down cg-pull/cg-update a lot now - it
will complain about them and if they don't get fetched ("different
tree" message is provided instead of "retrieved"), just rm the tags for
good.
Have fun,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply
* [PATCH 2/2] Find size of SHA1 object without inflating everything.
From: Junio C Hamano @ 2005-06-02 22:20 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Nicolas Pitre, git
In-Reply-To: <Pine.LNX.4.63.0506021733520.17354@localhost.localdomain>
This adds sha1_file_size() helper function and uses it in the
rename/copy similarity estimator. The helper function handles
deltified object as well.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
*** Thanks and credits goes to Nico for suggesting not to
*** use unpack_sha1_rest().
cache.h | 1 +
diff.c | 11 ++++++-----
sha1_file.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 67 insertions(+), 5 deletions(-)
diff --git a/cache.h b/cache.h
--- a/cache.h
+++ b/cache.h
@@ -154,6 +154,7 @@ extern void * map_sha1_file(const unsign
extern int unpack_sha1_header(z_stream *stream, void *map, unsigned long mapsize, void *buffer, unsigned long size);
extern int parse_sha1_header(char *hdr, char *type, unsigned long *sizep);
extern int sha1_delta_base(const unsigned char *, unsigned char *);
+extern int sha1_file_size(const unsigned char *, unsigned long *);
extern void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned long *size);
extern void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size);
extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsigned char *return_sha1);
diff --git a/diff.c b/diff.c
--- a/diff.c
+++ b/diff.c
@@ -333,7 +333,6 @@ int diff_populate_filespec(struct diff_f
close(fd);
}
else {
- /* We cannot do size only for SHA1 blobs */
char type[20];
struct sha1_size_cache *e;
@@ -343,11 +342,13 @@ int diff_populate_filespec(struct diff_f
s->size = e->size;
return 0;
}
+ if (!sha1_file_size(s->sha1, &s->size))
+ locate_size_cache(s->sha1, s->size);
+ }
+ else {
+ s->data = read_sha1_file(s->sha1, type, &s->size);
+ s->should_free = 1;
}
- s->data = read_sha1_file(s->sha1, type, &s->size);
- s->should_free = 1;
- if (s->data && size_only)
- locate_size_cache(s->sha1, s->size);
}
return 0;
}
diff --git a/sha1_file.c b/sha1_file.c
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -432,6 +432,66 @@ int sha1_delta_base(const unsigned char
return ret;
}
+int sha1_file_size(const unsigned char *sha1, unsigned long *sizep)
+{
+ int ret, status;
+ unsigned long mapsize, size;
+ void *map;
+ z_stream stream;
+ char hdr[64], type[20];
+ const unsigned char *data;
+ unsigned char cmd;
+ int i;
+
+ map = map_sha1_file(sha1, &mapsize);
+ if (!map)
+ return -1;
+ ret = unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr));
+ status = -1;
+ if (ret < Z_OK || parse_sha1_header(hdr, type, &size) < 0)
+ goto out;
+ if (strcmp(type, "delta")) {
+ *sizep = size;
+ status = 0;
+ goto out;
+ }
+
+ /* We are dealing with a delta object. Inflated, the first
+ * 20 bytes hold the base object SHA1, and delta data follows
+ * immediately after it.
+ *
+ * The initial part of the delta starts at delta_data_head +
+ * 20. Borrow code from patch-delta to read the result size.
+ */
+ data = hdr + strlen(hdr) + 1 + 20;
+
+ /* Skip over the source size; we are not interested in
+ * it and we cannot verify it because we do not want
+ * to read the base object.
+ */
+ cmd = *data++;
+ while (cmd) {
+ if (cmd & 1)
+ data++;
+ cmd >>= 1;
+ }
+ /* Read the result size */
+ size = i = 0;
+ cmd = *data++;
+ while (cmd) {
+ if (cmd & 1)
+ size |= *data++ << i;
+ i += 8;
+ cmd >>= 1;
+ }
+ *sizep = size;
+ status = 0;
+ out:
+ inflateEnd(&stream);
+ munmap(map, mapsize);
+ return status;
+}
+
void * read_sha1_file(const unsigned char *sha1, char *type, unsigned long *size)
{
unsigned long mapsize;
------------
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox