Git development
 help / color / mirror / Atom feed
* cvs2svn/cvs2git version 2.2.0 has been released
From: Michael Haggerty @ 2008-11-23  9:00 UTC (permalink / raw)
  To: announce, Git Mailing List, mercurial, Bazaar

cvs2svn/cvs2git 2.2.0 has been released.

cvs2svn/cvs2git [1] is a free program that converts CVS repositories to
Subversion, git, Mercurial, or Bazaar, including all project history and
metadata.  cvs2svn can convert just about any CVS repository we've ever
seen, including gcc, Mozilla, FreeBSD, KDE, and GNOME.  Conversion to
the DVCSs is via dumping output in git-fast-import format.

cvs2svn infers what happened in the history of your CVS repository and
replicates that history as accurately as possible in the target SCM.
All revisions, branches, tags, log messages, author names, and commit
dates are converted.  cvs2svn deduces what CVS modifications were made
at the same time, and outputs these modifications grouped together as
changesets in the target SCM.  cvs2svn also deals with many CVS quirks
and is highly configurable.  See the comprehensive feature list [2].


Significant changes in release 2.2.0:

* By default, omit trivial CVS import branches from conversion.

* Allow vendor branches to be excluded (grafting child symbols to
  trunk).

* By default, don't include .cvsignore files in output (except as
  svn:ignore).

* Allow arbitrary SVN directories to be created when a project is
  created.

* cvs2git:
  - Omit the tag fixup branch if a tag can be copied from an existing
    revision.
  - Generate lightweight rather than annotated tags.

* Converting to Mercurial:
  - Add an option to set the maximum number of merge sources per commit.
    (Mercurial only allows a commit to have 0, 1, or 2 ancestors.)
  - Allow file contents to be written inline in git-fast-import streams
    (hg fast-import doesn't support predefined blobs).

* Allow the user to specify templates for cvs2svn-generated log
  messages.

* Fixed a few minor bugs.


For more information, see the latest CHANGES file [3].

You can download the new release here [4].  (Its MD5 checksum is
466b757fdef5378a46bba4ceefd047a4.)

Please send any bug reports and comments to users@cvs2svn.tigris.org.

Michael Haggerty, on behalf of the cvs2svn development team.

[1] http://cvs2svn.tigris.org
[2] http://cvs2svn.tigris.org/features.html
[3]
http://cvs2svn.tigris.org/source/browse/cvs2svn/tags/2.2.0/CHANGES?view=markup
[4]
http://cvs2svn.tigris.org/files/documents/1462/44372/cvs2svn-2.2.0.tar.gz

^ permalink raw reply

* Re: [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir
From: Andreas Ericsson @ 2008-11-23  7:10 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Marcel M. Cary, gitster, git
In-Reply-To: <m31vx3l94x.fsf@localhost.localdomain>

Jakub Narebski wrote:
> "Marcel M. Cary" <marcel@oak.homeunix.org> writes:
> 
>> * Change "git rev-parse --show-cdup" to print a full path instead of
>>   a series of "../" when it prints anything
> 
> But that is contrary to the _name_ of option. It is --show-cdup, as
> in "show cd up". And I think your change will break a few scripts.
> 
> I think you should use "git rev-parse --work-tree" for full path
> to working directory:
> 
>     --show-cdup
>         When the command is invoked from a subdirectory, show the path
>         of the top-level directory relative to the current directory
>         (typically a sequence of "../", or an empty string).
> 

AFAIR, it was introduced to make test-builds of really large projects in
really deep directories with a ton of symlinks leading to the path work a
lot faster.

The thing to remember about git and its UI is that it was evolved from
users' actual needs. Very, very little of what is in the UI can be reworked
without breaking something for someone, so it's (almost) always better to
add a new option. For this, I'd suggest "--show-absolute-worktree-path" if
that's what it does. Since it's an option primarily targeting scripts, I'm
not too worried that it's half a mile long.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply

* [PATCH 3.2/4] daemon: deglobalize variable 'directory'
From: René Scharfe @ 2008-11-22 23:21 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger
In-Reply-To: <4928936D.8010404@lsrfire.ath.cx>

Remove the global variable 'directory' and pass it as a parameter of
the two functions that use it instead, (almost) restoring their
interface to how it was before 49ba83fb67d9e447b86953965ce5f949c6a93b81.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 daemon.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/daemon.c b/daemon.c
index fbf61ca..1cef309 100644
--- a/daemon.c
+++ b/daemon.c
@@ -57,7 +57,6 @@ static char *hostname;
 static char *canon_hostname;
 static char *ip_address;
 static char *tcp_port;
-static char *directory;
 
 static void logreport(int priority, const char *err, va_list params)
 {
@@ -147,7 +146,7 @@ static int avoid_alias(char *p)
 	}
 }
 
-static char *path_ok(void)
+static char *path_ok(char *directory)
 {
 	static char rpath[PATH_MAX];
 	static char interp_path[PATH_MAX];
@@ -296,12 +295,12 @@ static int git_daemon_config(const char *var, const char *value, void *cb)
 	return 0;
 }
 
-static int run_service(struct daemon_service *service)
+static int run_service(char *dir, struct daemon_service *service)
 {
 	const char *path;
 	int enabled = service->enabled;
 
-	loginfo("Request %s for '%s'", service->name, directory);
+	loginfo("Request %s for '%s'", service->name, dir);
 
 	if (!enabled && !service->overridable) {
 		logerror("'%s': service not enabled.", service->name);
@@ -309,7 +308,7 @@ static int run_service(struct daemon_service *service)
 		return -1;
 	}
 
-	if (!(path = path_ok()))
+	if (!(path = path_ok(dir)))
 		return -1;
 
 	/*
@@ -555,8 +554,7 @@ static int execute(struct sockaddr *addr)
 	free(canon_hostname);
 	free(ip_address);
 	free(tcp_port);
-	free(directory);
-	hostname = canon_hostname = ip_address = tcp_port = directory = NULL;
+	hostname = canon_hostname = ip_address = tcp_port = NULL;
 
 	if (len != pktlen)
 		parse_extra_args(line + len + 1, pktlen - len - 1);
@@ -571,9 +569,7 @@ static int execute(struct sockaddr *addr)
 			 * Note: The directory here is probably context sensitive,
 			 * and might depend on the actual service being performed.
 			 */
-			free(directory);
-			directory = xstrdup(line + namelen + 5);
-			return run_service(s);
+			return run_service(line + namelen + 5, s);
 		}
 	}
 
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* [PATCH 3.1/4] daemon: inline fill_in_extra_table_entries()
From: René Scharfe @ 2008-11-22 23:19 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger
In-Reply-To: <49289275.7090003@lsrfire.ath.cx>

Having fill_in_extra_table_entries() as a separate function has no
advantage -- a function with no parameters and return values might as
well be an anonymous block of code.  Its name still refers to the table
of interpolate() which has been removed earlier, so it's better to
inline it at its only call site.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 daemon.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/daemon.c b/daemon.c
index 64f60c4..fbf61ca 100644
--- a/daemon.c
+++ b/daemon.c
@@ -414,6 +414,7 @@ static void parse_extra_args(char *extra_args, int buflen)
 	char *val;
 	int vallen;
 	char *end = extra_args + buflen;
