Git development
 help / color / mirror / Atom feed
* Re: Patch calculus
From: Jakub Narebski @ 2006-04-02 16:30 UTC (permalink / raw)
  To: git
In-Reply-To: <20060402161121.GB18864@fieldses.org>

J. Bruce Fields wrote:

> What are the benefits of patch calculus?  (What is it?  The only
> explanation I've seen is at
>   http://abridgegame.org/darcs/manual/node8.html, 
> but I don't find it very helpful.)

See also http://www.darcs.net/DarcsWiki/PatchTheory
particularly http://www.darcs.net/DarcsWiki/WhyYouWantPatchTheory

P.S. I'm not a Darcs advocate.
-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: Default remote branch for local branch
From: Josef Weidendorfer @ 2006-04-02 16:17 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Junio C Hamano, git
In-Reply-To: <1143865123.14465.26.camel@dv>

On Saturday 01 April 2006 06:18, Pavel Roskin wrote:
> On Fri, 2006-03-31 at 19:05 -0800, Junio C Hamano wrote:
> > Maybe you would want something like this.
> >
> > In $GIT_DIR/config:
> > 
> > 	[pull]
> > 	origin = linus for master
> >         origin = irq-pio of libata for ata-irq-pio
> >         origin = pata-drivers of libata for ata-pata

Let me try to understand this: the general idea is that

  pull.origin = [<refspec> of] <remote> for <branch>

specifies the default action of git-pull if we are on <branch>, ie.
a "git pull" then runs "git pull <remote> [<refspec>]".

So the example above, if .git/remotes/linus would contain two
refspecs, and you are on the branch of the 2nd refspec, it would
do the wrong thing: merge the 1st refspec with current branch.
So I think this is not useful, and if we use above syntax, we
should make the refspec mandatory.

However. I think a syntax mentioning only 2 local branches is better:

  pull.origin = <local upstream for branch> for <branch>

Perhaps I have misunderstood the proposal?

> First of all, using "origin" on every line carries to little
> information.

"origin" is part of the case-insensitive alphanum key, which is the same
for all config values in Junio's proposal. Especially, you can
not use it for head names. So this is fine.

Perhaps we could make a shorther alternative form for the above where
the key part has not to be specified on every line with a rule like

  if the line does not match /^\S+="/, the full line is the value

Then, above could be written as

  [pull.origin]
  linus for master
  irq-pio of libata for ata-irq-pio
  pata-drivers of libata for ata-pata

However, that's only syntactical sugar.
 
> Secondly, I think the relationship should be between a local development
> branch and a local tracking branch.

Agree.
It is also useful to specify this relation if the upstream is purely a
local branch, e.g. when branching off a local branch, and you want to
pull in changes from the local upstream.

This works automatically if git-pull only does upstream fetching if
there is a remote branch associated. The default action of git-fetch
similar could be "fetch the upstream branch, if that tracks a remote
branch", using the same configuration.

> After all, all remote data is 
> placed on a local tracking branch first.  It's better not to jump over
> layers of abstraction.  Suppose I want to update "masterB".  I tell git
> to sync "originB" first.  git already has rules what to do if it should
> sync "originB".  Let's not supersede those rules.

Junio's proposal has the advantage that you do not have to search in all
files in .git/remotes (and even .git/branches) for the remote branch that
maps to a given local branch.
But that is not the big issue.

> I would write the config like this:
> 
> [branch-upstream]
> master = linus
> ata-irq-pio = irq-pio
> ata-pata = pata-drivers

That is not working, as said above. But with above syntax extension,
with s/=/for/ it would be fine.

It would be nice to also support the topic branches, ie. to be able
to specify all topic branches for a branch, and make "git-pull" default
to an octopus merge of the topic branches.
However, "git-pull" can not distinguish between "merge upstream" and
"merge topic branches". Yet, specifying multiple default branches should
be possible.

> > While we are on the topic, it _might_ be worthwhile to think
> > about revamping the syntax of $GIT_DIR/remotes file, maybe even
> > breaking backward compatibility.  The Pull: lines can be
> > independently specified which gives flexibility, but I suspect
> > local tracking branches from the same remote tend to live in the
> > same place; IOW, you would probably not do something like:
> > 
> > 	URL: git://git.kernel.org/.../jgarzik/libata-dev.git
> > 	Pull: refs/heads/irq-pio:refs/remotes/libata/irq-pio
> > 	Pull: refs/heads/pata-drivers:refs/heads/pata-drivers
> > 
> > in practice.

What is the idea instead?
I think the current syntax is fine, as it is very flexible.
The reasoning about tracking remote branches in the same place
is a porcelain issue to be set up by git-clone.

Perhaps you are missing a remotes editor command?

Josef

> 
> Sorry, I don't understand this part.

^ permalink raw reply

* Re: Multi-headed branches (hydra? :)) for basic patch calculus
From: J. Bruce Fields @ 2006-04-02 16:11 UTC (permalink / raw)
  To: Sam Vilain; +Cc: git
In-Reply-To: <1143950852.21233.23.camel@localhost.localdomain>

On Sun, Apr 02, 2006 at 04:07:32PM +1200, Sam Vilain wrote:
> To represent this in git you could just roll back the head merge commit,
> push commit 5 on that branch, then make a new head:
> 
>   1 -> 3 -> 5 \
>                >- head
>   2 -> 4 -----/
> 
> However, if there was support for "hydra", or heads that are multiple
> commit IDs (and necessarily, no blobs in corresponding paths in their
> trees that are not identical), then you would not need to destroy and
> recreate this dummy merge head commit to model your patch history in
> this manner.

What's the advantage to doing this?

> If the plumbing or a porcelain could be smart enough to automatically
> create hydra when patches are not dependent, then many of the benefits
> of patch calculus might come for free, without having to create these
> complicated sounding entities manually.

What are the benefits of patch calculus?  (What is it?  The only
explanation I've seen is at
http://abridgegame.org/darcs/manual/node8.html, but I don't find it very
helpful.)

--b.

^ permalink raw reply

* Re: [PATCH] Use _type constants instead of literal constants
From: Jakub Narebski @ 2006-04-02 13:41 UTC (permalink / raw)
  To: git
In-Reply-To: <20060402130051.GA2933@ebar091.ebar.dtu.dk>

Peter Eriksen wrote:

> From: Peter Eriksen <s022018@student.dtu.dk>
> Date: Sun Apr 2 14:44:09 2006 +0200
> Subject: [PATCH] Use blob_, commit_, tag_, and tree_type throughout.
> 
> This replaces occurences of "blob", "commit", "tag", and "tree",
> where they're really used as type specifiers, which we already
> have defined global constants for.

Shouldn't the name of constant rather be e.g. instead of blob_type be
type_blob, and similarly for the rest of type constants?

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* [PATCH] Use _type constants instead of litteral constants
From: Peter Eriksen @ 2006-04-02 13:00 UTC (permalink / raw)
  To: git

From: Peter Eriksen <s022018@student.dtu.dk>
Date: Sun Apr 2 14:44:09 2006 +0200
Subject: [PATCH] Use blob_, commit_, tag_, and tree_type throughout.

This replaces occurences of "blob", "commit", "tag", and "tree",
where they're really used as type specifiers, which we already
have defined global constants for.

Signed-off-by: Peter Eriksen <s022018@student.dtu.dk>


---

I have no idea if something like this is wanted. It does touch
a lot of core files, and probably will give merge conflicts 
all over the place. It was good fun and practice for me, though. 

Regards,

Peter

 apply.c           |    5 +++--
 blame.c           |    2 +-
 cat-file.c        |    6 ++++--
 combine-diff.c    |    3 ++-
 commit-tree.c     |    8 +++++---
 convert-objects.c |   15 +++++++++------
 diff-tree.c       |    2 +-
 entry.c           |    3 ++-
 hash-object.c     |    3 ++-
 index-pack.c      |   14 +++++++++-----
 ls-tree.c         |    4 ++--
 mktag.c           |    3 ++-
 mktree.c          |    3 ++-
 object.c          |    8 ++++----
 pack-objects.c    |   16 ++++++++++------
 revision.c        |    2 +-
 sha1_file.c       |   42 +++++++++++++++++++++++-------------------
 tar-tree.c        |    2 +-
 tree-diff.c       |    7 ++++---
 tree-walk.c       |    3 ++-
 unpack-file.c     |    3 ++-
 unpack-objects.c  |   14 +++++++++-----
 write-tree.c      |    3 ++-
 23 files changed, 102 insertions(+), 69 deletions(-)

