Git development
 help / color / mirror / Atom feed
* Re: Hash algorithm choice
From: Linus Torvalds @ 2009-08-09 18:35 UTC (permalink / raw)
  To: Sverre Rabbelier; +Cc: Junio C Hamano, Jerome Baum, git
In-Reply-To: <fabb9a1e0908091116y6012caa7j6865d5fcd5d9888c@mail.gmail.com>



On Sun, 9 Aug 2009, Sverre Rabbelier wrote:
>
> Wouldn't the transport code also have to be modified? I assume git's
> integrity checking would yell at if you gave it commits with
> non-sha1-hashes and have no way to tell it that that hash was
> calculated with a non-sha1-hash at clone time?

Well, if you start introducing new hashes, the assumption is that all 
git's that access it would have to be updated.

You certainly could never pull/push between git versions that don't know 
about each others hashes. But you _can_ autodetect the hash mechanism 
(simple: just try them all on the first object you encounter)

		Linus

^ permalink raw reply

* Re: [PATCH 4/6 (v2)] administrative functions for rev-cache, and start of integration into git
From: Junio C Hamano @ 2009-08-09 18:36 UTC (permalink / raw)
  To: Nick Edelen
  Cc: Nicolas Pitre, Johannes Schindelin, Sam Vilain, Michael J Gruber,
	Jeff King, Shawn O. Pearce, Andreas Ericsson, Christian Couder,
	git@vger.kernel.org
In-Reply-To: <op.uyb1vcvytdk399@sirnot.private>

"Nick Edelen" <sirnot@gmail.com> writes:

Note that I didn't read the entire patch, so the parts I did not comment
on in this message may or may not have problematic parts.

>  - extra 'size' field added to commit, tag and blob objects, initialized in 
>    parse_* functions and cache traversal

It is unclear which "size" this field refers to without comment.

I do not know if this change is justifiable.  We (mostly Linus) spent
considerble effort to shrink the memory footprint of struct commit (and
struct object in general) exactly because revision traversal needs to
inspect tons of them.

> +static unsigned int parse_size(const char *name)
> +{
> +	unsigned int size;
> +	char *p;
> +	
> +	size = strtol(name, &p, 10);
> +	switch (*p) {
> +	case 'k' : 
> +	case 'K' : 
> +		size *= 0x400;
> +		break;
> +	case 'm' : 
> +	case 'M' : 
> +		size *= 0x100000;
> +		break;
> +	default : 
> +		break;
> +	}
> +	
> +	return size;
> +}

Looks vaguely familiar.

The configuration parser already knows about these size suffixes when told
to read "int".  Can't that code, e.g. git_parse_ulong(), be reused here?

> @@ -219,7 +221,6 @@ unsigned char *get_cache_slice(struct commit *commit)
>  		return 0;
>  	
>  	ie = search_index(commit->object.sha1);
> -	
>  	if (ie && ie->cache_index < idx_head.cache_nr)
>  		return idx_caches + ie->cache_index * 20;

"Oops, fix an earlier mistake"...