+	char *hp;
 
 	while (extra_args < end && *extra_args) {
 		saw_extended_args = 1;
@@ -438,11 +439,6 @@ static void parse_extra_args(char *extra_args, int buflen)
 			extra_args = val + vallen;
 		}
 	}
-}
-
-static void fill_in_extra_table_entries(void)
-{
-	char *hp;
 
 	/*
 	 * Replace literal host with lowercase-ized hostname.
@@ -562,10 +558,8 @@ static int execute(struct sockaddr *addr)
 	free(directory);
 	hostname = canon_hostname = ip_address = tcp_port = directory = NULL;
 
-	if (len != pktlen) {
+	if (len != pktlen)
 		parse_extra_args(line + len + 1, pktlen - len - 1);
-		fill_in_extra_table_entries();
-	}
 
 	for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
 		struct daemon_service *s = &(daemon_service[i]);
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* [PATCH 4/4] remove the unused files interpolate.c and interpolate.h
From: René Scharfe @ 2008-11-22 23:16 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger
In-Reply-To: <49289275.7090003@lsrfire.ath.cx>

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 Makefile      |    1 -
 interpolate.c |  103 ---------------------------------------------------------
 interpolate.h |   26 --------------
 3 files changed, 0 insertions(+), 130 deletions(-)
 delete mode 100644 interpolate.c
 delete mode 100644 interpolate.h

diff --git a/Makefile b/Makefile
index 35adafa..54e0745 100644
--- a/Makefile
+++ b/Makefile
@@ -437,7 +437,6 @@ LIB_OBJS += grep.o
 LIB_OBJS += hash.o
 LIB_OBJS += help.o
 LIB_OBJS += ident.o
-LIB_OBJS += interpolate.o
 LIB_OBJS += levenshtein.o
 LIB_OBJS += list-objects.o
 LIB_OBJS += ll-merge.o
diff --git a/interpolate.c b/interpolate.c
deleted file mode 100644
index 7f03bd9..0000000
--- a/interpolate.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2006 Jon Loeliger
- */
-
-#include "git-compat-util.h"
-#include "interpolate.h"
-
-
-void interp_set_entry(struct interp *table, int slot, const char *value)
-{
-	char *oldval = table[slot].value;
-	char *newval = NULL;
-
-	free(oldval);
-
-	if (value)
-		newval = xstrdup(value);
-
-	table[slot].value = newval;
-}
-
-
-void interp_clear_table(struct interp *table, int ninterps)
-{
-	int i;
-
-	for (i = 0; i < ninterps; i++) {
-		interp_set_entry(table, i, NULL);
-	}
-}
-
-
-/*
- * Convert a NUL-terminated string in buffer orig
- * into the supplied buffer, result, whose length is reslen,
- * performing substitutions on %-named sub-strings from
- * the table, interps, with ninterps entries.
- *
- * Example interps:
- *    {
- *        { "%H", "example.org"},
- *        { "%port", "123"},
- *        { "%%", "%"},
- *    }
- *
- * Returns the length of the substituted string (not including the final \0).
- * Like with snprintf, if the result is >= reslen, then it overflowed.
- */
-
-unsigned long interpolate(char *result, unsigned long reslen,
-		const char *orig,
-		const struct interp *interps, int ninterps)
-{
-	const char *src = orig;
-	char *dest = result;
-	unsigned long newlen = 0;
-	const char *name, *value;
-	unsigned long namelen, valuelen;
-	int i;
-	char c;
-
-	while ((c = *src)) {
-		if (c == '%') {
-			/* Try to match an interpolation string. */
-			for (i = 0; i < ninterps; i++) {
-				name = interps[i].name;
-				namelen = strlen(name);
-				if (strncmp(src, name, namelen) == 0)
-					break;
-			}
-
-			/* Check for valid interpolation. */
-			if (i < ninterps) {
-				value = interps[i].value;
-				if (!value) {
-					src += namelen;
-					continue;
-				}
-
-				valuelen = strlen(value);
-				if (newlen + valuelen < reslen) {
-					/* Substitute. */
-					memcpy(dest, value, valuelen);
-					dest += valuelen;
-				}
-				newlen += valuelen;
-				src += namelen;
-				continue;
-			}
-		}
-		/* Straight copy one non-interpolation character. */
-		if (newlen + 1 < reslen)
-			*dest++ = *src;
-		src++;
-		newlen++;
-	}
-
-	/* XXX: the previous loop always keep room for the ending NUL,
-	   we just need to check if there was room for a NUL in the first place */
-	if (reslen > 0)
-		*dest = '\0';
-	return newlen;
-}
diff --git a/interpolate.h b/interpolate.h
deleted file mode 100644
index 77407e6..0000000
--- a/interpolate.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2006 Jon Loeliger
- */
-
-#ifndef INTERPOLATE_H
-#define INTERPOLATE_H
-
-/*
- * Convert a NUL-terminated string in buffer orig,
- * performing substitutions on %-named sub-strings from
- * the interpretation table.
- */
-
-struct interp {
-	const char *name;
-	char *value;
-};
-
-extern void interp_set_entry(struct interp *table, int slot, const char *value);
-extern void interp_clear_table(struct interp *table, int ninterps);
-
-extern unsigned long interpolate(char *result, unsigned long reslen,
-				 const char *orig,
-				 const struct interp *interps, int ninterps);
-
-#endif /* INTERPOLATE_H */
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* [PATCH 3/4] daemon: use strbuf_expand() instead of interpolate()
From: René Scharfe @ 2008-11-22 23:15 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger
In-Reply-To: <492891FC.6000908@lsrfire.ath.cx>

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 daemon.c |  109 ++++++++++++++++++++++++++++++-------------------------------
 1 files changed, 54 insertions(+), 55 deletions(-)

diff --git a/daemon.c b/daemon.c
index b9ba44c..64f60c4 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1,7 +1,6 @@
 #include "cache.h"
 #include "pkt-line.h"
 #include "exec_cmd.h"
-#include "interpolate.h"
 
 #include <syslog.h>
 
@@ -54,26 +53,11 @@ static const char *user_path;
 static unsigned int timeout;
 static unsigned int init_timeout;
 
-/*
- * Static table for now.  Ugh.
- * Feel free to make dynamic as needed.
- */
-#define INTERP_SLOT_HOST	(0)
-#define INTERP_SLOT_CANON_HOST	(1)
-#define INTERP_SLOT_IP		(2)
-#define INTERP_SLOT_PORT	(3)
-#define INTERP_SLOT_DIR		(4)
-#define INTERP_SLOT_PERCENT	(5)
-
-static struct interp interp_table[] = {
-	{ "%H", 0},
-	{ "%CH", 0},
-	{ "%IP", 0},
-	{ "%P", 0},
-	{ "%D", 0},
-	{ "%%", 0},
-};
-
+static char *hostname;
+static char *canon_hostname;
+static char *ip_address;
+static char *tcp_port;
+static char *directory;
 
 static void logreport(int priority, const char *err, va_list params)
 {
@@ -163,7 +147,7 @@ static int avoid_alias(char *p)
 	}
 }
 
-static char *path_ok(struct interp *itable)
+static char *path_ok(void)
 {
 	static char rpath[PATH_MAX];
 	static char interp_path[PATH_MAX];
@@ -171,7 +155,7 @@ static char *path_ok(struct interp *itable)
 	char *path;
 	char *dir;
 
-	dir = itable[INTERP_SLOT_DIR].value;
+	dir = directory;
 
 	if (avoid_alias(dir)) {
 		logerror("'%s': aliased", dir);
@@ -201,14 +185,27 @@ static char *path_ok(struct interp *itable)
 		}
 	}
 	else if (interpolated_path && saw_extended_args) {
+		struct strbuf expanded_path = STRBUF_INIT;
+		struct strbuf_expand_dict_entry dict[] = {
+			{ "H", hostname },
+			{ "CH", canon_hostname },
+			{ "IP", ip_address },
+			{ "P", tcp_port },
+			{ "D", directory },
+			{ "%", "%" },
+			{ NULL }
+		};
+
 		if (*dir != '/') {
 			/* Allow only absolute */
 			logerror("'%s': Non-absolute path denied (interpolated-path active)", dir);
 			return NULL;
 		}
 
-		interpolate(interp_path, PATH_MAX, interpolated_path,
-			    interp_table, ARRAY_SIZE(interp_table));
+		strbuf_expand(&expanded_path, interpolated_path,
+				strbuf_expand_dict_cb, &dict);
+		strlcpy(interp_path, expanded_path.buf, PATH_MAX);
+		strbuf_release(&expanded_path);
 		loginfo("Interpolated dir '%s'", interp_path);
 
 		dir = interp_path;
@@ -233,7 +230,7 @@ static char *path_ok(struct interp *itable)
 		 * prefixing the base path
 		 */
 		if (base_path && base_path_relaxed && !retried_path) {
-			dir = itable[INTERP_SLOT_DIR].value;
+			dir = directory;
 			retried_path = 1;
 			continue;
 		}
@@ -299,14 +296,12 @@ static int git_daemon_config(const char *var, const char *value, void *cb)
 	return 0;
 }
 
-static int run_service(struct interp *itable, struct daemon_service *service)
+static int run_service(struct daemon_service *service)
 {
 	const char *path;
 	int enabled = service->enabled;
 
-	loginfo("Request %s for '%s'",
-		service->name,
-		itable[INTERP_SLOT_DIR].value);
+	loginfo("Request %s for '%s'", service->name, directory);
 
 	if (!enabled && !service->overridable) {
 		logerror("'%s': service not enabled.", service->name);
@@ -314,7 +309,7 @@ static int run_service(struct interp *itable, struct daemon_service *service)
 		return -1;
 	}
 
-	if (!(path = path_ok(itable)))
+	if (!(path = path_ok()))
 		return -1;
 
 	/*
@@ -413,9 +408,8 @@ static void make_service_overridable(const char *name, int ena)
 
 /*
  * Separate the "extra args" information as supplied by the client connection.
- * Any resulting data is squirreled away in the given interpolation table.
  */
-static void parse_extra_args(struct interp *table, char *extra_args, int buflen)
+static void parse_extra_args(char *extra_args, int buflen)
 {
 	char *val;
 	int vallen;
@@ -433,9 +427,11 @@ static void parse_extra_args(struct interp *table, char *extra_args, int buflen)
 				if (port) {
 					*port = 0;
 					port++;
-					interp_set_entry(table, INTERP_SLOT_PORT, port);
+					free(tcp_port);
+					tcp_port = xstrdup(port);
 				}
-				interp_set_entry(table, INTERP_SLOT_HOST, host);
+				free(hostname);
+				hostname = xstrdup(host);
 			}
 
 			/* On to the next one */
@@ -444,14 +440,14 @@ static void parse_extra_args(struct interp *table, char *extra_args, int buflen)
 	}
 }
 
-static void fill_in_extra_table_entries(struct interp *itable)
+static void fill_in_extra_table_entries(void)
 {
 	char *hp;
 
 	/*
 	 * Replace literal host with lowercase-ized hostname.
 	 */
-	hp = interp_table[INTERP_SLOT_HOST].value;
+	hp = hostname;
 	if (!hp)
 		return;
 	for ( ; *hp; hp++)
@@ -470,17 +466,17 @@ static void fill_in_extra_table_entries(struct interp *itable)
 		memset(&hints, 0, sizeof(hints));
 		hints.ai_flags = AI_CANONNAME;
 
-		gai = getaddrinfo(interp_table[INTERP_SLOT_HOST].value, 0, &hints, &ai0);
+		gai = getaddrinfo(hostname, 0, &hints, &ai0);
 		if (!gai) {
 			for (ai = ai0; ai; ai = ai->ai_next) {
 				struct sockaddr_in *sin_addr = (void *)ai->ai_addr;
 
 				inet_ntop(AF_INET, &sin_addr->sin_addr,
 					  addrbuf, sizeof(addrbuf));
-				interp_set_entry(interp_table,
-						 INTERP_SLOT_CANON_HOST, ai->ai_canonname);
-				interp_set_entry(interp_table,
-						 INTERP_SLOT_IP, addrbuf);
+				free(canon_hostname);
+				canon_hostname = xstrdup(ai->ai_canonname);
+				free(ip_address);
+				ip_address = xstrdup(addrbuf);
 				break;
 			}
 			freeaddrinfo(ai0);
@@ -493,7 +489,7 @@ static void fill_in_extra_table_entries(struct interp *itable)
 		char **ap;
 		static char addrbuf[HOST_NAME_MAX + 1];
 
-		hent = gethostbyname(interp_table[INTERP_SLOT_HOST].value);
+		hent = gethostbyname(hostname);
 
 		ap = hent->h_addr_list;
 		memset(&sa, 0, sizeof sa);
@@ -504,8 +500,10 @@ static void fill_in_extra_table_entries(struct interp *itable)
 		inet_ntop(hent->h_addrtype, &sa.sin_addr,
 			  addrbuf, sizeof(addrbuf));
 
-		interp_set_entry(interp_table, INTERP_SLOT_CANON_HOST, hent->h_name);
-		interp_set_entry(interp_table, INTERP_SLOT_IP, addrbuf);
+		free(canon_hostname);
+		canon_hostname = xstrdup(hent->h_name);
+		free(ip_address);
+		ip_address = xstrdup(addrbuf);
 	}
 #endif
 }
@@ -557,15 +555,16 @@ static int execute(struct sockaddr *addr)
 		pktlen--;
 	}
 
-	/*
-	 * Initialize the path interpolation table for this connection.
-	 */
-	interp_clear_table(interp_table, ARRAY_SIZE(interp_table));
-	interp_set_entry(interp_table, INTERP_SLOT_PERCENT, "%");
+	free(hostname);
+	free(canon_hostname);
+	free(ip_address);
+	free(tcp_port);
+	free(directory);
+	hostname = canon_hostname = ip_address = tcp_port = directory = NULL;
 
 	if (len != pktlen) {
-	    parse_extra_args(interp_table, line + len + 1, pktlen - len - 1);
-	    fill_in_extra_table_entries(interp_table);
+		parse_extra_args(line + len + 1, pktlen - len - 1);
+		fill_in_extra_table_entries();
 	}
 
 	for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
@@ -578,9 +577,9 @@ static int execute(struct sockaddr *addr)
 			 * Note: The directory here is probably context sensitive,
 			 * and might depend on the actual service being performed.
 			 */
-			interp_set_entry(interp_table,
-					 INTERP_SLOT_DIR, line + namelen + 5);
-			return run_service(interp_table, s);
+			free(directory);
+			directory = xstrdup(line + namelen + 5);
+			return run_service(s);
 		}
 	}
 
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* [PATCH 2/4] merge-recursive: use strbuf_expand() instead of interpolate()
From: René Scharfe @ 2008-11-22 23:13 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger
In-Reply-To: <4928912A.5050307@lsrfire.ath.cx>

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 ll-merge.c        |   21 +++++++++------------
 merge-recursive.c |    1 -
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/ll-merge.c b/ll-merge.c
index 4a71614..fa2ca52 100644
--- a/ll-merge.c
+++ b/ll-merge.c
@@ -8,7 +8,6 @@
 #include "attr.h"
 #include "xdiff-interface.h"
 #include "run-command.h"
-#include "interpolate.h"
 #include "ll-merge.h"
 
 struct ll_merge_driver;
@@ -169,11 +168,12 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
 			int virtual_ancestor)
 {
 	char temp[3][50];
-	char cmdbuf[2048];
-	struct interp table[] = {
-		{ "%O" },
-		{ "%A" },
-		{ "%B" },
+	struct strbuf cmd = STRBUF_INIT;
+	struct strbuf_expand_dict_entry dict[] = {
+		{ "O", temp[0] },
+		{ "A", temp[1] },
+		{ "B", temp[2] },
+		{ NULL }
 	};
 	struct child_process child;
 	const char *args[20];
@@ -189,17 +189,13 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
 	create_temp(src1, temp[1]);
 	create_temp(src2, temp[2]);
 
-	interp_set_entry(table, 0, temp[0]);
-	interp_set_entry(table, 1, temp[1]);
-	interp_set_entry(table, 2, temp[2]);
-
-	interpolate(cmdbuf, sizeof(cmdbuf), fn->cmdline, table, 3);
+	strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
 
 	memset(&child, 0, sizeof(child));
 	child.argv = args;
 	args[0] = "sh";
 	args[1] = "-c";
-	args[2] = cmdbuf;
+	args[2] = cmd.buf;
 	args[3] = NULL;
 
 	status = run_command(&child);
@@ -224,6 +220,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
  bad:
 	for (i = 0; i < 3; i++)
 		unlink(temp[i]);
+	strbuf_release(&cmd);
 	return status;
 }
 
diff --git a/merge-recursive.c b/merge-recursive.c
index 7472d3e..0e988f2 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -16,7 +16,6 @@
 #include "string-list.h"
 #include "xdiff-interface.h"
 #include "ll-merge.h"
-#include "interpolate.h"
 #include "attr.h"
 #include "merge-recursive.h"
 #include "dir.h"
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* [PATCH 1/4] add strbuf_expand_dict_cb(), a helper for simple cases
From: René Scharfe @ 2008-11-22 23:09 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Jon Loeliger

The new callback function strbuf_expand_dict_cb() can be used together
with strbuf_expand() if there is only a small number of placeholders
for static replacement texts.  It expects its dictionary as an array of
placeholder+value pairs as context parameter, terminated by an entry
with the placeholder member set to NULL.

The new helper is intended to aid converting the remaining calls of
interpolate().  strbuf_expand() is smaller, more flexible and can be
used to go faster than interpolate(), so it should replace the latter.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 Documentation/technical/api-strbuf.txt |    7 +++++++
 strbuf.c                               |   16 ++++++++++++++++
 strbuf.h                               |    5 +++++
 3 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt
index a9668e5..519c63b 100644
--- a/Documentation/technical/api-strbuf.txt
+++ b/Documentation/technical/api-strbuf.txt
@@ -205,6 +205,13 @@ In order to facilitate caching and to make it possible to give
 parameters to the callback, `strbuf_expand()` passes a context pointer,
 which can be used by the programmer of the callback as she sees fit.
 
+`strbuf_expand_dict_cb`::
+
+	Used as callback for `strbuf_expand()`, expects an array of
+	struct strbuf_expand_dict_entry as context, i.e. pairs of
+	placeholder and replacement string.  The array needs to be
+	terminated by an entry with placeholder set to NULL.
+
 `strbuf_addf`::
 
 	Add a formatted string to the buffer.
diff --git a/strbuf.c b/strbuf.c
index 720737d..860748f 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -237,6 +237,22 @@ void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn,
 	}
 }
 
+size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder,
+		void *context)
+{
+	struct strbuf_expand_dict_entry *e = context;
+	size_t len;
+
+	for (; e->placeholder && (len = strlen(e->placeholder)); e++) {
+		if (!strncmp(placeholder, e->placeholder, len)) {
+			if (e->value)
+				strbuf_addstr(sb, e->value);
+			return len;
+		}
+	}
+	return 0;
+}
+
 size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
 {
 	size_t res;
diff --git a/strbuf.h b/strbuf.h
index eba7ba4..b1670d9 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -111,6 +111,11 @@ extern void strbuf_adddup(struct strbuf *sb, size_t pos, size_t len);
 
 typedef size_t (*expand_fn_t) (struct strbuf *sb, const char *placeholder, void *context);
 extern void strbuf_expand(struct strbuf *sb, const char *format, expand_fn_t fn, void *context);
+struct strbuf_expand_dict_entry {
+	const char *placeholder;
+	const char *value;
+};
+extern size_t strbuf_expand_dict_cb(struct strbuf *sb, const char *placeholder, void *context);
 
 __attribute__((format(printf,2,3)))
 extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...);
-- 
1.6.0.4.755.g6e139

^ permalink raw reply related

* Re: git commit -v does not removes the patch
From: Junio C Hamano @ 2008-11-22 22:43 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Jeff King, Santi Béjar, Git Mailing List
In-Reply-To: <20081122155541.GC6885@neumann>

SZEDER Gábor <szeder@ira.uka.de> writes:

> So, I wonder whether those '--no-verify' options are still required in
> 'git rebase -i'.

The use of --no-verify there does not have anything to do with "whitespace
errors".  It is to override _any_ validation the users want to do when
using "git commit" in their interactive workflow.  It so happens that the
example hook we ship demonstrates how you hunt for whitespace errors, but
you have to remember that it is just an example.

We may want to disable the checking of exit status from commit-msg hook
while still calling the hook itself, though.  The primary purpose of the
hook is to allow users to reformat (say, passing "fmt -64") the message,
but it is allowed to interfere and that was meant to happen when using
"git commit" but we probably do not want it when rebasing.

Further, we also may want to make the use of --no-verify overridable from
the command line when running rebase.  The primary purpose of the rebase
command is to transplant a sequence of commits to someplace else without
molesting its contents and message unnecessarily, and --no-verify is a
good thing to use in general for that reason, but people may sometimes
want to use it as a way to clean up the changes.

^ permalink raw reply

* Re: [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir
From: Jakub Narebski @ 2008-11-22 21:54 UTC (permalink / raw)
  To: Marcel M. Cary; +Cc: gitster, git
In-Reply-To: <1227389614-10946-1-git-send-email-marcel@oak.homeunix.org>

"Marcel M. Cary" <marcel@oak.homeunix.org> writes:

> * Change "git rev-parse --show-cdup" to print a full path instead of
>   a series of "../" when it prints anything

But that is contrary to the _name_ of option. It is --show-cdup, as
in "show cd up". And I think your change will break a few scripts.

I think you should use "git rev-parse --work-tree" for full path
to working directory:

    --show-cdup
        When the command is invoked from a subdirectory, show the path
        of the top-level directory relative to the current directory
        (typically a sequence of "../", or an empty string).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply

* [PATCH] rev-parse: Fix shell scripts whose cwd is a symlink into a git work-dir
From: Marcel M. Cary @ 2008-11-22 21:33 UTC (permalink / raw)
  To: gitster, git; +Cc: Marcel M. Cary
In-Reply-To: <cover.1226759762.git.marcel@oak.homeunix.org>

* Change "git rev-parse --show-cdup" to print a full path instead of
  a series of "../" when it prints anything
* Added a special case to support some existing scripts that rely
  on --show-cdup's prior behavior of printing a blank line when in
  the work-tree root
* Add some tests for "git rev-parse --show-cdup" in existing scenarios
  and add a symlinked scenario that failed before this fix
* Add a test for "git pull" in a symlinked directory that failed
  before this fix, plus constrasting already working scenarios

Signed-off-by: Marcel M. Cary <marcel@oak.homeunix.org>
---

I suggested use of realpath() but then realized that git seems to
chdir to the work-dir before processing the "--show-cdup" option,
so getcwd() is a simpler option.  

By changing rev-parse instead of cd_to_toplevel, the fix will
help shell scripts that call rev-parse directly as well.  Hopefully
the change from "../" to /full/path/to/work-dir will not be too
disruptive -- no tests fail at least.

 builtin-rev-parse.c     |   25 ++++++++++++-----
 t/t1501-worktree.sh     |   53 ++++++++++++++++++++++++++-----------
 t/t5521-pull-symlink.sh |   67 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+), 23 deletions(-)
 create mode 100755 t/t5521-pull-symlink.sh

diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 81d5a6f..9cf5f82 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -536,14 +536,25 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
 						printf("%s\n", work_tree);
 					continue;
 				}