fad7c58e5e1bc105b7a39ff9ceb19eb7c4927c28
diff --git a/apply.c b/apply.c
index c50b3a6..cc3f12e 100644
--- a/apply.c
+++ b/apply.c
@@ -9,6 +9,7 @@
 #include <fnmatch.h>
 #include "cache.h"
 #include "quote.h"
+#include "blob.h"
 
 //  --check turns on checking that the working tree matches the
 //    files that are being modified, but doesn't apply the patch
@@ -1296,7 +1297,7 @@ static int apply_fragments(struct buffer
 			 * applies to.
 			 */
 			write_sha1_file_prepare(desc->buffer, desc->size,
-						"blob", sha1, hdr, &hdrlen);
+						blob_type, sha1, hdr, &hdrlen);
 			if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix))
 				return error("the patch applies to '%s' (%s), "
 					     "which does not match the "
@@ -1659,7 +1660,7 @@ static void add_index_file(const char *p
 	if (lstat(path, &st) < 0)
 		die("unable to stat newly created file %s", path);
 	fill_stat_cache_info(ce, &st);
-	if (write_sha1_file(buf, size, "blob", ce->sha1) < 0)
+	if (write_sha1_file(buf, size, blob_type, ce->sha1) < 0)
 		die("unable to create backing store for newly created file %s", path);
 	if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD) < 0)
 		die("unable to add cache entry for %s", path);
diff --git a/blame.c b/blame.c
index 396defc..98f9992 100644
--- a/blame.c
+++ b/blame.c
@@ -229,7 +229,7 @@ static void get_blob(struct commit *comm
 
 	info->buf = read_sha1_file(info->sha1, type, &info->size);
 
-	assert(!strcmp(type, "blob"));
+	assert(!strcmp(type, blob_type));
 }
 
 /* For debugging only */
diff --git a/cat-file.c b/cat-file.c
index 761111e..628f6ca 100644
--- a/cat-file.c
+++ b/cat-file.c
@@ -5,6 +5,8 @@
  */
 #include "cache.h"
 #include "exec_cmd.h"
+#include "tag.h"
+#include "tree.h"
 
 static void flush_buffer(const char *buf, unsigned long size)
 {
@@ -136,13 +138,13 @@ int main(int argc, char **argv)
 			die("Not a valid object name %s", argv[2]);
 
 		/* custom pretty-print here */
-		if (!strcmp(type, "tree"))
+		if (!strcmp(type, tree_type))
 			return execl_git_cmd("ls-tree", argv[2], NULL);
 
 		buf = read_sha1_file(sha1, type, &size);
 		if (!buf)
 			die("Cannot read object %s", argv[2]);
-		if (!strcmp(type, "tag"))
+		if (!strcmp(type, tag_type))
 			return pprint_tag(sha1, buf, size);
 
 		/* otherwise just spit out the data */
diff --git a/combine-diff.c b/combine-diff.c
index f17aab3..7693884 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "commit.h"
+#include "blob.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "quote.h"
@@ -104,7 +105,7 @@ static char *grab_blob(const unsigned ch
 		return xcalloc(1, 1);
 	}
 	blob = read_sha1_file(sha1, type, size);
-	if (strcmp(type, "blob"))
+	if (strcmp(type, blob_type))
 		die("object '%s' is not a blob!", sha1_to_hex(sha1));
 	return blob;
 }
diff --git a/commit-tree.c b/commit-tree.c
index 16c1787..2d86518 100644
--- a/commit-tree.c
+++ b/commit-tree.c
@@ -4,6 +4,8 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "commit.h"
+#include "tree.h"
 
 #define BLOCKING (1ul << 14)
 
@@ -93,13 +95,13 @@ int main(int argc, char **argv)
 	if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
 		usage(commit_tree_usage);
 
-	check_valid(tree_sha1, "tree");
+	check_valid(tree_sha1, tree_type);
 	for (i = 2; i < argc; i += 2) {
 		char *a, *b;
 		a = argv[i]; b = argv[i+1];
 		if (!b || strcmp(a, "-p") || get_sha1(b, parent_sha1[parents]))
 			usage(commit_tree_usage);
-		check_valid(parent_sha1[parents], "commit");
+		check_valid(parent_sha1[parents], commit_type);
 		if (new_parent(parents))
 			parents++;
 	}
@@ -125,7 +127,7 @@ int main(int argc, char **argv)
 	while (fgets(comment, sizeof(comment), stdin) != NULL)
 		add_buffer(&buffer, &size, "%s", comment);
 
-	if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
+	if (!write_sha1_file(buffer, size, commit_type, commit_sha1)) {
 		printf("%s\n", sha1_to_hex(commit_sha1));
 		return 0;
 	}
diff --git a/convert-objects.c b/convert-objects.c
index b49bce2..2476577 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -2,6 +2,9 @@ #define _XOPEN_SOURCE 500 /* glibc2 and 
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #include <time.h>
 #include "cache.h"
+#include "blob.h"
+#include "commit.h"
+#include "tree.h"
 
 struct entry {
 	unsigned char old_sha1[20];
@@ -122,7 +125,7 @@ static int write_subdirectory(void *buff
 		buffer += len;
 	}
 
-	write_sha1_file(new, newlen, "tree", result_sha1);
+	write_sha1_file(new, newlen, tree_type, result_sha1);
 	free(new);
 	return used;
 }
@@ -262,7 +265,7 @@ static void convert_date(void *buffer, u
 	memcpy(new + newlen, buffer, size);
 	newlen += size;
 
-	write_sha1_file(new, newlen, "commit", result_sha1);
+	write_sha1_file(new, newlen, commit_type, result_sha1);
 	free(new);	
 }
 