> @@ -262,7 +282,6 @@ static int setup_traversal(struct cache_slice_header *head, unsigned char *map,
>  	struct commit_list *prev, *wp, **wpp;
>  	int retval;
>  	
> -	/* printf("adding %s\n", sha1_to_hex(commit->object.sha1)); */

Likewise.

^ permalink raw reply

* Re: [PATCH v2] push: point to 'git pull' and 'git push --force' in case of non-fast forward
From: Matthieu Moy @ 2009-08-09 18:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Teemu Likonen, git
In-Reply-To: <7vy6pujmsc.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:

> Instead of saying "Merge in", we could say "Integrate" to cover both
> practices.

I'm fine with both. I consider rebasing as a kind of merging, but ...

> I also happen to think that the mention of --force falls into the
> same category as "try shooting and then study if it hurgs".

Depending on the context. In the case of

git push
git commit --amend
git push

Pointing the user to 'git pull' is probably the thing which hurts the
most. And to me, the name --force already means "yes, I know what I'm
doing". My proposal was "[...] use git push --force to discard the
remote changes." which warns enough about the danger.

> So how about phrasing it like this?
>
>     Non-fast forward pushes were rejected because you would discard remote
>     changes you have not seen.  Integrate them with your changes and then
>     push again. See 'non-fast forward' section of 'git push --help'.

I thing not pointing to 'git pull' in the message really defeats the
purpose of the patch. I don't find an error message only telling me
"go read the doc as you should have done from the beginning" really
helps.

-- 
Matthieu

^ permalink raw reply

* Re: Hash algorithm choice
From: Matthieu Moy @ 2009-08-09 18:44 UTC (permalink / raw)
  To: Jerome Baum; +Cc: git
In-Reply-To: <f448a46a0908090917s102b4c83pbad6f298a8e127cc@mail.gmail.com>

Jerome Baum <jerome@jeromebaum.com> writes:

> How difficult would it be to allow users to choose a hash function
> during git-init which is then globally used in the repo?

There's at least one really difficult thing: how do you merge two
projects using two different hash functions? The Git repository, for
example, has several (I don't remember how many) root repository, and
was originally made of several projects (git, gitk, git gui, ...). If
these projects had started using different hash functions, then,
either:

* Git would have needed to learn how to merge, and record the merge
  history, of projects using different hash functions.

* One of the projects would have been forced to be converted to
  another hash function, which means changing all its identifiers (so,
  for example, finding a message on gmane telling that commit 1ab23cde
  fixes your problem wouldn't help much anymore ...).

-- 
Matthieu

^ permalink raw reply

* [PATCH 0/8] Foreign VCS helpers
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

This is a replacement for the db/foreign-scm series in pu, now based
on next. The behavior specified for helpers is the same, so I'm not
reposting the particular helpers this time.

Daniel Barkalow (7):
  Use a clearer style to issue commands to remote helpers
  Use a function to determine whether a remote is valid
  Allow fetch to modify refs
  Allow programs to not depend on remotes having urls
  Add a config option for remotes to specify a foreign vcs
  Add support for "import" helper command
  Allow helpers to report in "list" command that the ref is unchanged

Johan Herland (1):
  Allow helpers to request marks for fast-import

 Documentation/config.txt             |    4 +
 Documentation/git-remote-helpers.txt |   22 ++++++-
 builtin-clone.c                      |    6 +-
 builtin-fetch.c                      |   19 +++--
 builtin-ls-remote.c                  |    4 +-
 builtin-push.c                       |   54 +++++++++-----
 remote.c                             |   15 +++-
 remote.h                             |    2 +
 transport-helper.c                   |  129 ++++++++++++++++++++++++++++++----
 transport.c                          |   21 ++++--
 transport.h                          |   41 ++++++++++-
 11 files changed, 261 insertions(+), 56 deletions(-)

^ permalink raw reply

* [PATCH 1/8] Use a clearer style to issue commands to remote helpers
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

This style is overkill for some commands, but it's worthwhile to use
the same style to issue all commands, and it's useful to avoid
open-coding string lengths.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---

This is really a clarity improvement for the previous series, but it's
here to establish the nicer style before introducing more commands.

 transport-helper.c |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/transport-helper.c b/transport-helper.c
index 43fdc0a..cb255e4 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -37,7 +37,10 @@ static struct child_process *get_helper(struct transport *transport)
 		die("Unable to run helper: git %s", helper->argv[0]);
 	data->helper = helper;
 
-	write_in_full(data->helper->in, "capabilities\n", 13);
+	strbuf_addstr(&buf, "capabilities\n");
+	write_in_full(helper->in, buf.buf, buf.len);
+	strbuf_reset(&buf);
+
 	file = fdopen(helper->out, "r");
 	while (1) {
 		if (strbuf_getline(&buf, file, '\n') == EOF)
@@ -78,11 +81,12 @@ static int fetch_with_fetch(struct transport *transport,
 		const struct ref *posn = to_fetch[i];
 		if (posn->status & REF_STATUS_UPTODATE)
 			continue;
-		write_in_full(helper->in, "fetch ", 6);
-		write_in_full(helper->in, sha1_to_hex(posn->old_sha1), 40);
-		write_in_full(helper->in, " ", 1);
-		write_in_full(helper->in, posn->name, strlen(posn->name));
-		write_in_full(helper->in, "\n", 1);
+
+		strbuf_addf(&buf, "fetch %s %s\n",
+			    sha1_to_hex(posn->old_sha1), posn->name);
+		write_in_full(helper->in, buf.buf, buf.len);
+		strbuf_reset(&buf);
+
 		if (strbuf_getline(&buf, file, '\n') == EOF)
 			exit(128); /* child died, message supplied already */
 	}
@@ -119,7 +123,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
 	FILE *file;
 
 	helper = get_helper(transport);
-	write_in_full(helper->in, "list\n", 5);
+
+	strbuf_addstr(&buf, "list\n");
+	write_in_full(helper->in, buf.buf, buf.len);
+	strbuf_reset(&buf);
 
 	file = fdopen(helper->out, "r");
 	while (1) {
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 2/8] Use a function to determine whether a remote is valid
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Currently, it only checks url, but it will allow other things in the future.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 remote.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/remote.c b/remote.c
index c3ada2d..e6f5cd2 100644
--- a/remote.c
+++ b/remote.c
@@ -48,6 +48,11 @@ static int rewrite_nr;
 #define BUF_SIZE (2048)
 static char buffer[BUF_SIZE];
 
+static int valid_remote(const struct remote *remote)
+{
+	return !!remote->url;
+}
+
 static const char *alias_url(const char *url)
 {
 	int i, j;
@@ -667,14 +672,14 @@ struct remote *remote_get(const char *name)
 
 	ret = make_remote(name, 0);
 	if (valid_remote_nick(name)) {
-		if (!ret->url)
+		if (!valid_remote(ret))
 			read_remotes_file(ret);
-		if (!ret->url)
+		if (!valid_remote(ret))
 			read_branches_file(ret);
 	}
-	if (name_given && !ret->url)
+	if (name_given && !valid_remote(ret))
 		add_url_alias(ret, name);
-	if (!ret->url)
+	if (!valid_remote(ret))
 		return NULL;
 	ret->fetch = parse_fetch_refspec(ret->fetch_refspec_nr, ret->fetch_refspec);
 	ret->push = parse_push_refspec(ret->push_refspec_nr, ret->push_refspec);
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 3/8] Allow fetch to modify refs
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

This allows the transport to use the null sha1 for a ref reported to
be present in the remote repository to indicate that a ref exists but
its actual value is presently unknown and will be set if the objects
are fetched.

Also adds documentation to the API to specify exactly what the methods
should do and how they should interpret arguments.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 builtin-clone.c    |    6 ++++--
 transport-helper.c |    4 ++--
 transport.c        |   13 +++++++------
 transport.h        |   41 +++++++++++++++++++++++++++++++++++++++--
 4 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/builtin-clone.c b/builtin-clone.c
index 32dea74..f281756 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -509,8 +509,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 					     option_upload_pack);
 
 		refs = transport_get_remote_refs(transport);
-		if(refs)
-			transport_fetch_refs(transport, refs);
+		if (refs) {
+			struct ref *ref_cpy = copy_ref_list(refs);
+			transport_fetch_refs(transport, ref_cpy);
+		}
 	}
 
 	if (refs) {
diff --git a/transport-helper.c b/transport-helper.c
index cb255e4..a5ac575 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -70,7 +70,7 @@ static int disconnect_helper(struct transport *transport)
 }
 
 static int fetch_with_fetch(struct transport *transport,
-			    int nr_heads, const struct ref **to_fetch)
+			    int nr_heads, struct ref **to_fetch)
 {
 	struct child_process *helper = get_helper(transport);
 	FILE *file = fdopen(helper->out, "r");
@@ -94,7 +94,7 @@ static int fetch_with_fetch(struct transport *transport,
 }
 
 static int fetch(struct transport *transport,
-		 int nr_heads, const struct ref **to_fetch)
+		 int nr_heads, struct ref **to_fetch)
 {
 	struct helper_data *data = transport->data;
 	int i, count;
diff --git a/transport.c b/transport.c
index 6e8a651..6fcdf59 100644
--- a/transport.c
+++ b/transport.c
@@ -204,7 +204,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
 }
 
 static int fetch_objs_via_rsync(struct transport *transport,
-				int nr_objs, const struct ref **to_fetch)
+				int nr_objs, struct ref **to_fetch)
 {
 	struct strbuf buf = STRBUF_INIT;
 	struct child_process rsync;
@@ -408,7 +408,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport, int for_pus
 }
 
 static int fetch_refs_from_bundle(struct transport *transport,
-			       int nr_heads, const struct ref **to_fetch)
+			       int nr_heads, struct ref **to_fetch)
 {
 	struct bundle_transport_data *data = transport->data;
 	return unbundle(&data->header, data->fd);
@@ -486,7 +486,7 @@ static struct ref *get_refs_via_connect(struct transport *transport, int for_pus
 }
 
 static int fetch_refs_via_pack(struct transport *transport,
-			       int nr_heads, const struct ref **to_fetch)
+			       int nr_heads, struct ref **to_fetch)
 {
 	struct git_transport_data *data = transport->data;
 	char **heads = xmalloc(nr_heads * sizeof(*heads));
@@ -917,15 +917,16 @@ const struct ref *transport_get_remote_refs(struct transport *transport)
 	return transport->remote_refs;
 }
 
-int transport_fetch_refs(struct transport *transport, const struct ref *refs)
+int transport_fetch_refs(struct transport *transport, struct ref *refs)
 {
 	int rc;
 	int nr_heads = 0, nr_alloc = 0;
-	const struct ref **heads = NULL;
-	const struct ref *rm;
+	struct ref **heads = NULL;
+	struct ref *rm;
 
 	for (rm = refs; rm; rm = rm->next) {
 		if (rm->peer_ref &&
+		    !is_null_sha1(rm->old_sha1) &&
 		    !hashcmp(rm->peer_ref->old_sha1, rm->old_sha1))
 			continue;
 		ALLOC_GROW(heads, nr_heads + 1, nr_alloc);
diff --git a/transport.h b/transport.h
index 9787fc8..d6aacf6 100644
--- a/transport.h
+++ b/transport.h
@@ -18,11 +18,48 @@ struct transport {
 	int (*set_option)(struct transport *connection, const char *name,
 			  const char *value);
 
+	/**
+	 * Returns a list of the remote side's refs. In order to allow
+	 * the transport to try to share connections, for_push is a
+	 * hint as to whether the ultimate operation is a push or a fetch.
+	 *
+	 * If the transport is able to determine the remote hash for
+	 * the ref without a huge amount of effort, it should store it
+	 * in the ref's old_sha1 field; otherwise it should be all 0.
+	 **/
 	struct ref *(*get_refs_list)(struct transport *transport, int for_push);
-	int (*fetch)(struct transport *transport, int refs_nr, const struct ref **refs);
+
+	/**
+	 * Fetch the objects for the given refs. Note that this gets
+	 * an array, and should ignore the list structure.
+	 *
+	 * If the transport did not get hashes for refs in
+	 * get_refs_list(), it should set the old_sha1 fields in the
+	 * provided refs now.
+	 **/
+	int (*fetch)(struct transport *transport, int refs_nr, struct ref **refs);
+
+	/**
+	 * Push the objects and refs. Send the necessary objects, and
+	 * then, for any refs where peer_ref is set and
+	 * peer_ref->new_sha1 is different from old_sha1, tell the
+	 * remote side to update each ref in the list from old_sha1 to
+	 * peer_ref->new_sha1.
+	 *
+	 * Where possible, set the status for each ref appropriately.
+	 *
+	 * The transport must modify new_sha1 in the ref to the new
+	 * value if the remote accepted the change. Note that this
+	 * could be a different value from peer_ref->new_sha1 if the
+	 * process involved generating new commits.
+	 **/
 	int (*push_refs)(struct transport *transport, struct ref *refs, int flags);
 	int (*push)(struct transport *connection, int refspec_nr, const char **refspec, int flags);
 
+	/** get_refs_list(), fetch(), and push_refs() can keep
+	 * resources (such as a connection) reserved for futher
+	 * use. disconnect() releases these resources.
+	 **/
 	int (*disconnect)(struct transport *connection);
 	char *pack_lockfile;
 	signed verbose : 2;
@@ -73,7 +110,7 @@ int transport_push(struct transport *connection,
 
 const struct ref *transport_get_remote_refs(struct transport *transport);
 
-int transport_fetch_refs(struct transport *transport, const struct ref *refs);
+int transport_fetch_refs(struct transport *transport, struct ref *refs);
 void transport_unlock_pack(struct transport *transport);
 int transport_disconnect(struct transport *transport);
 char *transport_anonymize_url(const char *url);
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 4/8] Allow programs to not depend on remotes having urls
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

For fetch and ls-remote, which use the first url of a remote, have
transport_get() determine this by passing a remote and passing NULL
for the url. For push, which uses every url of a remote, use each url
in turn if there are any, and use NULL if there are none.

This will allow the transport code to do something different if the
location is not specified with a url.

Also, have the message for a fetch say "foreign" if there is no url.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 builtin-fetch.c     |   19 +++++++++++------
 builtin-ls-remote.c |    4 +-
 builtin-push.c      |   54 +++++++++++++++++++++++++++++++++-----------------
 transport.c         |    3 ++
 4 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/builtin-fetch.c b/builtin-fetch.c
index 817dd6b..b51a019 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -346,12 +346,17 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 			what = rm->name;
 		}
 
-		url_len = strlen(url);
-		for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
-			;
-		url_len = i + 1;
-		if (4 < i && !strncmp(".git", url + i - 3, 4))
-			url_len = i - 3;
+		if (url) {
+			url_len = strlen(url);
+			for (i = url_len - 1; url[i] == '/' && 0 <= i; i--)
+				;
+			url_len = i + 1;
+			if (4 < i && !strncmp(".git", url + i - 3, 4))
+				url_len = i - 3;
+		} else {
+			url = "foreign";
+			url_len = strlen(url);
+		}
 
 		note_len = 0;
 		if (*what) {
@@ -663,7 +668,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 	if (!remote)
 		die("Where do you want to fetch from today?");
 
-	transport = transport_get(remote, remote->url[0]);
+	transport = transport_get(remote, NULL);
 	if (verbosity >= 2)
 		transport->verbose = 1;
 	if (verbosity < 0)
diff --git a/builtin-ls-remote.c b/builtin-ls-remote.c
index 78a88f7..4c6fc58 100644
--- a/builtin-ls-remote.c
+++ b/builtin-ls-remote.c
@@ -87,9 +87,9 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
 		}
 	}
 	remote = nongit ? NULL : remote_get(dest);
-	if (remote && !remote->url_nr)
+	if (!nongit && !remote)
 		die("remote %s has no configured URL", dest);
-	transport = transport_get(remote, remote ? remote->url[0] : dest);
+	transport = transport_get(remote, remote ? NULL : dest);
 	if (uploadpack != NULL)
 		transport_set_option(transport, TRANS_OPT_UPLOADPACK, uploadpack);
 
diff --git a/builtin-push.c b/builtin-push.c
index bc0c91a..22dbf61 100644
--- a/builtin-push.c
+++ b/builtin-push.c
@@ -88,6 +88,26 @@ static void setup_default_push_refspecs(void)
 	}
 }
 
+static int push_with_options(struct transport *transport, int flags)
+{
+	int err;
+	if (receivepack)
+		transport_set_option(transport,
+				     TRANS_OPT_RECEIVEPACK, receivepack);
+	if (thin)
+		transport_set_option(transport, TRANS_OPT_THIN, "yes");
+
+	if (flags & TRANSPORT_PUSH_VERBOSE)
+		fprintf(stderr, "Pushing to %s\n", transport->url);
+	err = transport_push(transport, refspec_nr, refspec, flags);
+	err |= transport_disconnect(transport);
+
+	if (!err)
+		return 0;
+
+	return 1;
+}
+
 static int do_push(const char *repo, int flags)
 {
 	int i, errs;
@@ -136,26 +156,22 @@ static int do_push(const char *repo, int flags)
 		url = remote->url;
 		url_nr = remote->url_nr;
 	}
-	for (i = 0; i < url_nr; i++) {
+	if (url_nr) {
+		for (i = 0; i < url_nr; i++) {
+			struct transport *transport =
+				transport_get(remote, url[i]);
+			if (push_with_options(transport, flags)) {
+				error("failed to push some refs to '%s'", url[i]);
+				errs++;
+			}
+		}
+	} else {
 		struct transport *transport =
-			transport_get(remote, url[i]);
-		int err;
-		if (receivepack)
-			transport_set_option(transport,
-					     TRANS_OPT_RECEIVEPACK, receivepack);
-		if (thin)
-			transport_set_option(transport, TRANS_OPT_THIN, "yes");
-
-		if (flags & TRANSPORT_PUSH_VERBOSE)
-			fprintf(stderr, "Pushing to %s\n", url[i]);
-		err = transport_push(transport, refspec_nr, refspec, flags);
-		err |= transport_disconnect(transport);
-
-		if (!err)
-			continue;
-
-		error("failed to push some refs to '%s'", url[i]);
-		errs++;
+			transport_get(remote, NULL);
+		if (push_with_options(transport, flags)) {
+			error("failed to push some refs to foreign system");
+			errs++;
+		}
 	}
 	return !!errs;
 }
diff --git a/transport.c b/transport.c
index 6fcdf59..b21e82e 100644
--- a/transport.c
+++ b/transport.c
@@ -810,6 +810,9 @@ struct transport *transport_get(struct remote *remote, const char *url)
 	struct transport *ret = xcalloc(1, sizeof(*ret));
 
 	ret->remote = remote;
+
+	if (!url && remote && remote->url)
+		url = remote->url[0];
 	ret->url = url;
 
 	if (!prefixcmp(url, "rsync:")) {
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 5/8] Add a config option for remotes to specify a foreign vcs
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Brian Gernhardt

If this is set, the url is not required, and the transport always uses
a helper named "git-remote-<value>".

It is a separate configuration option in order to allow a sensible
configuration for foreign systems which either have no meaningful urls
for repositories or which require urls that do not specify the system
used by the repository at that location. However, this only affects
how the name of the helper is determined, not anything about the
interaction with the helper, and the contruction is such that, if the
foreign scm does happen to use a co-named url method, a url with that
method may be used directly.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Documentation/config.txt |    4 ++++
 remote.c                 |    4 +++-
 remote.h                 |    2 ++
 transport-helper.c       |   14 ++++++++++----
 transport.c              |    5 +++++
 5 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index bcaec0d..f0144b1 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1380,6 +1380,10 @@ remote.<name>.tagopt::
 	Setting this value to \--no-tags disables automatic tag following when
 	fetching from remote <name>
 
+remote.<name>.vcs::
+	Setting this to a value <vcs> will cause git to interact with
+	the remote with the git-remote-<vcs> helper.
+
 remotes.<group>::
 	The list of remotes which are fetched by "git remote update
 	<group>".  See linkgit:git-remote[1].
diff --git a/remote.c b/remote.c
index e6f5cd2..057ac02 100644
--- a/remote.c
+++ b/remote.c
@@ -50,7 +50,7 @@ static char buffer[BUF_SIZE];
 
 static int valid_remote(const struct remote *remote)
 {
-	return !!remote->url;
+	return remote->url || remote->foreign_vcs;
 }
 
 static const char *alias_url(const char *url)
@@ -427,6 +427,8 @@ static int handle_config(const char *key, const char *value, void *cb)
 	} else if (!strcmp(subkey, ".proxy")) {
 		return git_config_string((const char **)&remote->http_proxy,
 					 key, value);
+	} else if (!strcmp(subkey, ".vcs")) {
+		return git_config_string(&remote->foreign_vcs, key, value);
 	}
 	return 0;
 }
diff --git a/remote.h b/remote.h
index 5db8420..ac0ce2f 100644
--- a/remote.h
+++ b/remote.h
@@ -11,6 +11,8 @@ struct remote {
 	const char *name;
 	int origin;
 
+	const char *foreign_vcs;
+
 	const char **url;
 	int url_nr;
 	int url_alloc;
diff --git a/transport-helper.c b/transport-helper.c
index a5ac575..536dd06 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -162,10 +162,16 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
 int transport_helper_init(struct transport *transport)
 {
 	struct helper_data *data = xcalloc(sizeof(*data), 1);
-	char *eom = strchr(transport->url, ':');
-	if (!eom)
-		return -1;
-	data->name = xstrndup(transport->url, eom - transport->url);
+
+	if (transport->remote->foreign_vcs) {
+		data->name = xstrdup(transport->remote->foreign_vcs);
+		transport->url = transport->remote->foreign_vcs;
+	} else {
+		char *eom = strchr(transport->url, ':');
+		if (!eom)
+			return -1;
+		data->name = xstrndup(transport->url, eom - transport->url);
+	}
 
 	transport->data = data;
 	transport->get_refs_list = get_refs_list;
diff --git a/transport.c b/transport.c
index b21e82e..19f330a 100644
--- a/transport.c
+++ b/transport.c
@@ -815,6 +815,11 @@ struct transport *transport_get(struct remote *remote, const char *url)
 		url = remote->url[0];
 	ret->url = url;
 
+	if (remote && remote->foreign_vcs) {
+		transport_helper_init(ret);
+		return ret;
+	}
+
 	if (!prefixcmp(url, "rsync:")) {
 		ret->get_refs_list = get_refs_via_rsync;
 		ret->fetch = fetch_objs_via_rsync;
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 6/8] Add support for "import" helper command
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

This command, supported if the "import" capability is advertized,
allows a helper to support fetching by outputting a git-fast-import
stream.

If both "fetch" and "import" are advertized, git itself will use
"fetch" (although other users may use "import" in this case).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Documentation/git-remote-helpers.txt |   10 ++++++
 transport-helper.c                   |   53 ++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
index 173ee23..e9aa67e 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -43,6 +43,13 @@ Commands are given by the caller on the helper's standard input, one per line.
 +
 Supported if the helper has the "fetch" capability.
 
+'import' <name>::
+	Produces a fast-import stream which imports the current value
+	of the named ref. It may additionally import other refs as
+	needed to construct the history efficiently.
++
+Supported if the helper has the "import" capability.
+
 If a fatal error occurs, the program writes the error message to
 stderr and exits. The caller should expect that a suitable error
 message has been printed if the child closes the connection without
@@ -57,6 +64,9 @@ CAPABILITIES
 'fetch'::
 	This helper supports the 'fetch' command.
 
+'import'::
+	This helper supports the 'import' command.
+
 REF LIST ATTRIBUTES
 -------------------
 
diff --git a/transport-helper.c b/transport-helper.c
index 536dd06..cd85edc 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -11,6 +11,7 @@ struct helper_data
 	const char *name;
 	struct child_process *helper;
 	unsigned fetch : 1;
+	unsigned import : 1;
 };
 
 static struct child_process *get_helper(struct transport *transport)
@@ -50,6 +51,8 @@ static struct child_process *get_helper(struct transport *transport)
 			break;
 		if (!strcmp(buf.buf, "fetch"))
 			data->fetch = 1;
+		if (!strcmp(buf.buf, "import"))
+			data->import = 1;
 	}
 	return data->helper;
 }
@@ -93,6 +96,53 @@ static int fetch_with_fetch(struct transport *transport,
 	return 0;
 }
 
+static int get_importer(struct transport *transport, struct child_process *fastimport)
+{
+	struct helper_data *data = transport->data;
+	struct child_process *helper = get_helper(transport);
+	memset(fastimport, 0, sizeof(*fastimport));
+	fastimport->in = helper->out;
+	fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));
+	fastimport->argv[0] = "fast-import";
+	fastimport->argv[1] = "--quiet";
+
+	fastimport->git_cmd = 1;
+	return start_command(fastimport);
+}
+
+static int fetch_with_import(struct transport *transport,
+			     int nr_heads, struct ref **to_fetch)
+{
+	struct child_process fastimport;
+	struct child_process *helper = get_helper(transport);
+	int i;
+	struct ref *posn;
+	struct strbuf buf = STRBUF_INIT;
+
+	if (get_importer(transport, &fastimport))
+		die("Couldn't run fast-import");
+
+	for (i = 0; i < nr_heads; i++) {
+		posn = to_fetch[i];
+		if (posn->status & REF_STATUS_UPTODATE)
+			continue;
+
+		strbuf_addf(&buf, "import %s\n", posn->name);
+		write_in_full(helper->in, buf.buf, buf.len);
+		strbuf_reset(&buf);
+	}
+	disconnect_helper(transport);
+	finish_command(&fastimport);
+
+	for (i = 0; i < nr_heads; i++) {
+		posn = to_fetch[i];
+		if (posn->status & REF_STATUS_UPTODATE)
+			continue;
+		read_ref(posn->name, posn->old_sha1);
+	}
+	return 0;
+}
+
 static int fetch(struct transport *transport,
 		 int nr_heads, struct ref **to_fetch)
 {
@@ -110,6 +160,9 @@ static int fetch(struct transport *transport,
 	if (data->fetch)
 		return fetch_with_fetch(transport, nr_heads, to_fetch);
 
+	if (data->import)
+		return fetch_with_import(transport, nr_heads, to_fetch);
+
 	return -1;
 }
 
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 7/8] Allow helpers to report in "list" command that the ref is unchanged
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Johannes Schindelin

Helpers may use a line like "? name unchanged" to specify that there
is nothing new at that name, without any git-specific code to
determine the correct response.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Documentation/git-remote-helpers.txt |    4 +++-
 transport-helper.c                   |   22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
index e9aa67e..2c5130f 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -70,7 +70,9 @@ CAPABILITIES
 REF LIST ATTRIBUTES
 -------------------
 
-None are defined yet, but the caller must accept any which are supplied.
+'unchanged'::
+	This ref is unchanged since the last import or fetch, although
+	the helper cannot necessarily determine what value that produced.
 
 Documentation
 -------------
diff --git a/transport-helper.c b/transport-helper.c
index cd85edc..8134ff4 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -166,6 +166,22 @@ static int fetch(struct transport *transport,
 	return -1;
 }
 
+static int has_attribute(const char *attrs, const char *attr) {
+	int len;
+	if (!attrs)
+		return 0;
+
+	len = strlen(attr);
+	for (;;) {
+		const char *space = strchrnul(attrs, ' ');
+		if (len == space - attrs && !strncmp(attrs, attr, len))
+			return 1;
+		if (!*space)
+			return 0;
+		attrs = space + 1;
+	}
+}
+
 static struct ref *get_refs_list(struct transport *transport, int for_push)
 {
 	struct child_process *helper;
@@ -202,6 +218,12 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
 			(*tail)->symref = xstrdup(buf.buf + 1);
 		else if (buf.buf[0] != '?')
 			get_sha1_hex(buf.buf, (*tail)->old_sha1);
+		if (eon) {
+			if (has_attribute(eon + 1, "unchanged")) {
+				(*tail)->status |= REF_STATUS_UPTODATE;
+				read_ref((*tail)->name, (*tail)->old_sha1);
+			}
+		}
 		tail = &((*tail)->next);
 	}
 	strbuf_release(&buf);
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* [PATCH 8/8] Allow helpers to request marks for fast-import
From: Daniel Barkalow @ 2009-08-09 19:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

From: Johan Herland <johan@herland.net>

The 'marks' capability is reported by the remote helper if it requires
the fast-import marks database to loaded/saved by any git-fast-import
process that is provided by the transport machinery. The feature is
advertised along with exactly one argument: the location of the file
containing the marks database.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Documentation/git-remote-helpers.txt |    8 ++++++++
 transport-helper.c                   |   15 +++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-remote-helpers.txt b/Documentation/git-remote-helpers.txt
index 2c5130f..9a3c5bc 100644
--- a/Documentation/git-remote-helpers.txt
+++ b/Documentation/git-remote-helpers.txt
@@ -67,6 +67,14 @@ CAPABILITIES
 'import'::
 	This helper supports the 'import' command.
 
+'marks' filename::
+	Helper requires the marks from a git-fast-import run to be
+	loaded from, and saved to, the given filename. When this
+	"feature" is advertised, each git-fast-import run must load
+	and save the internal marks database (see the --import-marks
+	and --export-marks option to git-fast-import for more details)
+	located at the given filename.
+
 REF LIST ATTRIBUTES
 -------------------
 
diff --git a/transport-helper.c b/transport-helper.c
index 8134ff4..cc99368 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -10,6 +10,8 @@ struct helper_data
 {
 	const char *name;
 	struct child_process *helper;
+
+	char *marks_filename;
 	unsigned fetch : 1;
 	unsigned import : 1;
 };
@@ -53,6 +55,8 @@ static struct child_process *get_helper(struct transport *transport)
 			data->fetch = 1;
 		if (!strcmp(buf.buf, "import"))
 			data->import = 1;
+		if (!prefixcmp(buf.buf, "marks "))
+			data->marks_filename = xstrdup(buf.buf + 6);
 	}
 	return data->helper;
 }
@@ -105,6 +109,15 @@ static int get_importer(struct transport *transport, struct child_process *fasti
 	fastimport->argv = xcalloc(5, sizeof(*fastimport->argv));
 	fastimport->argv[0] = "fast-import";
 	fastimport->argv[1] = "--quiet";
+	if (data->marks_filename) {
+		struct strbuf buf = STRBUF_INIT;
+		strbuf_addf(&buf, "--export-marks=%s", data->marks_filename);
+		fastimport->argv[2] = strbuf_detach(&buf, 0);
+		if (!access(data->marks_filename, R_OK)) {
+			strbuf_addf(&buf, "--import-marks=%s", data->marks_filename);
+			fastimport->argv[3] = strbuf_detach(&buf, 0);
+		}
+	}
 
 	fastimport->git_cmd = 1;
 	return start_command(fastimport);
@@ -133,6 +146,8 @@ static int fetch_with_import(struct transport *transport,
 	}
 	disconnect_helper(transport);
 	finish_command(&fastimport);
+	free((char *) fastimport.argv[2]);
+	free((char *) fastimport.argv[3]);
 
 	for (i = 0; i < nr_heads; i++) {
 		posn = to_fetch[i];
-- 
1.6.4.183.g77eb9.dirty

^ permalink raw reply related

* Re: [PATCH] merge: indicate remote tracking branches in merge message
From: Junio C Hamano @ 2009-08-09 19:36 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20090809100712.GA26250@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> On Sun, Aug 09, 2009 at 06:00:45AM -0400, Jeff King wrote:
>
>>   [1/3] add tests for merge message headings
>>   [2/3] merge: fix incorrect merge message for ambiguous tag/branch
>>   [3/3] merge: indicate remote tracking branches in merge message
>
> And here is the 4/3 you mentioned earlier:
>
> -- >8 --
> Subject: [PATCH] merge: describe tags as such in merge message
>
> Previously, merging a tag directly via "git merge tag" would
> get you the message "Merge commit 'tag'". It is a little
> more descriptive to note that it was actually a tag (i.e.,
> "Merge tag 'tag'").

Maybe "Merge version 'v1.6.3'" or "Merge commit tagged as 'v1.6.3'"? 
I dunno.

^ permalink raw reply

* Re: [PATCH 1/8] Use a clearer style to issue commands to remote helpers
From: Johannes Schindelin @ 2009-08-09 20:17 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.LNX.2.00.0908091526350.27553@iabervon.org>

Hi,

On Sun, 9 Aug 2009, Daniel Barkalow wrote:

> This style is overkill for some commands, but it's worthwhile to use
> the same style to issue all commands, and it's useful to avoid
> open-coding string lengths.
> 
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> ---

Thanks.  I am positively surprised that you did this patch in spite of the 
basis already being in 'next'.

> +	strbuf_addstr(&buf, "capabilities\n");
> +	write_in_full(helper->in, buf.buf, buf.len);
> +	strbuf_reset(&buf);

Hmm.  I think you use the same paradigm three times.  Maybe it is time to 
heed the DRY principle and introduce a helper function?

Maybe something like

void fprintf_in_full(struct strbuf *buf, int fd, const char *format, ...)
{
	va_list ap;

	va_start(ap, format);
	strbuf_reset(buf);
	strbuf_vaddf(buf, format, ap);
	write_in_full(fd, buf->buf, buf->len);
	va_end(ap);
}

But I keep forgetting that there is no strbuf_vaddf() in 'next'... maybe 
it is high time that I forget my promise and re-submit that series?

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH v2] push: point to 'git pull' and 'git push --force' in case of non-fast forward
From: Junio C Hamano @ 2009-08-09 20:22 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Teemu Likonen, git
In-Reply-To: <vpq63cwdee3.fsf@bauges.imag.fr>

Matthieu Moy <Matthieu.Moy@imag.fr> writes:

>> So how about phrasing it like this?
>>
>>     Non-fast forward pushes were rejected because you would discard remote
>>     changes you have not seen.  Integrate them with your changes and then
>>     push again. See 'non-fast forward' section of 'git push --help'.
>
> I thing not pointing to 'git pull' in the message really defeats the
> purpose of the patch. I don't find an error message only telling me
> "go read the doc as you should have done from the beginning" really
> helps.

What the above three lines does much more than that.

If you read "would discard remote changes" and understand that it is what
you want, then you may know to try --force, without having to read the
doc, or if you do not remember --force, "git push --help" would remind
you.

If you read "Integrate them with your changes" and understand that it is
talking about "git pull" or "git pull --rebase", then you do not have to
read the doc.  It should "click".

If you lack such a basic understanding, you are better off go reading the
doc after all.

^ permalink raw reply

* Implementing $Date$ substitution - problem with git status
From: Peter Krefting @ 2009-08-09 19:37 UTC (permalink / raw)
  To: Git List

Hi!

I finally got around to moving my web site repository over from CVS to Git, 
and to not have to redo everything about how it is set up, I set up a filter 
that fakes CVS' handling of "$Date$" keywords. Since I cannot access any 
information about the file from the "smudge" filter, I set up a "clean" 
filter that edits the $Date$ token on "git add":

   #!/usr/bin/perl -wTp -i.bak
   if (/\$Date:?[^\$]*\$/)
   {
     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime();
     my $now = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year + 1900,
                       $mon + 1, $mday, $hour, $min, $sec);
     s/\$Date:?[^\$]*\$/\$Date: ${now} \$/;
   }

In .gitattributes I have lines like:

   *.html filter=date crlf=true ident

and filter.date.clean is set to point to the script above in .git/config.

This works fine, except that I have some problems with files that I cannot 
get to be "clean" in git status. "git diff" shows only a difference in the 
"$Date$" token, which is different each time I run "git diff" (the "+" line 
shows the current time):

   diff --git a/.htaccess b/.htaccess
   index 2dfbc32..d8ac343 100644
   --- a/.htaccess
   +++ b/.htaccess
   @@ -2,7 +2,7 @@
    # -----------------------------------------------------

    # $Id$
   -# $Date: 2009-08-09 19:52:30 $
   +# $Date: 2009-08-09 20:31:56 $
   [...]

Strangely, the $Id$ line above (which is handled by me adding the "ident" 
attribute to all text files), does not exhibit the same problem.

Doing "git reset --hard" or "git checkout master filename" does not help, 
the file is still believed to be modified by git.


Does anyone know if there is a way to get this to work, or am I screwed for 
trying to do things I'm not supposed to? :-)

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply

* Re: [PATCH 5/8] Add a config option for remotes to specify a foreign vcs
From: Johannes Schindelin @ 2009-08-09 20:38 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: Junio C Hamano, git, Brian Gernhardt
In-Reply-To: <alpine.LNX.2.00.0908091526060.27553@iabervon.org>

Hi,

On Sun, 9 Aug 2009, Daniel Barkalow wrote:

> If this is set, the url is not required, and the transport always uses
> a helper named "git-remote-<value>".
> 
> It is a separate configuration option in order to allow a sensible
> configuration for foreign systems which either have no meaningful urls
> for repositories or which require urls that do not specify the system
> used by the repository at that location. However, this only affects
> how the name of the helper is determined, not anything about the
> interaction with the helper, and the contruction is such that, if the
> foreign scm does happen to use a co-named url method, a url with that
> method may be used directly.
> 
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
> ---

Oh well, just try it often enough.  I give up.

Ciao,
Dscho

^ permalink raw reply

* Re: Implementing $Date$ substitution - problem with git status
From: Johannes Sixt @ 2009-08-09 20:52 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git List
In-Reply-To: <alpine.DEB.2.00.0908092127420.17141@perkele.intern.softwolves.pp.se>

On Sonntag, 9. August 2009, Peter Krefting wrote:
> I finally got around to moving my web site repository over from CVS to Git,
> and to not have to redo everything about how it is set up, I set up a
> filter that fakes CVS' handling of "$Date$" keywords. Since I cannot access
> any information about the file from the "smudge" filter, I set up a "clean"
> filter that edits the $Date$ token on "git add":
>
>    #!/usr/bin/perl -wTp -i.bak
>    if (/\$Date:?[^\$]*\$/)
>    {
>      my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(); my $now = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $year +
> 1900, $mon + 1, $mday, $hour, $min, $sec);
>      s/\$Date:?[^\$]*\$/\$Date: ${now} \$/;
>    }
>
> In .gitattributes I have lines like:
>
>    *.html filter=date crlf=true ident
>
> and filter.date.clean is set to point to the script above in .git/config.
>
> This works fine, except that I have some problems with files that I cannot
> get to be "clean" in git status. "git diff" shows only a difference in the
> "$Date$" token, which is different each time I run "git diff" (the "+" line
> shows the current time):
>
>    diff --git a/.htaccess b/.htaccess
>    index 2dfbc32..d8ac343 100644
>    --- a/.htaccess
>    +++ b/.htaccess
>    @@ -2,7 +2,7 @@
>     # -----------------------------------------------------
>
>     # $Id$
>    -# $Date: 2009-08-09 19:52:30 $
>    +# $Date: 2009-08-09 20:31:56 $
>    [...]

The clean filter is applied before 'git diff' generates the diff. Since you 
have unstaged changes (I take [...] to mean this), you see a new date on 
every invocation.

After 'git add .htaccess' subsequent 'git diff' should not show any changes.

> Strangely, the $Id$ line above (which is handled by me adding the "ident"
> attribute to all text files), does not exhibit the same problem.
>
> Doing "git reset --hard" or "git checkout master filename" does not help,
> the file is still believed to be modified by git.

Now, that's an entirely different problem, and I think that there is a bug. I 
have observed this as well with my own clean filter sometimes, but not 
always. I haven't found a recipe that reliably exhibits the problem.

-- Hannes

^ permalink raw reply

* Re: [PATCH 1/8] Use a clearer style to issue commands to remote helpers
From: Daniel Barkalow @ 2009-08-09 21:14 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0908092211030.8306@pacific.mpi-cbg.de>

On Sun, 9 Aug 2009, Johannes Schindelin wrote:

> > +	strbuf_addstr(&buf, "capabilities\n");
> > +	write_in_full(helper->in, buf.buf, buf.len);
> > +	strbuf_reset(&buf);
> 
> Hmm.  I think you use the same paradigm three times.  Maybe it is time to 
> heed the DRY principle and introduce a helper function?
> 
> Maybe something like
> 
> void fprintf_in_full(struct strbuf *buf, int fd, const char *format, ...)
> {
> 	va_list ap;
> 
> 	va_start(ap, format);
> 	strbuf_reset(buf);
> 	strbuf_vaddf(buf, format, ap);
> 	write_in_full(fd, buf->buf, buf->len);
> 	va_end(ap);
> }
> 
> But I keep forgetting that there is no strbuf_vaddf() in 'next'... maybe 
> it is high time that I forget my promise and re-submit that series?

Yup, that's exactly what I started writing, until I ran into the lack of 
strbuf_vaddf() and remembered that there were portability issues I don't 
understand with copying va_lists.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply

* fatal: bad revision 'HEAD'
From: Joel Mahoney @ 2009-08-09 21:15 UTC (permalink / raw)
  To: git

Hello,

I am having trouble installing Ruby on Rails plugins from github.   
when I run e.g. script/install plugin git://github.com/thoughtbot/ 
paperclip.git I get:

 > Initialized empty Git repository in /path/to/my/project/vendor/ 
plugins/paperclip/.git/
 > fatal: bad revision 'HEAD'
 > refusing to pull with rebase: your working tree is not up-to-date

I don't have any problems with git in general, but this error happens  
every time I try to install from github - even when it's a brand new  
rails app.

the github support team tells me it looks like a git issue - any  
suggestions would be appreciated!

thanks,
Joel

^ permalink raw reply

* Re: [PATCH 8/8] Allow helpers to request marks for fast-import
From: Johan Herland @ 2009-08-09 21:25 UTC (permalink / raw)
  To: git; +Cc: Daniel Barkalow, Junio C Hamano, Sverre Rabbelier,
	Shawn O. Pearce
In-Reply-To: <alpine.LNX.2.00.0908091527480.27553@iabervon.org>

On Sunday 09 August 2009, Daniel Barkalow wrote:
> From: Johan Herland <johan@herland.net>
>
> The 'marks' capability is reported by the remote helper if it requires
> the fast-import marks database to loaded/saved by any git-fast-import
> process that is provided by the transport machinery. The feature is
> advertised along with exactly one argument: the location of the file
> containing the marks database.
>
> Signed-off-by: Johan Herland <johan@herland.net>
> Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>

Note that this patch can be dropped if Sverre Rabbelier's suggestion of 
adding an "option" command to fast-import is accepted: 
http://thread.gmane.org/gmane.comp.version-control.git/124655

In that case, the CVS helper (or any other helper) can use the "option" 
fast-import command instead of having to tell transport-helper.c to invoke 
fast-import appropriately. Seems like a somewhat cleaner solution to me...


Have fun!

...Johan

^ permalink raw reply

* Re: [PATCH 8/8] Allow helpers to request marks for fast-import
From: Sverre Rabbelier @ 2009-08-09 21:27 UTC (permalink / raw)
  To: Johan Herland; +Cc: git, Daniel Barkalow, Junio C Hamano, Shawn O. Pearce
In-Reply-To: <200908092325.53040.johan@herland.net>

Heya,

On Sun, Aug 9, 2009 at 14:25, Johan Herland<johan@herland.net> wrote:
> In that case, the CVS helper (or any other helper) can use the "option"
> fast-import command instead of having to tell transport-helper.c to invoke
> fast-import appropriately. Seems like a somewhat cleaner solution to me...

Ah, another use case! I guess I'll go clean up my series and resend it then ;).

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* [PATCH v4 0/5] Re: {checkout,reset,stash} --patch
From: Nicolas Sebrecht @ 2009-08-09 21:28 UTC (permalink / raw)
  To: Thomas Rast
  Cc: Nicolas Sebrecht, Jeff King, git, Junio C Hamano,
	Sverre Rabbelier, Nanako Shiraishi
In-Reply-To: <200908091844.43107.trast@student.ethz.ch>

The 09/08/09, Thomas Rast wrote:
> Nicolas Sebrecht wrote:
> > 
> > Also, I'd expect to have 'git reset --hard -p' discarding hunks from
> > both the index and the WT (which is not possible for now unless I missed
> > something).
> 
> Well, the unfortunate overlap between 'git reset --hard' and 'git
> checkout HEAD -- .' strikes again :-)
> 
> Since you can't say 'git reset --hard -- file', you have to do 'git
> checkout HEAD -- file' to achieve this effect.  So this usage is
> covered by 'git checkout -p HEAD'.

Not exactly:

  Current branch: my_branch (clean)
  nicolas@vidovic git % echo 'hi' > file
  Current branch: my_branch (dirty: untracked:1)
  nicolas@vidovic git % git add file
  Current branch: my_branch (dirty: index)
  nicolas@vidovic git % git checkout -p
  No changes.


Same example with an already tracked file:

  Current branch: my_branch (clean)
  nicolas@vidovic git % echo 'hi Thomas' >> Documentation/SubmittingPatches
  Current branch: my_branch (dirty: working_tree)
  nicolas@vidovic git % git add Documentation/SubmittingPatches
  Current branch: my_branch (dirty: index)
  nicolas@vidovic git % git checkout -p
  No changes.


So, we can discard a hunk from the index with 'git reset -p' without
touching the WT. And we can discard a hunk from the WT with 'git
checkout -p' without touching the index. But we can't discard a hunk
from both the index and the WT.


IOW, we have (from the user POV):

  .git --- (reset -p) ---> index
                           index --- (checkout -p) ---> WT

What's missing:

  .git ------------------ ( ??? ) --------------------> WT

-- 
Nicolas Sebrecht

^ permalink raw reply

* Re: [PATCH 0/8] Foreign VCS helpers
From: Johan Herland @ 2009-08-09 21:31 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git, Junio C Hamano, Johannes Schindelin
In-Reply-To: <alpine.LNX.2.00.0908091525210.27553@iabervon.org>

On Sunday 09 August 2009, Daniel Barkalow wrote:
> This is a replacement for the db/foreign-scm series in pu, now based
> on next. The behavior specified for helpers is the same, so I'm not
> reposting the particular helpers this time.

Thanks. I'll clean up and rebase my CVS series on top of this.

Thanks again for your work. Really appreciated!


Have fun! :)

...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ 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