-				while (pfx) {
-					pfx = strchr(pfx, '/');
-					if (pfx) {
-						pfx++;
-						printf("../");
-					}
+				/*
+				 * An empty line tells some scripts they are at
+				 * the work dir's root.  For example,
+				 * rebase --interactive.
+				 */
+				if (!prefix) {
+					putchar('\n');
+					continue;
 				}
-				putchar('\n');
+				/*
+				 * A full path is less ambiguous than ../ when
+				 * the shell arrived at it's cwd via a symlink.
+				 * Otherwise the shell's "cd" may choose the
+				 * symbolic parent.
+				 */
+				static char cwd[PATH_MAX];
+				if (!getcwd(cwd, PATH_MAX))
+					die("unable to get current working directory");
+				printf("%s\n", cwd);
 				continue;
 			}
 			if (!strcmp(arg, "--git-dir")) {
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index f6a6f83..7e83c81 100755
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
@@ -22,15 +22,35 @@ test_rev_parse() {
 	shift
 	[ $# -eq 0 ] && return
 
+	test_expect_success "$name: cdup" \
+	"test '$1' = \"\$(git rev-parse --show-cdup)\""
+	shift
+	[ $# -eq 0 ] && return
+
 	test_expect_success "$name: prefix" \
 	"test '$1' = \"\$(git rev-parse --show-prefix)\""
 	shift
 	[ $# -eq 0 ] && return
 }
 
+D="$(pwd)"
+
 EMPTY_TREE=$(git write-tree)
-mkdir -p work/sub/dir || exit 1
-mv .git repo.git || exit 1
+mkdir -p repo/sub/dir || exit 1
+ln -s repo/sub/dir lnk || exit 1
+mv .git repo/ || exit 1
+work="$(pwd)/repo"
+cd lnk
+
+say "worktree is parent of symlink"
+test_rev_parse 'symlink'      false false true "$work" sub/dir/
+cd "$D"
+
+
+mv repo/.git repo.git || exit 1
+mv repo work || exit 1
+rm lnk || exit 1
+work="$(pwd)/work"
 
 say "core.worktree = relative path"
 GIT_DIR=repo.git
@@ -38,26 +58,26 @@ GIT_CONFIG="$(pwd)"/$GIT_DIR/config
 export GIT_DIR GIT_CONFIG
 unset GIT_WORK_TREE
 git config core.worktree ../work
-test_rev_parse 'outside'      false false false
+test_rev_parse 'outside'      false false false "$work"
 cd work || exit 1
 GIT_DIR=../repo.git
 GIT_CONFIG="$(pwd)"/$GIT_DIR/config
-test_rev_parse 'inside'       false false true ''
+test_rev_parse 'inside'       false false true '' ''
 cd sub/dir || exit 1
 GIT_DIR=../../../repo.git
 GIT_CONFIG="$(pwd)"/$GIT_DIR/config
-test_rev_parse 'subdirectory' false false true sub/dir/
+test_rev_parse 'subdirectory' false false true "$work" sub/dir/
 cd ../../.. || exit 1
 
 say "core.worktree = absolute path"
 GIT_DIR=$(pwd)/repo.git
 GIT_CONFIG=$GIT_DIR/config
 git config core.worktree "$(pwd)/work"
-test_rev_parse 'outside'      false false false
+test_rev_parse 'outside'      false false false "$work"
 cd work || exit 1
-test_rev_parse 'inside'       false false true ''
+test_rev_parse 'inside'       false false true '' ''
 cd sub/dir || exit 1
-test_rev_parse 'subdirectory' false false true sub/dir/
+test_rev_parse 'subdirectory' false false true "$work" sub/dir/
 cd ../../.. || exit 1
 
 say "GIT_WORK_TREE=relative path (override core.worktree)"
@@ -66,30 +86,31 @@ GIT_CONFIG=$GIT_DIR/config
 git config core.worktree non-existent
 GIT_WORK_TREE=work
 export GIT_WORK_TREE
-test_rev_parse 'outside'      false false false
+test_rev_parse 'outside'      false false false "$work"
 cd work || exit 1
 GIT_WORK_TREE=.
-test_rev_parse 'inside'       false false true ''
+test_rev_parse 'inside'       false false true '' ''
 cd sub/dir || exit 1
 GIT_WORK_TREE=../..
-test_rev_parse 'subdirectory' false false true sub/dir/
+test_rev_parse 'subdirectory' false false true "$work" sub/dir/
 cd ../../.. || exit 1
 
 mv work repo.git/work
+work="$(pwd)/repo.git/work"
 
 say "GIT_WORK_TREE=absolute path, work tree below git dir"
 GIT_DIR=$(pwd)/repo.git
 GIT_CONFIG=$GIT_DIR/config
 GIT_WORK_TREE=$(pwd)/repo.git/work
-test_rev_parse 'outside'              false false false
+test_rev_parse 'outside'              false false false "$work"
 cd repo.git || exit 1
-test_rev_parse 'in repo.git'              false true  false
+test_rev_parse 'in repo.git'              false true  false "$work"
 cd objects || exit 1
-test_rev_parse 'in repo.git/objects'      false true  false
+test_rev_parse 'in repo.git/objects'      false true  false "$work"
 cd ../work || exit 1
-test_rev_parse 'in repo.git/work'         false true true ''
+test_rev_parse 'in repo.git/work'         false true true '' ''
 cd sub/dir || exit 1
-test_rev_parse 'in repo.git/sub/dir' false true true sub/dir/
+test_rev_parse 'in repo.git/sub/dir' false true true "$work" sub/dir/
 cd ../../../.. || exit 1
 
 test_expect_success 'repo finds its work tree' '
diff --git a/t/t5521-pull-symlink.sh b/t/t5521-pull-symlink.sh
new file mode 100755
index 0000000..f18fec7
--- /dev/null
+++ b/t/t5521-pull-symlink.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+test_description='pulling from symlinked subdir'
+
+. ./test-lib.sh
+
+D=`pwd`
+
+# The scenario we are building:
+#
+#   trash\ directory/
+#     clone-repo/
+#       subdir/
+#         bar
+#     subdir-link -> clone-repo/subdir/
+#
+# The working directory is subdir-link.
+#
+test_expect_success setup '
+
+    mkdir subdir &&
+    touch subdir/bar &&
+    git add subdir/bar &&
+    git commit -m empty &&
+    git clone . clone-repo &&
+    # demonstrate that things work without the symlink
+    test_debug "cd clone-repo/subdir/ && git pull; cd ../.." &&
+    ln -s clone-repo/subdir/ subdir-link &&
+    cd subdir-link/ &&
+    test_debug "set +x"
+'
+
+# From subdir-link, pulling should work as it does from
+# clone-repo/subdir/.
+#
+# Instead, the error pull gave was:
+#
+#   fatal: 'origin': unable to chdir or not a git archive
+#   fatal: The remote end hung up unexpectedly
+#
+# because git would find the .git/config for the "trash directory"
+# repo, not for the clone-repo repo.  The "trash directory" repo
+# had no entry for origin.  Git found the wrong .git because
+# git rev-parse --show-cdup printed a path relative to
+# clone-repo/subdir/, not subdir-link/.  Git rev-parse --show-cdup
+# used the correct .git, but when the git pull shell script did
+# "cd `git rev-parse --show-cdup`", it ended up in the wrong
+# directory.  Shell "cd" works a little different from chdir() in C.
+# Bash's "cd -P" works like chdir() in C.
+#
+test_expect_success 'pulling from symlinked subdir' '
+
+    git pull
+'
+
+# Prove that the remote end really is a repo, and other commands
+# work fine in this context.
+#
+test_debug "
+    test_expect_success 'pushing from symlinked subdir' '
+
+        git push
+    '
+"
+cd "$D"
+
+test_done
-- 
1.6.0.3

^ permalink raw reply related

* Re: git commit -v does not removes the patch
From: Jeff King @ 2008-11-22 20:10 UTC (permalink / raw)
  To: SZEDER Gábor; +Cc: Junio C Hamano, Santi Béjar, Git Mailing List
In-Reply-To: <20081122155541.GC6885@neumann>

On Sat, Nov 22, 2008 at 04:55:41PM +0100, SZEDER Gábor wrote:

> Thanks for the tip.  Junio's suggestion about '# Everything under this
> line is deleted.' could be implemented this way fairly easily (just an
> additional echo in prepare-commit-msg, and other pattern in
> commit-msg).  But 'git commit --no-verify' is indeed a problem.
> Although I never use it explicitly, 'git rebase -i' does so.

One other option would be to munge the editor script instead of using
hooks. I.e., something like this:

  $ cat ~/local/bin/git-editor
  #!/bin/sh
  echo '# Everything under this line is deleted' >>"$1"
  git diff --cached >>"$1"
  $EDITOR "$1" || exit $?
  sed -i '/^# Everything under this line is deleted$/Q' "$1"

  $ git config core.editor ~/local/bin/git-editor

Of course, then you end up with the munging for things like "git rebase
-i" picking commits, but it should be harmless (since we end up removing
it anyway).

-Peff

^ permalink raw reply

* [PATCH] Add new testcase to show fast-export does not always exports all tags
From: Miklos Vajna @ 2008-11-22 18:22 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <20081122022913.GC4746@genesis.frugalware.org>

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

Here is a testcase for the bug I mentioned.

 t/t9301-fast-export.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh
index 6ddd7c1..078832f 100755
--- a/t/t9301-fast-export.sh
+++ b/t/t9301-fast-export.sh
@@ -231,4 +231,15 @@ test_expect_success 'fast-export -C -C | fast-import' '
 
 '
 
+test_expect_failure 'fast-export | fast-import when master is tagged' '
+
+	git tag -m msg last &&
+	rm -rf new &&
+	mkdir new &&
+	git --git-dir=new/.git init &&
+	git fast-export -C -C --signed-tags=strip --all > output &&
+	test $(grep -c "^tag" output) = 3
+
+'
+
 test_done
-- 
1.6.0.4.770.gf38d.dirty

^ permalink raw reply related

* Re: git commit -v does not removes the patch
From: SZEDER Gábor @ 2008-11-22 15:55 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, Santi Béjar, Git Mailing List
In-Reply-To: <20081120152015.GA6283@coredump.intra.peff.net>

Hi Jeff,

On Thu, Nov 20, 2008 at 10:20:16AM -0500, Jeff King wrote:
> On Thu, Nov 20, 2008 at 02:09:28PM +0100, SZEDER Gábor wrote:

> Hmm. I am sad that this change has broken somebody's existing workflow.
> OTOH, I'm not convinced that workflow wasn't a little crazy to begin
> with, depending on this undocumented munging.

Well, the docs didn't say that the patch is only removed in verbose
mode (;  But I agree with you that this is (was) an undocumented
"feature" that I should not have relied upon.

> > So, what is the/is there a preferred way to always include the diff in
> > the commit message template and get it removed automatically?  Are
> > there any workarounds other than revert that commit locally?
> 
> How about:
> 
>     $ cat .git/hooks/prepare-commit-msg
>     #!/bin/sh
>     git diff --cached >>"$1"
> 
>     $ cat .git/hooks/commit-msg
>     #!/bin/sh
>     sed -i '/^diff --git/Q' "$1"
> 
> which is more or less the original behavior. The only downside I see is
> that "--no-verify" will turn off the commit-msg hook, but not the
> prepare-commit-msg hook.

Thanks for the tip.  Junio's suggestion about '# Everything under this
line is deleted.' could be implemented this way fairly easily (just an
additional echo in prepare-commit-msg, and other pattern in
commit-msg).  But 'git commit --no-verify' is indeed a problem.
Although I never use it explicitly, 'git rebase -i' does so.

However.

'git rebase -i' uses 'git commit --no-verify' since c5b09feb (Avoid
update hook during git-rebase --interactive, 2007-12-19) to avoid
squashing commits together when the pre-commit hook fails because of
whitespace errors.  But note that at that time the 'git commit'
calls looked like this (after that patch):

  $USE_OUTPUT git commit --no-verify -F "$MSG" $EDIT_COMMIT
  git commit --no-verify -F "$DOTEST"/message -e

Witness that it's not checked whether 'git commit' succeeded or
failed.
However, nowadays those lines look like this:

  $USE_OUTPUT git commit --no-verify $MSG_OPT "$MSG_FILE" $EDIT_COMMIT || failed=t
  git commit --no-verify -F "$DOTEST"/message -e || { ...

There is a check for failed 'git commit', so if the pre-commit hook
finds whitespace errors, then 'git commit' will error out, and,
consequently, 'git rebase -i' will error out, too, and commits won't
be squashed accidentaly.

So, I wonder whether those '--no-verify' options are still required in
'git rebase -i'.

Any thoughts?

Thanks,
Gábor

^ permalink raw reply

* Re: [Announce] teamgit-0.0.8 receipies preperations
From: Sverre Rabbelier @ 2008-11-22 14:57 UTC (permalink / raw)
  To: Abhijit Bhopatkar; +Cc: git
In-Reply-To: <2fcfa6df0811220602p103a51e8l6fdf2401b270240f@mail.gmail.com>

On Sat, Nov 22, 2008 at 15:02, Abhijit Bhopatkar <bain@devslashzero.com> wrote:
> This menu is constructed on the fly parsing output of 'git help --all'
> Then when you click on a menu item it issues git help <command> ,
> parses the manpage and presents its options in a guified form.
> It even display nice tooltips describing the option.

Whoah, looking at the screenshot, that's pretty awesome! Maybe I
should start keeping an eye on this project ;).

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* [Announce] teamgit-0.0.8 receipies preperations
From: Abhijit Bhopatkar @ 2008-11-22 14:02 UTC (permalink / raw)
  To: git

hi ppl,

teamGit is a functional git gui written in qt, its ultimate aim is to
add functionality
on top of git targeted at small closely nit teams.

I have tagged the repo with v0.0.8!!!
You can now get the .deb from ubuntu intrepid ppa
deb http://ppa.launchpad.net/bain-devslashzero/ubuntu intrepid main
package name is teamgit.
The main project website is http://www.devslashzero.com/teamgit

There are many small changes and feature adds
you can take a look at repo here
http://gitorious.org/projects/teamgit/repos/mainline

The major feature add however is addition on **Advanced** menu.

This menu is constructed on the fly parsing output of 'git help --all'
Then when you click on a menu item it issues git help <command> ,
parses the manpage and presents its options in a guified form.
It even display nice tooltips describing the option.

This is just a first stage of the planned feature. Ultimately this advanced
menu will be just a 'Admin' feature.
People will be able to save the selected options and parameters as 'Receipies'
and can cook a nice receipes package particular to their needs/organisations.

The feature is not really complete yet, but you can issue simple
commands using it.
Ther _are_bugs_ but i couldn't wait to showcase this nifty feature.

Check out the screenshot
http://www.devslashzero.com/images/teamgitscreenshots/screenshot-teamgit22nov.png

Abhijit Bhopaktar

^ permalink raw reply

* Re: How to setup a public reposistory?
From: Andreas Ericsson @ 2008-11-22 11:12 UTC (permalink / raw)
  To: garyyang6; +Cc: git
In-Reply-To: <354563.49837.qm@web37901.mail.mud.yahoo.com>

Gary Yang wrote:
> I followed the steps outlined by the links below. But, I am still not able to setup the public repository. I got, fatal: unable to connect a socket (Connection refused). What I did wrong? Please help.
> 
> http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#setting-up-a-public-repository
> http://dtcsupport.gplhost.com/Git/Public-Repo-Howto
> 
> 0. Prepare your name and email address
> cat ~gyang/.gitconfig
> [user]
>         email = gyang@mycompany.com
>         name = Gary Yang
> 
> 
> 1. Create an archive to send to the server
> 
> /home/gyang% git clone http://git.gplhost.com/dtc-xen.git
> 
> /home/gyang% git clone --bare dtc-xen dtc-xen.git
> 
> /home/gyang% touch dtc-xen.git/git-daemon-export-ok
> 
> /home/gyang% tar -cvzf dtc-xen.git.tar.gz dtc-xen.git
> 
> 
> 2. Install the archive on the web server
> 
> /pub/git% tar -xvzf /home/gyang/dtc-xen.git.tar.gz
> 
> /pub/git/dtc-xen.git% git --bare update-server-info
> 
> /pub/git/dtc-xen.git% mv hooks/post-update.sample hooks/post-update
> 
> /pub/git/dtc-xen.git% chmod +x hooks/post-update
> 
> /pub/git/dtc-xen.git% cat hooks/post-update
> #!/bin/sh
> #
> # An example hook script to prepare a packed repository for use over
> # dumb transports.
> #
> # To enable this hook, rename this file to "post-update".
> 
> exec git-update-server-info
> 
> 
> 3. Configure and start git daemon at the web server
> 
> /pub/git/dtc-xen.git% grep 9418 /etc/services
> git             9418/tcp                        # Git Version Control System
> 
> 
> /pub/git/dtc-xen.git% sudo git daemon --verbose --inetd --export-all /pub/git &
> 

You shouldn't give "--inetd" when starting from command line. Do like this:

  sudo git daemon --detach --verbose --export-all --base-path=/pub/git

Then clone dtc-xen.git using the following command:

  git clone git://git.mycompany.com/dtc-xen.git test-git

> 
> 4. At my local machine. I did
> 
> /home/gyang% git clone git://git.mycompany.com/pub/git/dtc-xen.git test-git
> 
> Initialized empty Git repository in //home/gyang/test-git/.git/
> git.mycompany.com[0: 10.66.4.168]: errno=Connection refused
> fatal: unable to connect a socket (Connection refused)
> 
> 
> ps -efww | grep git
> root      9626 22321  0 11:31 pts/1    00:00:00 git-daemon --verbose --inetd --export-all /pub/git
> 

Yes, it's waiting for input from stdin, which is what "--inetd" does to a
process. Do what I told you above and it'll work just grand.


For further troubleshooting, here are some things to try before asking
about git-daemon again:

ping git.mycompany.com
  # should show reasonable response times

nc git.mycompany.com 9418
  # should give "connection refused", or there's a bug somewhere

ip=$(host git.mycompany.com | sed -n 's/.*has address //p'); echo $ip
  # should list the proper ip address

ssh root@git.mycompany.com "ip addr show | grep 'inet $ip'"
  # should list one ip-address

ssh root@git.mycompany.com "ps -efww | grep git-daemon"
  # should list one process

ssh root@git.mycompany.com "netstat -tpan | grep 0.0.0.0:9418"
  # should list the git-daemon

ssh root@git.mycompany.com "grep git-daemon /var/log/messages"
  # might show error messages from git-daemon

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply

* git fast-export problem with tags
From: Miklos Vajna @ 2008-11-22  2:29 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git

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

Hi Johannes,

It seems in some cases the tag messages of annotated tags are not
exported. Here is a reproducer:

git init
echo a > file
git add file
git commit -m i
git tag -a -m "one dot zero" 1.0

Now the output of 'git fast-export --all' does not contain the "one dot
zero" message.

But if you go a bit futher and make master point to a commit different
to the tag:

echo b > file
git add file
git commit -m b

then the output of 'git fast-export --all' clearly has it.

Is this a bug or have I missed something? ;-)

Thanks.

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

^ permalink raw reply

* Re: git-status for submodules
From: Junio C Hamano @ 2008-11-22  0:55 UTC (permalink / raw)
  To: Chris Frey; +Cc: git
In-Reply-To: <20081121224247.GB27049@foursquare.net>

Chris Frey <cdfrey@foursquare.net> writes:

> It's true that subproject X has to be able to stand on its own.  That
> is important from git's perspective as well as for managing subprojects
> in general.
>
> But I don't see the advantage in hiding submodule information from the
> supermodule, and if that hiding is by design, I think the design is wrong.

There is no "wrong" design in git.  There are ones that do not cover 360
degrees of the field, because nobody designed out let alone coded to cover
such use cases.

> In order to manage the various modules effectively (actually, in order to
> manage any git repo effectively), you need to know what's changed,
> and git-status is the way to do that.  I don't see why submodules should
> break that.

Changes to parts of submodules are fundamentally different from changes to
parts of your main project.  A change to what commit the superproject
wants for a submodule is at the same level as a change to what content the
superprojects wants for a blob.

It is not unreasonable to want to have both modes of operation, one that
shows the uncommitted details in the submodule even when you are viewing
from the superproject (which does not exist), and one that does not (which
does exist, because somebody felt need for it and coded so).

In order to see the status of your working tree, you may want to take into
account what untracked files are in there, but some people do not want to,
so there is an option to pick which behaviour you want.  We would need a
similar switch.

> With the new submodule foreach command, though, it should be possible
> to add that as a config option, similar to the way submodule summary
> is handled now.  Maybe I can cook up a patch for that.

Yup, that's the spirit.

^ permalink raw reply

* Re: why no "git fetch --dry-run" ?
From: Junio C Hamano @ 2008-11-22  0:40 UTC (permalink / raw)
  To: SLONIK.AZ; +Cc: Git Mailing List
In-Reply-To: <ee2a733e0811211341j1e49fad7o64577605951fa5c0@mail.gmail.com>

"Leo Razoumov" <slonik.az@gmail.com> writes:

> I am curious why there is "git push --dry-run" and no "git fetch
> --dry-run" nor "git pull --dry-run". It would make sense to keep
> push/pull/fetch as symmetric as possible.

There are things that are not implemented in git because they do not make
sense, and there are things that are not implemented in git because nobody
had itch to scratch for.  To put it differently, we tend to implement only
things that there are actual, demonstrated needs for from real world and
only when the addition makes sense as a coherent part of the system.

"fetch --dry-run" falls into the latter category.

"push" is hard to undo because it affects the outside world, but "fetch"
is only about your local object store and its remote tracking branches, so
the need to have --dry-run mode to "push" was much more real than to the
need for "fetch --dry-run" and was implemented.

If you have the itch for the latter, I do not think anybody objects to it
on the ground that such a feature does not make sense.

Having said that, "fetch --dry-run" probably has little value in practice.
You cannot tell how much data will be transferred before actually running
a fetch, so it won't be a tool for you to decide if you can afford the
time to run fetch now or do that later ("push --dry-run" will let you gain
the necessary information for doing this this if your push is
fast-forward, which should mostly be the case).  The only information you
would get is if an actual "fetch" will have any update to each of the
branches you are tracking (so that's one bit per branch) and if you have a
connection to the other end, and that is about it.

^ permalink raw reply

* Re: why no "git fetch --dry-run" ?
From: Baz @ 2008-11-21 23:14 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Leo Razoumov, Git Mailing List
In-Reply-To: <20081121221826.GM21815@genesis.frugalware.org>

2008/11/21 Miklos Vajna <vmiklos@frugalware.org>:
> On Fri, Nov 21, 2008 at 04:41:57PM -0500, Leo Razoumov <slonik.az@gmail.com> wrote:
>> I am curious why there is "git push --dry-run" and no "git fetch
>> --dry-run" nor "git pull --dry-run". It would make sense to keep
>> push/pull/fetch as symmetric as possible.
>> For example, I just want to see which branches, if any, changed on a
>> remote repository since my last fetch. "git fetch -v --dry-run" would
>> be handy in this case.
>
> Actually fetch - at a core level - isn't symmetric to push, the protocol
> is completely different. I haven't checked the source, but I suppose
> that the push protocol has "dry run" support, while the fetch one
> doesn't have.
>

I wrote the patch for "push --dry-run" because I was more worried
about messing up the central repository (which I can't fix) than
messing up my local repository (which I can). It just needed a few
checks added to send-pack to make it work. I guess it's not been done
for fetch yet because nobody had that itch, shouldn't be too hard to
write. Certainly, other people have asked for it.

-Baz

^ permalink raw reply

* Re: git-status for submodules
From: Chris Frey @ 2008-11-21 22:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vabbtqga8.fsf@gitster.siamese.dyndns.org>

On Fri, Nov 21, 2008 at 06:56:15AM -0800, Junio C Hamano wrote:
> My understanding is that this is exactly by design.  The supermodule
> tracks which commit in the subproject is bound to the tree location.


> the submodule support is geared toward supporting this layout:
> 
> 	- "super" has a subproject X at "sub"
> 
>         - When you do a real work on the subproject X, you do so as if
>           there is no supermodule.  IOW, subproject X has to be able to
>           stand on its own.

It's true that subproject X has to be able to stand on its own.  That
is important from git's perspective as well as for managing subprojects
in general.

But I don't see the advantage in hiding submodule information from the
supermodule, and if that hiding is by design, I think the design is wrong.
In order to manage the various modules effectively (actually, in order to
manage any git repo effectively), you need to know what's changed,
and git-status is the way to do that.  I don't see why submodules should
break that.

With the new submodule foreach command, though, it should be possible
to add that as a config option, similar to the way submodule summary
is handled now.  Maybe I can cook up a patch for that.

- Chris

^ permalink raw reply

* Re: why no "git fetch --dry-run" ?
From: Miklos Vajna @ 2008-11-21 22:18 UTC (permalink / raw)
  To: Leo Razoumov; +Cc: Git Mailing List
In-Reply-To: <ee2a733e0811211341j1e49fad7o64577605951fa5c0@mail.gmail.com>

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

On Fri, Nov 21, 2008 at 04:41:57PM -0500, Leo Razoumov <slonik.az@gmail.com> wrote:
> I am curious why there is "git push --dry-run" and no "git fetch
> --dry-run" nor "git pull --dry-run". It would make sense to keep
> push/pull/fetch as symmetric as possible.
> For example, I just want to see which branches, if any, changed on a
> remote repository since my last fetch. "git fetch -v --dry-run" would
> be handy in this case.

Actually fetch - at a core level - isn't symmetric to push, the protocol
is completely different. I haven't checked the source, but I suppose
that the push protocol has "dry run" support, while the fetch one
doesn't have.

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

^ permalink raw reply

* Re: git-status for submodules
From: Chris Frey @ 2008-11-21 21:56 UTC (permalink / raw)
  To: Johan Herland; +Cc: git, Junio C Hamano
In-Reply-To: <200811211627.10637.johan@herland.net>

On Fri, Nov 21, 2008 at 04:27:10PM +0100, Johan Herland wrote:
> Chris' workflow is farily easily supported by running git-status within 
> each submodule, like this:
> 
> git submodule foreach "git status; true"
> 
> If the above is too cumbersome to type, one can easily wrap an alias 
> around it:
> 
> git config alias.substatus 'submodule foreach "git status; true"'
> git substatus

Fascinating. :-)  This is not yet released, I see, but thanks very much.

Looking at the git sources, submodule foreach doesn't seem to recurse,
for the nested submodule case Junio mentioned.  It's still a good start.

- Chris

^ permalink raw reply

* why no "git fetch --dry-run" ?
From: Leo Razoumov @ 2008-11-21 21:41 UTC (permalink / raw)
  To: Git Mailing List

Hello List,
I am curious why there is "git push --dry-run" and no "git fetch
--dry-run" nor "git pull --dry-run". It would make sense to keep
push/pull/fetch as symmetric as possible.
For example, I just want to see which branches, if any, changed on a
remote repository since my last fetch. "git fetch -v --dry-run" would
be handy in this case.

--Leo--

^ 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