@@ -298,11 +301,11 @@ static struct entry * convert_entry(unsi
 	buffer = xmalloc(size);
 	memcpy(buffer, data, size);
 	
-	if (!strcmp(type, "blob")) {
-		write_sha1_file(buffer, size, "blob", entry->new_sha1);
-	} else if (!strcmp(type, "tree"))
+	if (!strcmp(type, blob_type)) {
+		write_sha1_file(buffer, size, blob_type, entry->new_sha1);
+	} else if (!strcmp(type, tree_type))
 		convert_tree(buffer, size, entry->new_sha1);
-	else if (!strcmp(type, "commit"))
+	else if (!strcmp(type, commit_type))
 		convert_commit(buffer, size, entry->new_sha1);
 	else
 		die("unknown object type '%s' in %s", type, sha1_to_hex(sha1));
diff --git a/diff-tree.c b/diff-tree.c
index f55a35a..d1265d7 100644
--- a/diff-tree.c
+++ b/diff-tree.c
@@ -52,7 +52,7 @@ static int diff_root_tree(const unsigned
 	void *tree;
 	struct tree_desc empty, real;
 
-	tree = read_object_with_reference(new, "tree", &real.size, NULL);
+	tree = read_object_with_reference(new, tree_type, &real.size, NULL);
 	if (!tree)
 		die("unable to read root tree (%s)", sha1_to_hex(new));
 	real.buf = tree;
diff --git a/entry.c b/entry.c
index 5d9aefd..793724f 100644
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,7 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include "cache.h"
+#include "blob.h"
 
 static void create_directories(const char *path, struct checkout *state)
 {
@@ -72,7 +73,7 @@ static int write_entry(struct cache_entr
 	char type[20];
 
 	new = read_sha1_file(ce->sha1, type, &size);
-	if (!new || strcmp(type, "blob")) {
+	if (!new || strcmp(type, blob_type)) {
 		if (new)
 			free(new);
 		return error("git-checkout-index: unable to read sha1 file of %s (%s)",
diff --git a/hash-object.c b/hash-object.c
index 6502b5b..87e1277 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -5,6 +5,7 @@
  * Copyright (C) Junio C Hamano, 2005 
  */
 #include "cache.h"
+#include "blob.h"
 
 static void hash_object(const char *path, const char *type, int write_object)
 {
@@ -35,7 +36,7 @@ static const char hash_object_usage[] =
 int main(int argc, char **argv)
 {
 	int i;
-	const char *type = "blob";
+	const char *type = blob_type;
 	int write_object = 0;
 	const char *prefix = NULL;
 	int prefix_length = -1;
diff --git a/index-pack.c b/index-pack.c
index babe34b..b39953d 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -2,7 +2,11 @@ #include "cache.h"
 #include "delta.h"
 #include "pack.h"
 #include "csum-file.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
 static const char index_pack_usage[] =
 "git-index-pack [-o index-file] pack-file";
 
@@ -224,10 +228,10 @@ static void sha1_object(const void *data
 	const char *type_str;
 
 	switch (type) {
-	case OBJ_COMMIT: type_str = "commit"; break;
-	case OBJ_TREE:   type_str = "tree"; break;
-	case OBJ_BLOB:   type_str = "blob"; break;
-	case OBJ_TAG:    type_str = "tag"; break;
+	case OBJ_COMMIT: type_str = commit_type; break;
+	case OBJ_TREE:   type_str = tree_type; break;
+	case OBJ_BLOB:   type_str = blob_type; break;
+	case OBJ_TAG:    type_str = tag_type; break;
 	default:
 		die("bad type %d", type);
 	}
diff --git a/ls-tree.c b/ls-tree.c
index 26258c3..e4ef200 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -56,7 +56,7 @@ static int show_tree(unsigned char *sha1
 		     const char *pathname, unsigned mode, int stage)
 {
 	int retval = 0;
-	const char *type = "blob";
+	const char *type = blob_type;
 
 	if (S_ISDIR(mode)) {
 		if (show_recursive(base, baselen, pathname)) {
@@ -64,7 +64,7 @@ static int show_tree(unsigned char *sha1
 			if (!(ls_options & LS_SHOW_TREES))
 				return retval;
 		}
-		type = "tree";
+		type = tree_type;
 	}
 	else if (ls_options & LS_TREE_ONLY)
 		return 0;
diff --git a/mktag.c b/mktag.c
index fc6a9bf..2328878 100644
--- a/mktag.c
+++ b/mktag.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "tag.h"
 
 /*
  * A signature file has a very simple fixed format: three lines
@@ -126,7 +127,7 @@ int main(int argc, char **argv)
 	if (verify_tag(buffer, size) < 0)
 		die("invalid tag signature file");
 
-	if (write_sha1_file(buffer, size, "tag", result_sha1) < 0)
+	if (write_sha1_file(buffer, size, tag_type, result_sha1) < 0)
 		die("unable to write tag file");
 	printf("%s\n", sha1_to_hex(result_sha1));
 	return 0;
diff --git a/mktree.c b/mktree.c
index f853585..ab63cd9 100644
--- a/mktree.c
+++ b/mktree.c
@@ -6,6 +6,7 @@
 #include "cache.h"
 #include "strbuf.h"
 #include "quote.h"
+#include "tree.h"
 
 static struct treeent {
 	unsigned mode;
@@ -67,7 +68,7 @@ static void write_tree(unsigned char *sh
 		memcpy(buffer + offset, ent->sha1, 20);
 		offset += 20;
 	}
-	write_sha1_file(buffer, offset, "tree", sha1);
+	write_sha1_file(buffer, offset, tree_type, sha1);
 }
 
 static const char mktree_usage[] = "mktree [-z]";
diff --git a/object.c b/object.c
index c9ca481..b5c0ecf 100644
--- a/object.c
+++ b/object.c
@@ -196,15 +196,15 @@ struct object *parse_object(const unsign
 		struct object *obj;
 		if (check_sha1_signature(sha1, buffer, size, type) < 0)
 			printf("sha1 mismatch %s\n", sha1_to_hex(sha1));
-		if (!strcmp(type, "blob")) {
+		if (!strcmp(type, blob_type)) {
 			struct blob *blob = lookup_blob(sha1);
 			parse_blob_buffer(blob, buffer, size);
 			obj = &blob->object;
-		} else if (!strcmp(type, "tree")) {
+		} else if (!strcmp(type, tree_type)) {
 			struct tree *tree = lookup_tree(sha1);
 			parse_tree_buffer(tree, buffer, size);
 			obj = &tree->object;
-		} else if (!strcmp(type, "commit")) {
+		} else if (!strcmp(type, commit_type)) {
 			struct commit *commit = lookup_commit(sha1);
 			parse_commit_buffer(commit, buffer, size);
 			if (!commit->buffer) {
@@ -212,7 +212,7 @@ struct object *parse_object(const unsign
 				buffer = NULL;
 			}
 			obj = &commit->object;
-		} else if (!strcmp(type, "tag")) {
+		} else if (!strcmp(type, tag_type)) {
 			struct tag *tag = lookup_tag(sha1);
 			parse_tag_buffer(tag, buffer, size);
 			obj = &tag->object;
diff --git a/pack-objects.c b/pack-objects.c
index ccfaa5f..4145f25 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -1,5 +1,9 @@
 #include "cache.h"
 #include "object.h"
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
 #include "delta.h"
 #include "pack.h"
 #include "csum-file.h"
@@ -603,7 +607,7 @@ static void add_pbase_tree(struct tree_d
 		if (!add_object_entry(sha1, hash, 1))
 			continue;
 
-		if (!strcmp(type, "tree")) {
+		if (!strcmp(type, tree_type)) {
 			struct tree_desc sub;
 			void *elem;
 			struct name_path me;
@@ -626,7 +630,7 @@ static void add_preferred_base(unsigned 
 	struct tree_desc tree;
 	void *elem;
 
-	elem = read_object_with_reference(sha1, "tree", &tree.size, NULL);
+	elem = read_object_with_reference(sha1, tree_type, &tree.size, NULL);
 	tree.buf = elem;
 	if (!tree.buf)
 		return;
@@ -684,13 +688,13 @@ static void check_object(struct object_e
 		die("unable to get type of object %s",
 		    sha1_to_hex(entry->sha1));
 
-	if (!strcmp(type, "commit")) {
+	if (!strcmp(type, commit_type)) {
 		entry->type = OBJ_COMMIT;
-	} else if (!strcmp(type, "tree")) {
+	} else if (!strcmp(type, tree_type)) {
 		entry->type = OBJ_TREE;
-	} else if (!strcmp(type, "blob")) {
+	} else if (!strcmp(type, blob_type)) {
 		entry->type = OBJ_BLOB;
-	} else if (!strcmp(type, "tag")) {
+	} else if (!strcmp(type, tag_type)) {
 		entry->type = OBJ_TAG;
 	} else
 		die("unable to pack object %s of type %s",
diff --git a/revision.c b/revision.c
index c2a95aa..902a99f 100644
--- a/revision.c
+++ b/revision.c
@@ -260,7 +260,7 @@ int rev_same_tree_as_empty(struct tree *
 	if (!t1)
 		return 0;
 
-	tree = read_object_with_reference(t1->object.sha1, "tree", &real.size, NULL);
+	tree = read_object_with_reference(t1->object.sha1, tree_type, &real.size, NULL);
 	if (!tree)
 		return 0;
 	real.buf = tree;
diff --git a/sha1_file.c b/sha1_file.c
index 58edec0..ba8c4f7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -9,7 +9,11 @@
 #include "cache.h"
 #include "delta.h"
 #include "pack.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
 #ifndef O_NOATIME
 #if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
 #define O_NOATIME 01000000
@@ -894,16 +898,16 @@ void packed_object_info_detail(struct pa
 	}
 	switch (kind) {
 	case OBJ_COMMIT:
-		strcpy(type, "commit");
+		strcpy(type, commit_type);
 		break;
 	case OBJ_TREE:
-		strcpy(type, "tree");
+		strcpy(type, tree_type);
 		break;
 	case OBJ_BLOB:
-		strcpy(type, "blob");
+		strcpy(type, blob_type);
 		break;
 	case OBJ_TAG:
-		strcpy(type, "tag");
+		strcpy(type, tag_type);
 		break;
 	default:
 		die("corrupted pack file %s containing object of kind %d",
@@ -934,16 +938,16 @@ static int packed_object_info(struct pac
 		unuse_packed_git(p);
 		return retval;
 	case OBJ_COMMIT:
-		strcpy(type, "commit");
+		strcpy(type, commit_type);
 		break;
 	case OBJ_TREE:
-		strcpy(type, "tree");
+		strcpy(type, tree_type);
 		break;
 	case OBJ_BLOB:
-		strcpy(type, "blob");
+		strcpy(type, blob_type);
 		break;
 	case OBJ_TAG:
-		strcpy(type, "tag");
+		strcpy(type, tag_type);
 		break;
 	default:
 		die("corrupted pack file %s containing object of kind %d",
@@ -1071,16 +1075,16 @@ void *unpack_entry_gently(struct pack_en
 		retval = unpack_delta_entry(pack, size, left, type, sizep, p);
 		return retval;
 	case OBJ_COMMIT:
-		strcpy(type, "commit");
+		strcpy(type, commit_type);
 		break;
 	case OBJ_TREE:
-		strcpy(type, "tree");
+		strcpy(type, tree_type);
 		break;
 	case OBJ_BLOB:
-		strcpy(type, "blob");
+		strcpy(type, blob_type);
 		break;
 	case OBJ_TAG:
-		strcpy(type, "tag");
+		strcpy(type, tag_type);
 		break;
 	default:
 		return NULL;
@@ -1241,9 +1245,9 @@ void *read_object_with_reference(const u
 			return buffer;
 		}
 		/* Handle references */
-		else if (!strcmp(type, "commit"))
+		else if (!strcmp(type, commit_type))
 			ref_type = "tree ";
-		else if (!strcmp(type, "tag"))
+		else if (!strcmp(type, tag_type))
 			ref_type = "object ";
 		else {
 			free(buffer);
@@ -1625,7 +1629,7 @@ int index_pipe(unsigned char *sha1, int 
 		return -1;
 	}
 	if (!type)
-		type = "blob";
+		type = blob_type;
 	if (write_object)
 		ret = write_sha1_file(buf, off, type, sha1);
 	else {
@@ -1652,7 +1656,7 @@ int index_fd(unsigned char *sha1, int fd
 		return -1;
 
 	if (!type)
-		type = "blob";
+		type = blob_type;
 	if (write_object)
 		ret = write_sha1_file(buf, size, type, sha1);
 	else {
@@ -1690,9 +1694,9 @@ int index_path(unsigned char *sha1, cons
 		if (!write_object) {
 			unsigned char hdr[50];
 			int hdrlen;
-			write_sha1_file_prepare(target, st->st_size, "blob",
+			write_sha1_file_prepare(target, st->st_size, blob_type,
 						sha1, hdr, &hdrlen);
-		} else if (write_sha1_file(target, st->st_size, "blob", sha1))
+		} else if (write_sha1_file(target, st->st_size, blob_type, sha1))
 			return error("%s: failed to insert into database",
 				     path);
 		free(target);
diff --git a/tar-tree.c b/tar-tree.c
index 705b8fa..87870b6 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -336,7 +336,7 @@ int main(int argc, char **argv)
 	} else
 		archive_time = time(NULL);
 
-	tree.buf = read_object_with_reference(sha1, "tree", &tree.size,
+	tree.buf = read_object_with_reference(sha1, tree_type, &tree.size,
 	                                      tree_sha1);
 	if (!tree.buf)
 		die("not a reference to a tag, commit or tree object: %s",
diff --git a/tree-diff.c b/tree-diff.c
index 7bb6109..701fbba 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -3,6 +3,7 @@
  */
 #include "cache.h"
 #include "diff.h"
+#include "tree.h"
 
 // What paths are we interested in?
 static int nr_paths = 0;
@@ -148,7 +149,7 @@ static int show_entry(struct diff_option
 		void *tree;
 
 		tree = read_sha1_file(sha1, type, &inner.size);
-		if (!tree || strcmp(type, "tree"))
+		if (!tree || strcmp(type, tree_type))
 			die("corrupt tree sha %s", sha1_to_hex(sha1));
 
 		inner.buf = tree;
@@ -206,10 +207,10 @@ int diff_tree_sha1(const unsigned char *
 	struct tree_desc t1, t2;
 	int retval;
 
-	tree1 = read_object_with_reference(old, "tree", &t1.size, NULL);
+	tree1 = read_object_with_reference(old, tree_type, &t1.size, NULL);
 	if (!tree1)
 		die("unable to read source tree (%s)", sha1_to_hex(old));
-	tree2 = read_object_with_reference(new, "tree", &t2.size, NULL);
+	tree2 = read_object_with_reference(new, tree_type, &t2.size, NULL);
 	if (!tree2)
 		die("unable to read destination tree (%s)", sha1_to_hex(new));
 	t1.buf = tree1;
diff --git a/tree-walk.c b/tree-walk.c
index 0735f40..bf8bfdf 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "tree-walk.h"
+#include "tree.h"
 
 void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1)
 {
@@ -7,7 +8,7 @@ void *fill_tree_descriptor(struct tree_d
 	void *buf = NULL;
 
 	if (sha1) {
-		buf = read_object_with_reference(sha1, "tree", &size, NULL);
+		buf = read_object_with_reference(sha1, tree_type, &size, NULL);
 		if (!buf)
 			die("unable to read tree %s", sha1_to_hex(sha1));
 	}
diff --git a/unpack-file.c b/unpack-file.c
index 3accb97..23a8562 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "blob.h"
 
 static char *create_temp_file(unsigned char *sha1)
 {
@@ -9,7 +10,7 @@ static char *create_temp_file(unsigned c
 	int fd;
 
 	buf = read_sha1_file(sha1, type, &size);
-	if (!buf || strcmp(type, "blob"))
+	if (!buf || strcmp(type, blob_type))
 		die("unable to read blob object %s", sha1_to_hex(sha1));
 
 	strcpy(path, ".merge_file_XXXXXX");
diff --git a/unpack-objects.c b/unpack-objects.c
index 815a1b3..3b824b0 100644
--- a/unpack-objects.c
+++ b/unpack-objects.c
@@ -2,7 +2,11 @@ #include "cache.h"
 #include "object.h"
 #include "delta.h"
 #include "pack.h"
-
+#include "blob.h"
+#include "commit.h"
+#include "tag.h"
+#include "tree.h"
+
 #include <sys/time.h>
 
 static int dry_run, quiet;
@@ -148,10 +152,10 @@ static int unpack_non_delta_entry(enum o
 	const char *type;
 
 	switch (kind) {
-	case OBJ_COMMIT: type = "commit"; break;
-	case OBJ_TREE:   type = "tree"; break;
-	case OBJ_BLOB:   type = "blob"; break;
-	case OBJ_TAG:    type = "tag"; break;
+	case OBJ_COMMIT: type = commit_type; break;
+	case OBJ_TREE:   type = tree_type; break;
+	case OBJ_BLOB:   type = blob_type; break;
+	case OBJ_TAG:    type = tag_type; break;
 	default: die("bad type %d", kind);
 	}
 	if (!dry_run)
diff --git a/write-tree.c b/write-tree.c
index addb5de..dcad6e6 100644
--- a/write-tree.c
+++ b/write-tree.c
@@ -4,6 +4,7 @@
  * Copyright (C) Linus Torvalds, 2005
  */
 #include "cache.h"
+#include "tree.h"
 
 static int missing_ok = 0;
 
@@ -78,7 +79,7 @@ static int write_tree(struct cache_entry
 		nr++;
 	}
 
-	write_sha1_file(buffer, offset, "tree", returnsha1);
+	write_sha1_file(buffer, offset, tree_type, returnsha1);
 	free(buffer);
 	return nr;
 }
-- 
1.3.0.rc1.g8eef8e

^ permalink raw reply related

* Re: [Patch] Key help for gitk
From: Alex Riesen @ 2006-04-02 12:18 UTC (permalink / raw)
  To: paul; +Cc: paulus, git
In-Reply-To: <cc9bf44d0604011621m1952b17er6f8c7e0fe1595b53@mail.gmail.com>

Paul Schulz, Sun, Apr 02, 2006 02:21:16 +0200:
> +<Ctl-equal> - Incrument font size
> +<Ctl-KP_Add> - Incrument font size

Typo: "IncrEment"

^ permalink raw reply

* Re: [PATCH] Provide configurable UI font for gitk
From: Junio C Hamano @ 2006-04-02 10:57 UTC (permalink / raw)
  To: Keith Packard; +Cc: git, Paul Mackerras
In-Reply-To: <1143969814.2303.71.camel@neko.keithp.com>

Keith Packard <keithp@keithp.com> writes:

> This makes the font used in the UI elements of gitk configurable in the
> same way the other fonts are. The default fonts used in the Xft build of
> tk8.5 are particularily horrific, making this change more important
> there.
>
> Signed-off-by: Keith Packard <keithp@neko.keithp.com>

Thanks for the patch.  I haven't run it, but a quick eyeballing
suggests what you did is sane.  However,..

>  proc makewindow {rargs} {
> -    global canv canv2 canv3 linespc charspc ctext cflist textfont
> +    global canv canv2 canv3 linespc charspc ctext cflist textfont
> mainfont uifont

Your MUA seems to be line-wrapping the patch here and there...

> @@ -345,16 +345,20 @@ proc makewindow {rargs} {
>  
>      menu .bar
>      .bar add cascade -label "File" -menu .bar.file
> +    .bar configure -font $uifont
>      menu .bar.file
>      .bar.file add command -label "Update" -command [list updatecommits
> $rargs]
>      .bar.file add command -label "Reread references" -command
> rereadrefs
>...

so the patch does not apply X-<.

Also, I prefer changes to gitk to be fed via Paul Mackerras
tree.  If you send changes to gitk to me, I will forward patches
with my Acked-by: to him and wait for him to bounce the change
back to me through his tree, so it is not a big deal for me, and
the changes will _not_ be lost anyway, but I'd still appreciate
gitk patches to be sent to Paul first if possible.

^ permalink raw reply

* Solaris cloning woes partly diagnosed
From: Junio C Hamano @ 2006-04-02 10:41 UTC (permalink / raw)
  To: git

This is just an interim report, but people might have heard that
OpenSolaris team are in the process of choosing a free DSCM and
we are one of the candidates.  They initially wanted to try
1.2.4 but had trouble using it for local cloning, and the
evaluation is being done with 1.2.2.

I was on #git tonight with Oejet, and managed to reproduce this
problem. The local clone problem seems to disappear if we
disable the progress bar in pack-objects.

We do two funky things when we have progress bar.  We play games
with timer signal (setitimer(ITIMER_REAL) and signal(SIGALRM)),
and we spit out messages to stderr.

It's too late tonight for me to continue digging this, but if
somebody with access to a Solaris box is so inclined, I'd really
appreciate help on this one.

^ permalink raw reply

* Re: parsecvs tool now creates git repositories
From: Jan-Benedict Glaw @ 2006-04-02  9:39 UTC (permalink / raw)
  To: Keith Packard; +Cc: Git Mailing List
In-Reply-To: <1143956188.2303.39.camel@neko.keithp.com>

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

On Sat, 2006-04-01 21:36:28 -0800, Keith Packard <keithp@keithp.com> wrote:
> The UI is a total disaster, sufficient for testing. You must create an
> Authors file in the current directory which looks like the git-cvsimport
> authors file. You must also have a edit-change-log program in your path
> which edits the commit message in place. /bin/true will work if you
> don't need to edit the messages.

Well, at least this sounds quite promising. I'll give it a run once
I've arrived back home on the Binutils repository.

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 für einen Freien Staat voll Freier Bürger"  | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCH] Provide configurable UI font for gitk
From: Keith Packard @ 2006-04-02  9:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 4839 bytes --]

This makes the font used in the UI elements of gitk configurable in the
same way the other fonts are. The default fonts used in the Xft build of
tk8.5 are particularily horrific, making this change more important
there.

Signed-off-by: Keith Packard <keithp@neko.keithp.com>


---

 gitk |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

0ec97bb373389b5a55b0579168679b59bede1868
diff --git a/gitk b/gitk
index 03cd475..6319709 100755
--- a/gitk
+++ b/gitk
@@ -337,7 +337,7 @@ proc error_popup msg {
 }
 
 proc makewindow {rargs} {
-    global canv canv2 canv3 linespc charspc ctext cflist textfont
+    global canv canv2 canv3 linespc charspc ctext cflist textfont
mainfont uifont
     global findtype findtypemenu findloc findstring fstring geometry
     global entries sha1entry sha1string sha1but
     global maincursor textcursor curtextcursor
@@ -345,16 +345,20 @@ proc makewindow {rargs} {
 
     menu .bar
     .bar add cascade -label "File" -menu .bar.file
+    .bar configure -font $uifont
     menu .bar.file
     .bar.file add command -label "Update" -command [list updatecommits
$rargs]
     .bar.file add command -label "Reread references" -command
rereadrefs
     .bar.file add command -label "Quit" -command doquit
+    .bar.file configure -font $uifont
     menu .bar.edit
     .bar add cascade -label "Edit" -menu .bar.edit
     .bar.edit add command -label "Preferences" -command doprefs
+    .bar.edit configure -font $uifont
     menu .bar.help
     .bar add cascade -label "Help" -menu .bar.help
     .bar.help add command -label "About gitk" -command about
+    .bar.help configure -font $uifont
     . configure -menu .bar
 
     if {![info exists geometry(canv1)]} {
@@ -401,7 +405,7 @@ proc makewindow {rargs} {
     set entries $sha1entry
     set sha1but .ctop.top.bar.sha1label
     button $sha1but -text "SHA1 ID: " -state disabled -relief flat \
-	-command gotocommit -width 8
+	-command gotocommit -width 8 -font $uifont
     $sha1but conf -disabledforeground [$sha1but cget -foreground]
     pack .ctop.top.bar.sha1label -side left
     entry $sha1entry -width 40 -font $textfont -textvariable sha1string
@@ -431,19 +435,24 @@ proc makewindow {rargs} {
 	-state disabled -width 26
     pack .ctop.top.bar.rightbut -side left -fill y
 
-    button .ctop.top.bar.findbut -text "Find" -command dofind
+    button .ctop.top.bar.findbut -text "Find" -command dofind -font
$uifont
     pack .ctop.top.bar.findbut -side left
     set findstring {}
     set fstring .ctop.top.bar.findstring
     lappend entries $fstring
-    entry $fstring -width 30 -font $textfont -textvariable findstring
+    entry $fstring -width 30 -font $textfont -textvariable findstring
-font $textfont
     pack $fstring -side left -expand 1 -fill x
     set findtype Exact
     set findtypemenu [tk_optionMenu .ctop.top.bar.findtype \
 			  findtype Exact IgnCase Regexp]
+    .ctop.top.bar.findtype configure -font $uifont
+    .ctop.top.bar.findtype.menu configure -font $uifont
     set findloc "All fields"
     tk_optionMenu .ctop.top.bar.findloc findloc "All fields" Headline \
 	Comments Author Committer Files Pickaxe
+    .ctop.top.bar.findloc configure -font $uifont
+    .ctop.top.bar.findloc.menu configure -font $uifont
+	
     pack .ctop.top.bar.findloc -side right
     pack .ctop.top.bar.findtype -side right
     # for making sure type==Exact whenever loc==Pickaxe
@@ -490,7 +499,7 @@ proc makewindow {rargs} {
     frame .ctop.cdet.right
     set cflist .ctop.cdet.right.cfiles
     listbox $cflist -bg white -selectmode extended -width
$geometry(cflistw) \
-	-yscrollcommand ".ctop.cdet.right.sb set"
+	-yscrollcommand ".ctop.cdet.right.sb set" -font $mainfont
     scrollbar .ctop.cdet.right.sb -command "$cflist yview"
     pack .ctop.cdet.right.sb -side right -fill y
     pack $cflist -side left -fill both -expand 1
@@ -590,7 +599,7 @@ proc click {w} {
 }
 
 proc savestuff {w} {
-    global canv canv2 canv3 ctext cflist mainfont textfont
+    global canv canv2 canv3 ctext cflist mainfont textfont uifont
     global stuffsaved findmergefiles maxgraphpct
     global maxwidth
 
@@ -600,6 +609,7 @@ proc savestuff {w} {
 	set f [open "~/.gitk-new" w]
 	puts $f [list set mainfont $mainfont]
 	puts $f [list set textfont $textfont]
+	puts $f [list set uifont $uifont]
 	puts $f [list set findmergefiles $findmergefiles]
 	puts $f [list set maxgraphpct $maxgraphpct]
 	puts $f [list set maxwidth $maxwidth]
@@ -3738,6 +3748,7 @@ if {$tclencoding == {}} {
 
 set mainfont {Helvetica 9}
 set textfont {Courier 9}
+set uifont {Helvetica 9 bold}
 set findmergefiles 0
 set maxgraphpct 50
 set maxwidth 16
-- 
1.3.0.rc1.g9590


-- 
keith.packard@intel.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply related

* [RFH] xdiff shows trivially redundant diff.
From: Junio C Hamano @ 2006-04-02  9:15 UTC (permalink / raw)
  To: git; +Cc: Davide Libenzi, Linus Torvalds

$ git diff-tree -p 52e8a6^2 52d8a6 -- git-fetch.sh

shows a change that trivially is redundant, like this:

    diff --git a/git-fetch.sh b/git-fetch.sh
    index b4325d9..de4f011 100755
    --- a/git-fetch.sh
    +++ b/git-fetch.sh
    @@ -320,7 +320,7 @@ fetch_main () {
         ( : subshell because we muck with IFS
           IFS="    $LF"
           (
    -         git-fetch-pack $exec $keep "$remo...
    +         git-fetch-pack $exec $keep --thin...
           ) |
           while read sha1 remote_name
           do
    @@ -367,21 +367,26 @@ fetch_main "$reflist"

     # automated tag following
     case "$no_tags$tags" in
    -'')
    -       taglist=$(IFS=" " &&
    -       git-ls-remote $upload_pack --tags "$remote" |
    ...
    -       done)
    +'')
    +       case "$reflist" in
    +       *:refs/*)
    ...

Notice the first '-' and '+' lines of second hunk are identical?

There is another interesting thing.  This is running diff
between 52e8a6^2 and 52d8a6 blobs, but if I change them slightly
so that the first hunk is not different, then this anomaly
disappears.

^ permalink raw reply

* Re: Multi-headed branches (hydra? :)) for basic patch calculus
From: Jakub Narebski @ 2006-04-02  6:49 UTC (permalink / raw)
  To: git
In-Reply-To: <1143950852.21233.23.camel@localhost.localdomain>

Sam Vilain wrote:

> From a discussion on #git, the idea was raised of "multi-headed
> branches"
[...] 
> If somebody adds a commit (5) that changes "foo.c" again, the darcs
> history would change to:
> 
>   1 -> 3 -> 5
>   2 -> 4
> 
> To represent this in git you could just roll back the head merge commit,
> push commit 5 on that branch, then make a new head:
>
>   1 -> 3 -> 5 \
>                >- head
>   2 -> 4 -----/
> 
> However, if there was support for "hydra", or heads that are multiple
> commit IDs (and necessarily, no blobs in corresponding paths in their
> trees that are not identical), then you would not need to destroy and
> recreate this dummy merge head commit to model your patch history in
> this manner.
[...]

I'm not sure if "hydras", i.e. multi-commit 'heads' are what would make
GIT able to use some of Darcs patches calculus ideas. If I understand
correctly in GIT 'head' (and 'tag') not only identifies commit (commits
in hydra[1]) but also tree (in hydra it is result of trivial (?) merge).
Wouldn't it be better to somehow represent rather partial ordering between
commits in history, to have something from Darcs in GIT? Although I'm not
sure about efficiency, and if we should do detect commits dependency -- or
in other words partial ordering of commits/patches -- at commit or at
merge. And if we should remember (or cache) partial ordering/dependency
info...

[1] I've detected some confusion in this terminology. "Hydra" is
multi-headed moster, yet in your ptoposal it is one head that has multiple
bodies... and "octopus" is taken. I guess the terminology should be
switched (octopus <-> hydra).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* parsecvs tool now creates git repositories
From: Keith Packard @ 2006-04-02  5:36 UTC (permalink / raw)
  To: Git Mailing List; +Cc: keithp

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

I've hacked in cheesy system(3) calls to invoke various git tools to
create a git repository from a parsed cvs repository. It's about the
same speed as git-cvsimport now.

The UI is a total disaster, sufficient for testing. You must create an
Authors file in the current directory which looks like the git-cvsimport
authors file. You must also have a edit-change-log program in your path
which edits the commit message in place. /bin/true will work if you
don't need to edit the messages.

I should clearly steal the existing git-cvsimport command line arguments
and use those.

This tool successfully, and usefully, imports the X.org xserver CVS
repository, along with correctly importing several other repositories
I've tried. It doesn't quite manage to compute correct branch points for
the postgresql CVS repository, so there is clearly work remaining to be
done.

CVS - your code's worst nightmare.

-- 
keith.packard@intel.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply

* Multi-headed branches (hydra? :)) for basic patch calculus
From: Sam Vilain @ 2006-04-02  4:07 UTC (permalink / raw)
  To: git

>From a discussion on #git, the idea was raised of "multi-headed
branches"

Say you've got a sequence of changes like this:

1. add foo.c
2. add bar.c
3. modify foo.c
4. modify bar.c

The darcs-like operation of this would be to have two sequences of
ordered patches that combine to a final result.  ie:

  1 -> 3
  2 -> 4

Unless you jump through hoops, git will represent it as:

  1 -> 2 -> 3 -> 4.

However, you *could* represent it as:

  1 -> 3  \
           >- head
  2 -> 4  /

Where "head" is a merge commit that just combines the trees of 3 and 4.

If somebody adds a commit (5) that changes "foo.c" again, the darcs
history would change to:

  1 -> 3 -> 5
  2 -> 4

To represent this in git you could just roll back the head merge commit,
push commit 5 on that branch, then make a new head:

  1 -> 3 -> 5 \
               >- head
  2 -> 4 -----/

However, if there was support for "hydra", or heads that are multiple
commit IDs (and necessarily, no blobs in corresponding paths in their
trees that are not identical), then you would not need to destroy and
recreate this dummy merge head commit to model your patch history in
this manner.

If the plumbing or a porcelain could be smart enough to automatically
create hydra when patches are not dependent, then many of the benefits
of patch calculus might come for free, without having to create these
complicated sounding entities manually.

Of course this doesn't give you the symbolic labelling of patches that
can allow darcs to detect already applied, but "mutated" patches, but
that might not matter in practice.

Sam.

^ permalink raw reply

* [PATCH] revision: --max-age alone does not need limit_list() anymore.
From: Junio C Hamano @ 2006-04-02  3:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604011628500.3684@g5.osdl.org>

This makes git log --since=7.days to be streamable.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 revision.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

bbbc8c3a8d455e1f5d15c3764eba70250b5479e9
diff --git a/revision.c b/revision.c
index cdd29c5..728b6d1 100644
--- a/revision.c
+++ b/revision.c
@@ -699,7 +699,7 @@ int setup_revisions(int argc, const char
 		add_one_commit(commit, revs);
 	}
 
-	if ((revs->max_age != -1) || revs->topo_order || revs->unpacked)
+	if (revs->topo_order || revs->unpacked)
 		revs->limited = 1;
 
 	if (revs->prune_data) {
-- 
1.3.0.rc1.gf385

^ permalink raw reply related

* [PATCH] revision: simplify argument parsing.
From: Junio C Hamano @ 2006-04-02  3:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604011628500.3684@g5.osdl.org>

This just moves code around to consolidate the part that sets
revs->limited to one place based on various flags.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---
 * Just the preparation for the next step...

 revision.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

53069686601d156dea3787a100ffc4e35c78040f
diff --git a/revision.c b/revision.c
index 07cc86f..cdd29c5 100644
--- a/revision.c
+++ b/revision.c
@@ -552,32 +552,26 @@ int setup_revisions(int argc, const char
 			}
 			if (!strncmp(arg, "--max-age=", 10)) {
 				revs->max_age = atoi(arg + 10);
-				revs->limited = 1;
 				continue;
 			}
-			if (!strncmp(arg, "--min-age=", 10)) {
-				revs->min_age = atoi(arg + 10);
-				revs->limited = 1;
-				continue;
-			}
 			if (!strncmp(arg, "--since=", 8)) {
 				revs->max_age = approxidate(arg + 8);
-				revs->limited = 1;
 				continue;
 			}
 			if (!strncmp(arg, "--after=", 8)) {
 				revs->max_age = approxidate(arg + 8);
-				revs->limited = 1;
 				continue;
 			}
+			if (!strncmp(arg, "--min-age=", 10)) {
+				revs->min_age = atoi(arg + 10);
+				continue;
+			}
 			if (!strncmp(arg, "--before=", 9)) {
 				revs->min_age = approxidate(arg + 9);
-				revs->limited = 1;
 				continue;
 			}
 			if (!strncmp(arg, "--until=", 8)) {
 				revs->min_age = approxidate(arg + 8);
-				revs->limited = 1;
 				continue;
 			}
 			if (!strcmp(arg, "--all")) {
@@ -596,13 +590,11 @@ int setup_revisions(int argc, const char
 			}
 			if (!strcmp(arg, "--topo-order")) {
 				revs->topo_order = 1;
-				revs->limited = 1;
 				continue;
 			}
 			if (!strcmp(arg, "--date-order")) {
 				revs->lifo = 0;
 				revs->topo_order = 1;
-				revs->limited = 1;
 				continue;
 			}
 			if (!strcmp(arg, "--parents")) {
@@ -644,7 +636,6 @@ int setup_revisions(int argc, const char
 			}
 			if (!strcmp(arg, "--unpacked")) {
 				revs->unpacked = 1;
-				revs->limited = 1;
 				continue;
 			}
 			*unrecognized++ = arg;
@@ -707,6 +698,9 @@ int setup_revisions(int argc, const char
 		commit = get_commit_reference(revs, def, sha1, 0);
 		add_one_commit(commit, revs);
 	}
+
+	if ((revs->max_age != -1) || revs->topo_order || revs->unpacked)
+		revs->limited = 1;
 
 	if (revs->prune_data) {
 		diff_tree_setup_paths(revs->prune_data);
-- 
1.3.0.rc1.gf385

^ permalink raw reply related

* Re: [PATCH/RFC 2/2] Make path-limiting be incremental when possible.
From: Junio C Hamano @ 2006-04-02  3:11 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604011628500.3684@g5.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> What ends up not working very well at all is the combination of 
> "--topo-order" and the output filter in get_revision. It will return NULL 
> when we see the first commit out of date-order, even if we have other 
> commits coming.
>
> So we really should do the "past the date order" thing in get_revision() 
> only if we have _not_ done it already in limit_list().

Right now --max-age causes "limited" so there should not be a
difference, if I am not mistaken.  But I've been meaning to
change that, so the patch makes sense.  Similarly,...

-- >8 --
[PATCH] revision: --topo-order and --unpacked

Now, using --unpacked without limit_list() does not make much
sense, but this is parallel to the earlier --max-age fix.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 revision.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

22c31bf183bff576c7807f9d67abfc11ee8e1fa4
diff --git a/revision.c b/revision.c
index 558ed01..07cc86f 100644
--- a/revision.c
+++ b/revision.c
@@ -787,7 +787,10 @@ struct commit *get_revision(struct rev_i
 		 * that we'd otherwise have done in limit_list().
 		 */
 		if (!revs->limited) {
-			if (revs->max_age != -1 && (commit->date < revs->max_age))
+			if ((revs->unpacked &&
+			     has_sha1_pack(commit->object.sha1)) ||
+			    (revs->max_age != -1 &&
+			     (commit->date < revs->max_age)))
 				continue;
 			add_parents_to_list(revs, commit, &revs->commits);
 		}
-- 
1.3.0.rc1.gf385

^ permalink raw reply related

* [PATCH] contrib/git-svn: accept configuration via repo-config
From: Eric Wong @ 2006-04-02  2:25 UTC (permalink / raw)
  To: junkio, git; +Cc: Eric Wong

repo-config keys are any of the long option names minus the '-'
characters

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/git-svn.perl |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

2eb11880066977d65ed7e51b04c2bfa97d217752
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 59dd504..edfb19c 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -67,6 +67,23 @@ for (my $i = 0; $i < @ARGV; $i++) {
 
 my %opts = %{$cmd{$cmd}->[2]} if (defined $cmd);
 
+# convert GetOpt::Long specs for use by git-repo-config
+foreach my $o (keys %opts) {
+	my $v = $opts{$o};
+	my ($key) = ($o =~ /^([a-z\-]+)/);
+	$key =~ s/-//g;
+	my $arg = 'git-repo-config';
+	$arg .= ' --int' if ($o =~ /=i$/);
+	$arg .= ' --bool' if ($o !~ /=[sfi]$/);
+	$arg .= " svn.$key"; # $key only matches [a-z\-], always shell-safe
+	if (ref $v eq 'ARRAY') {
+		chomp(@$v = `$arg`);
+	} else {
+		chomp($$v = `$arg`);
+		$$v = 0 if $$v eq 'false';
+	}
+}
+
 GetOptions(%opts, 'help|H|h' => \$_help,
 		'version|V' => \$_version,
 		'id|i=s' => \$GIT_SVN) or exit 1;
-- 
1.3.0.rc1.g709a5

^ permalink raw reply related

* [PATCH] contrib/git-svn: documentation updates
From: Eric Wong @ 2006-04-02  2:25 UTC (permalink / raw)
  To: junkio, git; +Cc: Eric Wong
In-Reply-To: <11439447031422-git-send-email-normalperson@yhbt.net>

contrib/git-svn/git-svn.txt:
	added git-repo-config key names for options
	fixed quoting of "git-svn-HEAD" in the manpage
	use preformatted text for examples

contrib/git-svn/Makefile:
	add target to generate HTML:
		http://git-svn.yhbt.net/git-svn.html

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/Makefile    |    3 +++
 contrib/git-svn/git-svn.txt |   41 ++++++++++++++++++++++++++++-------------
 2 files changed, 31 insertions(+), 13 deletions(-)

f8198e0b9da68024f7194067eb120bbf256a6111
diff --git a/contrib/git-svn/Makefile b/contrib/git-svn/Makefile
index a330c61..d7f1643 100644
--- a/contrib/git-svn/Makefile
+++ b/contrib/git-svn/Makefile
@@ -25,6 +25,9 @@ git-svn.1 : git-svn.xml
 git-svn.xml : git-svn.txt
 	asciidoc -b docbook -d manpage \
 		-f ../../Documentation/asciidoc.conf $<
+git-svn.html : git-svn.txt
+	asciidoc -b xhtml11 -d manpage \
+		-f ../../Documentation/asciidoc.conf $<
 test:
 	cd t && $(SHELL) ./t0000-contrib-git-svn.sh
 
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index 7a6e0c4..e18fcaf 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -101,6 +101,8 @@ OPTIONS
 	cannot version empty directories.  Enabling this flag will make
 	the commit to SVN act like git.
 
+	repo-config key: svn.rmdir
+
 -e::
 --edit::
 	Only used with the 'commit' command.
@@ -108,6 +110,8 @@ OPTIONS
 	Edit the commit message before committing to SVN.  This is off by
 	default for objects that are commits, and forced on when committing
 	tree objects.
+
+	repo-config key: svn.edit
 
 -l<num>::
 --find-copies-harder::
@@ -115,6 +119,9 @@ OPTIONS
 
 	They are both passed directly to git-diff-tree see
 	git-diff-tree(1) for more information.
+
+	repo-config key: svn.l
+	repo-config key: svn.findcopiesharder
 
 ADVANCED OPTIONS
 ----------------
@@ -133,6 +140,8 @@ ADVANCED OPTIONS
 	This option may be specified multiple times, once for each
 	branch.
 
+	repo-config key: svn.branch
+
 -i<GIT_SVN_ID>::
 --id <GIT_SVN_ID>::
 	This sets GIT_SVN_ID (instead of using the environment).  See
@@ -145,7 +154,7 @@ COMPATIBILITY OPTIONS
 	Only used with the 'rebuild' command.
 
 	Run this if you used an old version of git-svn that used
-	'git-svn-HEAD' instead of 'remotes/git-svn' as the branch
+	"git-svn-HEAD" instead of "remotes/git-svn" as the branch
 	for tracking the remote.
 
 --no-ignore-externals::
@@ -161,26 +170,30 @@ COMPATIBILITY OPTIONS
 
 	Otherwise, do not enable this flag unless you know what you're
 	doing.
+
+	repo-config key: svn.noignoreexternals
 
 Basic Examples
 ~~~~~~~~~~~~~~
 
 Tracking and contributing to an Subversion managed-project:
 
-# Initialize a tree (like git init-db)::
+------------------------------------------------------------------------
+# Initialize a tree (like git init-db):
 	git-svn init http://svn.foo.org/project/trunk
-# Fetch remote revisions::
+# Fetch remote revisions:
 	git-svn fetch
-# Create your own branch to hack on::
+# Create your own branch to hack on:
 	git checkout -b my-branch remotes/git-svn
-# Commit only the git commits you want to SVN::
+# Commit only the git commits you want to SVN:
 	git-svn commit <tree-ish> [<tree-ish_2> ...]
-# Commit all the git commits from my-branch that don't exist in SVN::
+# Commit all the git commits from my-branch that don't exist in SVN:
 	git-svn commit remotes/git-svn..my-branch
-# Something is committed to SVN, pull the latest into your branch::
+# Something is committed to SVN, pull the latest into your branch:
 	git-svn fetch && git pull . remotes/git-svn
-# Append svn:ignore settings to the default git exclude file::
+# Append svn:ignore settings to the default git exclude file:
 	git-svn show-ignore >> .git/info/exclude
+------------------------------------------------------------------------
 
 DESIGN PHILOSOPHY
 -----------------
@@ -219,7 +232,7 @@ git commits with the following syntax:
 
 This allows you to tie unfetched SVN revision 375 to your current HEAD::
 
-	git-svn fetch 375=$(git-rev-parse HEAD)
+	`git-svn fetch 375=$(git-rev-parse HEAD)`
 
 Advanced Example: Tracking a Reorganized Repository
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -232,22 +245,24 @@ This is how Yann Dirson tracked the trun
 the /trunk directory of his repository was moved to /ufoai/trunk and
 he needed to continue tracking /ufoai/trunk where /trunk left off.
 
-	# This log message shows when the repository was reorganized::
+------------------------------------------------------------------------
+	# This log message shows when the repository was reorganized:
 	r166 | ydirson | 2006-03-02 01:36:55 +0100 (Thu, 02 Mar 2006) | 1 line
 	Changed paths:
 	   D /trunk
 	   A /ufoai/trunk (from /trunk:165)
 
-	# First we start tracking the old revisions::
+	# First we start tracking the old revisions:
 	GIT_SVN_ID=git-oldsvn git-svn init \
-	      https://svn.sourceforge.net/svnroot/ufoai/trunk
+			https://svn.sourceforge.net/svnroot/ufoai/trunk
 	GIT_SVN_ID=git-oldsvn git-svn fetch -r1:165
 
-	# And now, we continue tracking the new revisions::
+	# And now, we continue tracking the new revisions:
 	GIT_SVN_ID=git-newsvn git-svn init \
 	      https://svn.sourceforge.net/svnroot/ufoai/ufoai/trunk
 	GIT_SVN_ID=git-newsvn git-svn fetch \
 	      166=`git-rev-parse refs/remotes/git-oldsvn`
+------------------------------------------------------------------------
 
 BUGS
 ----
-- 
1.3.0.rc1.g709a5

^ permalink raw reply related

* Re: [PATCH/RFC 2/2] Make path-limiting be incremental when possible.
From: Linus Torvalds @ 2006-04-02  0:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vr74jw0zj.fsf@assigned-by-dhcp.cox.net>



On Thu, 30 Mar 2006, Junio C Hamano wrote:
> 
> OK, so let's say I agree with you that --unpacked and --since
> are "stop early" rules.  I fully agree with that from usability
> and implementation point of view, but I now wonder if the
> "output filter" in get_revision() and "stop early" in limit_list()
> would do the same thing.

They don't.

What ends up not working very well at all is the combination of 
"--topo-order" and the output filter in get_revision. It will return NULL 
when we see the first commit out of date-order, even if we have other 
commits coming.

So we really should do the "past the date order" thing in get_revision() 
only if we have _not_ done it already in limit_list().

Something like this.

The easiest way to test this is with just

	gitk --since=3.days.ago

on the kernel tree. Without this patch, it tends to be pretty obviously 
broken.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>

		Linus

---
diff --git a/revision.c b/revision.c
index a8a54b6..558ed01 100644
--- a/revision.c
+++ b/revision.c
@@ -783,10 +783,14 @@ struct commit *get_revision(struct rev_i
 
 		/*
 		 * If we haven't done the list limiting, we need to look at
-		 * the parents here
+		 * the parents here. We also need to do the date-based limiting
+		 * that we'd otherwise have done in limit_list().
 		 */
-		if (!revs->limited)
+		if (!revs->limited) {
+			if (revs->max_age != -1 && (commit->date < revs->max_age))
+				continue;
 			add_parents_to_list(revs, commit, &revs->commits);
+		}
 		if (commit->object.flags & SHOWN)
 			continue;
 		if (!(commit->object.flags & BOUNDARY) &&
@@ -794,8 +798,6 @@ struct commit *get_revision(struct rev_i
 			continue;
 		if (revs->min_age != -1 && (commit->date > revs->min_age))
 			continue;
-		if (revs->max_age != -1 && (commit->date < revs->max_age))
-			return NULL;
 		if (revs->no_merges &&
 		    commit->parents && commit->parents->next)
 			continue;

^ permalink raw reply related

* [Patch] Key help for gitk
From: Paul Schulz @ 2006-04-02  0:21 UTC (permalink / raw)
  To: paulus; +Cc: git
In-Reply-To: <cc9bf44d0604011616w18b9a7c3nc55a393f30a2b55a@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 283 bytes --]

Greetings,

 gitk has a few more key options than I was aware (font
increase/decrease for example). The following patch adds some details
to the 'About' dialog.
 (These need to be reviewed for sanity, as I can't work out how the
search keys are ment to work.)

 Paul Schulz

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-gitk-20060402.diff --]
[-- Type: text/x-patch; name=patch-gitk-20060402.diff;  charset=ANSI_X3.4-1968, Size: 1121 bytes --]

diff --git a/gitk b/gitk
index fa1e83c..85d70d9 100755
--- a/gitk
+++ b/gitk
@@ -722,7 +722,41 @@ Gitk - a commit viewer for git
 
 Copyright © 2005-2006 Paul Mackerras
 
-Use and redistribute under the terms of the GNU General Public License} \
+Use and redistribute under the terms of the GNU General Public License
+
+Keys
+----
+<Down> - Move down a line
+<Up> - Move up a line
+<Right> -
+<Left> -
+<Delete> -
+<BackSpace> -
+<Space> - Scroll Diff
+p - Previous commit
+n - Next commit
+z - Go back (?)
+x - Go forward (?)
+i - Previuos line
+k - Next line
+j - Go back
+l - Go forward
+b - ?
+d - ?
+u - ?
+/ - Next find result (?)
+<Return> - Find result
+? - Previous find result
+f - Next file
+<Ctl-q> - Quit
+<Ctl-f> - Find
+<Ctl-g> - Find next
+<Ctl-r> - Find previous
+<Ctl-equal> - Incrument font size
+<Ctl-KP_Add> - Incrument font size
+<Ctl-minus> - Decrement font size
+<Ctl-KP_Subtract> - Decrement font size
+} \
 	    -justify center -aspect 400
     pack $w.m -side top -fill x -padx 20 -pady 20
     button $w.ok -text Close -command "destroy $w"



^ permalink raw reply related

* Re: Moving a file back to an earlier revision.
From: Petr Baudis @ 2006-04-01 23:01 UTC (permalink / raw)
  To: David Ho; +Cc: git
In-Reply-To: <4dd15d180603311332p60fa1867nc303bd92d515b4e0@mail.gmail.com>

Dear diary, on Fri, Mar 31, 2006 at 11:32:16PM CEST, I got a letter
where David Ho <davidkwho@gmail.com> said that...
> Sorry I might already have found it.
> 
> File revisions
> 
> +----+----+
> 1    2    3
> 
> git diff commit(3)..commit(1) filename | git-apply

Note that it might be more convenient to just say "restore the file to
the contents as of commit X" - in pure Git this would involve dances
with git-ls-tree and git-cat-file, I'm not sure if the core Git
porcelain has an interface for doing this easily.

In Cogito, you can just do:

	cg-restore -f -r commitid filename

-- 
				Petr "Pasky on a dialup" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time.  I think
I have forgotten this before.

^ permalink raw reply

* Re: Default remote branch for local branch
From: Jakub Narebski @ 2006-04-01 19:57 UTC (permalink / raw)
  To: git
In-Reply-To: <e0l3l0$v4e$1@sea.gmane.org>

> You might want to read "Efficient cloning" thread where
> --use-separate-remote and --reference options were introduced:
>   http://marc.theaimsgroup.com/?l=git&m=114280442802681&w=2
>   http://www.gelato.unsw.edu.au/archives/git/0603/18113.html
>   http://thread.gmane.org/gmane.comp.version-control.git/17724
> and which had discussion on similar subjects (somewhere).

See also
  Message-ID: <200603011814.43573.Josef.Weidendorfer@gmx.de>

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: Moving to BK
From: Jakub Narebski @ 2006-04-01  7:13 UTC (permalink / raw)
  To: git; +Cc: linux-kernel
In-Reply-To: <Pine.LNX.4.64.0603312030060.27203@g5.osdl.org>

Linus Torvalds wrote:

> On Fri, 31 Mar 2006, David S. Miller wrote:
>> 
>> April 1st is upon us again.
> 
> I really like the new slashdot look. "OMG!!! Ponies!!!"
> 
> I hope they keep it after Apr 1st.

Apr 1st begins at Mar 31st (some of Fool's Day articles on slashdot are from
Mar 31st localtime), and for some it would continue at lest to Apr 2nd ;-)

-- 
Jakub Narebski
Warsaw, Poland

^ permalink raw reply

* Re: Moving to BK
From: Randy.Dunlap @ 2006-04-01  6:42 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: davem, pasky, junio, linux-kernel, git
In-Reply-To: <Pine.LNX.4.64.0603312030060.27203@g5.osdl.org>

On Fri, 31 Mar 2006 20:30:40 -0800 (PST) Linus Torvalds wrote:

> 
> 
> On Fri, 31 Mar 2006, David S. Miller wrote:
> > 
> > April 1st is upon us again.
> 
> I really like the new slashdot look. "OMG!!! Ponies!!!"

Goes with the sandals and pony tails.

> I hope they keep it after Apr 1st.

---
~Randy

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox