Git development
 help / color / mirror / Atom feed
* Re: git checkout -b origin/mybranch origin/mybranch
From: Sverre Rabbelier @ 2009-03-12 11:40 UTC (permalink / raw)
  To: John Tapsell; +Cc: Git List
In-Reply-To: <43d8ce650903120436u261cb7e3p838e4a12e7b54d7d@mail.gmail.com>

Heya,

On Thu, Mar 12, 2009 at 12:36, John Tapsell <johnflux@gmail.com> wrote:
>  git complained that they need to specify the name with -b.  So they did:
>
> git checkout -b origin/somebranch origin/somebranch

Slight unrelated, do they know about -t?

$ git checkout -t origin/somebranch

It will automagically create a branch named 'somebranch' tracking
'origin/somebranch'!

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* Re: Deleting remote branch pointed by remote HEAD
From: Jeff King @ 2009-03-12 11:39 UTC (permalink / raw)
  To: Felipe Contreras
  Cc: Daniel Barkalow, Michael J Gruber, Marc-André Lureau, git
In-Reply-To: <94a0d4530903120202w22f1f8ecwc6b4d22652afc427@mail.gmail.com>

On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:

> >>   git remote set-default $foo <name>
> [...]
> > I think that would be reasonable behavior (and probably a special mode
> > for set-default to just update from the remote's idea of HEAD).
> 
> Nobody is working on this, right?

Jay has a number of improvements to "git remote" in next, including
this. See 104a914 (Merge branch 'js/remote-improvements' into next,
2009-03-05). Especially bc14fac (builtin-remote: add set-head
subcommand, 2009-02-25).

-Peff

^ permalink raw reply

* git checkout -b origin/mybranch origin/mybranch
From: John Tapsell @ 2009-03-12 11:36 UTC (permalink / raw)
  To: Git List

Hey all,

  One of my collegues did:

git checkout origin/somebranch

  git complained that they need to specify the name with -b.  So they did:

git checkout -b origin/somebranch origin/somebranch

  Git accepts this with no problems, but boy - all hell broke loose.
Doing a push or pull gave errors, because "origin/somebranch" is now
ambigous (since there is two of them).  They can't even:  "git
checkout -b somebranch origin/somebranch"  anymore, since
"origin/somebranch" is ambigous.  It all got into a mess.

  I've sort it out now, but I'd like to request that git doesn't so
easily let the user shoot themselves in the foot.

  I propose that creating a branch called  "origin/*" or "remotes/*"
gives at _least_ a warning, and preferably an error (overrideable with
--force for people who really really want to do it)

John Tapsell

^ permalink raw reply

* Re: [PATCH] Introduce a filter-path argument to git-daemon, for doing custom path transformations
From: Johannes Schindelin @ 2009-03-12 11:29 UTC (permalink / raw)
  To: Johan Sørensen; +Cc: git
In-Reply-To: <1236852820-12980-1-git-send-email-johan@johansorensen.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4612 bytes --]

Hi,

Disclaimer: if you are offended by constructive criticism, or likely to
answer with insults to the comments I offer, please stop reading this mail
now (and please do not answer my mail, either). :-)

Still with me?  Good.  Nice to meet you.

Just for the record: responding to a patch is my strongest way of saying
that I appreciate your work.

On Thu, 12 Mar 2009, Johan Sørensen wrote:

> The parameter for filter-path is an executable that will receive the 
> service name, the client hostname and path to the repos the client 
> requests as as arguments. It is then the responsibility of the script to 
> return a zero terminated string on its stdout with the real path of the 
> target repository.
> ---

A sign-off is missing...

More importantly, you might want to point out the security concerns of 
running a script with the full permissions of git-daemon.  (AFAICT from 
your patch you are not dropping any privileges at any point.)

Which brings me to another idea: we have quite a few places in Git where 
we use regular expressions.  Would they not be enough for your use case?

> diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
> index 36f00ae..efd1687 100644
> --- a/Documentation/git-daemon.txt
> +++ b/Documentation/git-daemon.txt
> @@ -71,6 +72,18 @@ OPTIONS
>  	After interpolation, the path is validated against the directory
>  	whitelist.
>  
> +--path-filter=executable::
> +	To support a more flexible directory layout a path filter script 
> +	can be used. The executable will receive the service name (upload-pack, 
> +	upload-archive or receive-pack), the client hostname and the request git 
> +	directory as arguments. The executable must return a zero-terminated string
> +	on stdout which is the real path 'git-daemon' should serve. This is useful
> +	when --interpolated-path doesn't buy you enough flexibility. You could for
> +	instance keep support for old clone urls if you rename your repository, or
> +	fetch a custom url-mapping from a third-party repo manager application, or
> +	map deeply nested repository directories to a more sensible layout for the 
> +	outside world.

Please keep the lines shorter than 81 characters.

> diff --git a/daemon.c b/daemon.c
> index d93cf96..e6777c6 100644
> --- a/daemon.c
> +++ b/daemon.c
> @@ -287,6 +293,37 @@ static int git_daemon_config(const char *var, const char *value, void *cb)
>  	return 0;
>  }
>  
> +static char *run_path_filter_script(struct daemon_service *s, char *host, char *dir) {

Again, pretty long line.  (I will refrain from saying that for every long 
line, but please cooperate by pretending I did ;-)

But there is more: what about concurrent accesses?

> +	char result[256]; /* arbitary */

Why not PATH_MAX?

> +	char *real_path;
> +	struct child_process filter_cmd;
> +	const char *args[] = { path_filter_script, s->name, host, dir, NULL };
> +
> +	loginfo("Executing path filter script: '%s %s'", path_filter_script, dir);
> +	memset(&filter_cmd, 0, sizeof(filter_cmd));
> +	filter_cmd.argv = args;
> +	filter_cmd.out = -1;
> +	
> +	if (start_command(&filter_cmd)) {
> +		logerror("path filter: unable to fork path_filter_script");
> +		return NULL;
> +	}
> +	
> +	read(filter_cmd.out, result, sizeof(result) - 1);

No error checking?

BTW we do have strbuf_read(), which would solve your "static char *" 
problem nicely.

> +	close(filter_cmd.out);
> +	if (finish_command(&filter_cmd)) {
> +		logerror("path filter died with strange error");
> +		return NULL;
> +	}
> +
> +	if (result) {
> +		real_path = result;
> +		return real_path;
> +	}
> +	return NULL;

What would be the difference if you wrote

	return result;

instead?

> @@ -495,6 +532,7 @@ static void parse_extra_args(char *extra_args, int buflen)
>  static int execute(struct sockaddr *addr)
>  {
>  	static char line[1000];
> +	char *path;

Is it not rather "const char *"?  But that point would be moot should you 
decide to use strbufs.

> @@ -553,11 +591,20 @@ static int execute(struct sockaddr *addr)
>  		if (!prefixcmp(line, "git-") &&
>  		    !strncmp(s->name, line + 4, namelen) &&
>  		    line[namelen + 4] == ' ') {
> +			path = line + namelen + 5;
> +			if (path_filter_script) {
> +				loginfo("path_filter_script %s for path %s", path_filter_script, path);
> +				char *tdir;

Declaration after a call to a function.

> +				if ((tdir = run_path_filter_script(s, hostname, path))) {
> +					path = tdir;
> +				}

Unnecessary curly brackets.

And your code would be even easier to read if your 
run_path_filter_script() would never return NULL, but the unchanged path 
instead.

Ciao,
Dscho

^ permalink raw reply

* Re: git doc build failure on OS X 10.5.6 (Leopard) during xmlto  phase
From: Michael J Gruber @ 2009-03-12 11:17 UTC (permalink / raw)
  To: Alejandro Riveira; +Cc: git, Jay Soffian, Tom Holaday
In-Reply-To: <gp95vf$gp1$1@ger.gmane.org>

Alejandro Riveira venit, vidit, dixit 11.03.2009 21:12:
> El Wed, 11 Mar 2009 17:27:28 +0100, Michael J Gruber escribió:
> 
>> Jay Soffian venit, vidit, dixit 11.03.2009 16:49:
>>> j.
>> FWIW: The effect you describe (which is different from the OP) occurs on
>> Fedora 10 as well, and not only for git man pages, also for others. I've
>> been meaning to look into this, just like I've been meaning to look into
>> so much stuff...
>>
>  "Me too" from a Ubuntu 8.10 Box

Following up on this:
On Fedora 10, I have asciidoc 8.2.5 and docbook 1.7.4 xsl's. For proper
man and html doc, I have to set DOCBOOK_XSL_172=Yes but leave ASCIIDOC8
unset! I always forget, though (just like the packagers).

Setting DOCBOOK_XSL_172 shuts off a certain hack which would otherwise
introduce the notorious .ft in man output.

Setting ASCIIDOC8 would keep _emphasis_ from being transformed into
<emphasis>emphasis</emphasis>, which means it would end up as literal
_emphasis_ in man as well as html.

Michael

BTW: Alejandro, please don't cull cc here.

^ permalink raw reply

* Re: Generalised bisection
From: Johannes Schindelin @ 2009-03-12 10:55 UTC (permalink / raw)
  To: John Tapsell; +Cc: Ealdwulf Wuffinga, Christian Couder, Git List, Ingo Molnar
In-Reply-To: <43d8ce650903112345x3d40b70ap7e4c0f8c7d0b6069@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 803 bytes --]

Hi,

On Thu, 12 Mar 2009, John Tapsell wrote:

> 2009/3/11 Ealdwulf Wuffinga <ealdwulf@googlemail.com>:
> > [John will get this twice, sorry; not used to this mail interface yet.]
> >
> > On Wed, Mar 11, 2009 at 9:35 AM, John Tapsell <johnflux@gmail.com> wrote:
> >
> >> mpmath might be the more annoying dependency - what functions do you
> >> use from it?  Could they trivially be reimplemented?
> >
> > What I use is the multiprecision floating point number class. doubles
> > don't seem to be long enough.
> 
> Hmm, really really?  Sometimes this sort of thing can be fixed by just 
> readjusting the formulas.  What formulas are you using that require more 
> precision than doubles?

Maybe you could post the formulae instead of forcing people to deduct them 
from the source code?

Thanks,
Dscho

^ permalink raw reply

* Re: [RFC/PATCH] git push usability improvements and default change
From: Miles Bader @ 2009-03-12 10:52 UTC (permalink / raw)
  To: Finn Arne Gangstad; +Cc: Nanako Shiraishi, Junio C Hamano, git
In-Reply-To: <20090312102243.GA27665@pvv.org>

Finn Arne Gangstad <finnag@pvv.org> writes:
> The main problem with all these examples is that the underlying
> assumption is that you can always use the same branch name locally and
> remotely.

Presumably the push --track option would be used with an explicit branch
name given to push anyway, right?  Then it can use that info to set up
the tracking flexibly (and with sane defaults).

E.g.,, simple case:

    git push --track SOME_REMOTE BRANCH_NAME

complex case:

    git push --track SOME_REMOTE MY-BRANCH:REMOTE-BRANCH

-Miles

-- 
=====
(^o^;
(()))
*This is the cute octopus virus, please copy it into your sig so it can spread.

^ permalink raw reply

* [PATCH]  Removed static variables in blame for catering reuse of blame code
From: pi song @ 2009-03-12 10:30 UTC (permalink / raw)
  To: git, gitster; +Cc: rene.scharfe

The patch refactors builtin-blame.c to not rely on static variables 
so that blame code can later be reused in different context.

This is the first patch toward making grep --blame, based on the latest "next" branch.

Signed-off-by: Pi Song <pi.songs@gmail.com>
---
 builtin-blame.c |  386 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 214 insertions(+), 172 deletions(-)

diff --git a/builtin-blame.c b/builtin-blame.c
index 2aedd17..2e19ddf 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -30,42 +30,29 @@ static const char *blame_opt_usage[] = {
 	NULL
 };
 
-static int longest_file;
-static int longest_author;
-static int max_orig_digits;
-static int max_digits;
-static int max_score_digits;
-static int show_root;
-static int reverse;
-static int blank_boundary;
-static int incremental;
-static int xdl_opts = XDF_NEED_MINIMAL;
-
-static enum date_mode blame_date_mode = DATE_ISO8601;
-static size_t blame_date_width;
-
-static struct string_list mailmap;
+/* only use for command line parameter parsing */
+static unsigned opt_blame_move_score;
+static unsigned opt_blame_copy_score;
 
 #ifndef DEBUG
 #define DEBUG 0
 #endif
 
-/* stats */
-static int num_read_blob;
-static int num_get_patch;
-static int num_commits;
+/* 
+ * for storing stats. it can be used
+ * across multiple blame operations
+ */
+struct blame_stat {
+        int num_read_blob;
+        int num_get_patch;
+        int num_commits;
+};
 
 #define PICKAXE_BLAME_MOVE		01
 #define PICKAXE_BLAME_COPY		02
 #define PICKAXE_BLAME_COPY_HARDER	04
 #define PICKAXE_BLAME_COPY_HARDEST	010
 
-/*
- * blame for a blame_entry with score lower than these thresholds
- * is not passed to the parent using move/copy logic.
- */
-static unsigned blame_move_score;
-static unsigned blame_copy_score;
 #define BLAME_DEFAULT_MOVE_SCORE	20
 #define BLAME_DEFAULT_COPY_SCORE	40
 
@@ -86,56 +73,6 @@ struct origin {
 };
 
 /*
- * Given an origin, prepare mmfile_t structure to be used by the
- * diff machinery
- */
-static void fill_origin_blob(struct origin *o, mmfile_t *file)
-{
-	if (!o->file.ptr) {
-		enum object_type type;
-		num_read_blob++;
-		file->ptr = read_sha1_file(o->blob_sha1, &type,
-					   (unsigned long *)(&(file->size)));
-		if (!file->ptr)
-			die("Cannot read blob %s for path %s",
-			    sha1_to_hex(o->blob_sha1),
-			    o->path);
-		o->file = *file;
-	}
-	else
-		*file = o->file;
-}
-
-/*
- * Origin is refcounted and usually we keep the blob contents to be
- * reused.
- */
-static inline struct origin *origin_incref(struct origin *o)
-{
-	if (o)
-		o->refcnt++;
-	return o;
-}
-
-static void origin_decref(struct origin *o)
-{
-	if (o && --o->refcnt <= 0) {
-		if (o->previous)
-			origin_decref(o->previous);
-		free(o->file.ptr);
-		free(o);
-	}
-}
-
-static void drop_origin_blob(struct origin *o)
-{
-	if (o->file.ptr) {
-		free(o->file.ptr);
-		o->file.ptr = NULL;
-	}
-}
-
-/*
  * Each group of lines is described by a blame_entry; it can be split
  * as we pass blame to the parents.  They form a linked list in the
  * scoreboard structure, sorted by the target line number.
@@ -176,6 +113,47 @@ struct blame_entry {
 };
 
 /*
+ * stores things that survive across multiple blame operations
+ * 1) for blame specific global parameters
+ * 2) for reusable structures (possibly for optimization purpose)
+ */
+struct super_scoreboard {
+	/* 
+	 * miscellaneous parameters collected during processing
+	 * for pretty formatting purpose
+	 */
+	int longest_file;
+	int longest_author;
+	int max_orig_digits;
+	int max_digits;
+	int max_score_digits;
+
+	/* formatting parameters */
+	int show_root;
+	int reverse;
+	int blank_boundary;
+	int incremental;
+	int xdl_opts;
+
+	/*
+	 * blame for a blame_entry with score lower than these thresholds
+	 * is not passed to the parent using move/copy logic.
+	 */
+	unsigned blame_move_score;
+	unsigned blame_copy_score;
+
+	/* date formatting related */
+	enum date_mode blame_date_mode;
+	size_t blame_date_width;
+
+	/* for fast mailmap lookup */
+	struct string_list mailmap;
+
+	/* for stat collecting purpose */
+	struct blame_stat *stat;
+};
+
+/*
  * The current state of the blame assignment.
  */
 struct scoreboard {
@@ -198,8 +176,61 @@ struct scoreboard {
 	/* look-up a line in the final buffer */
 	int num_lines;
 	int *lineno;
+
+	/* super scoreboard */
+	struct super_scoreboard *ssb ;
 };
 
+/*
+ * Given an origin, prepare mmfile_t structure to be used by the
+ * diff machinery
+ */
+static void fill_origin_blob(struct scoreboard *sb, struct origin *o, mmfile_t *file)
+{
+	if (!o->file.ptr) {
+		enum object_type type;
+		sb->ssb->stat->num_read_blob++;
+		file->ptr = read_sha1_file(o->blob_sha1, &type,
+					   (unsigned long *)(&(file->size)));
+		if (!file->ptr)
+			die("Cannot read blob %s for path %s",
+			    sha1_to_hex(o->blob_sha1),
+			    o->path);
+		o->file = *file;
+	}
+	else
+		*file = o->file;
+}
+
+/*
+ * Origin is refcounted and usually we keep the blob contents to be
+ * reused.
+ */
+static inline struct origin *origin_incref(struct origin *o)
+{
+	if (o)
+		o->refcnt++;
+	return o;
+}
+
+static void origin_decref(struct origin *o)
+{
+	if (o && --o->refcnt <= 0) {
+		if (o->previous)
+			origin_decref(o->previous);
+		free(o->file.ptr);
+		free(o);
+	}
+}
+
+static void drop_origin_blob(struct origin *o)
+{
+	if (o->file.ptr) {
+		free(o->file.ptr);
+		o->file.ptr = NULL;
+	}
+}
+
 static inline int same_suspect(struct origin *a, struct origin *b)
 {
 	if (a == b)
@@ -731,12 +762,12 @@ static int pass_blame_to_parent(struct scoreboard *sb,
 	if (last_in_target < 0)
 		return 1; /* nothing remains for this target */
 
-	fill_origin_blob(parent, &file_p);
-	fill_origin_blob(target, &file_o);
-	num_get_patch++;
+	fill_origin_blob(sb, parent, &file_p);
+	fill_origin_blob(sb, target, &file_o);
+	sb->ssb->stat->num_get_patch++;
 
 	memset(&xpp, 0, sizeof(xpp));
-	xpp.flags = xdl_opts;
+	xpp.flags = sb->ssb->xdl_opts;
 	memset(&xecfg, 0, sizeof(xecfg));
 	xecfg.ctxlen = 0;
 	xdi_diff_hunks(&file_p, &file_o, blame_chunk_cb, &d, &xpp, &xecfg);
@@ -887,7 +918,7 @@ static void find_copy_in_blob(struct scoreboard *sb,
 	 * file_p partially may match that image.
 	 */
 	memset(&xpp, 0, sizeof(xpp));
-	xpp.flags = xdl_opts;
+	xpp.flags = sb->ssb->xdl_opts;
 	memset(&xecfg, 0, sizeof(xecfg));
 	xecfg.ctxlen = 1;
 	memset(split, 0, sizeof(struct blame_entry [3]));
@@ -912,7 +943,7 @@ static int find_move_in_parent(struct scoreboard *sb,
 	if (last_in_target < 0)
 		return 1; /* nothing remains for this target */
 
-	fill_origin_blob(parent, &file_p);
+	fill_origin_blob(sb, parent, &file_p);
 	if (!file_p.ptr)
 		return 0;
 
@@ -921,11 +952,11 @@ static int find_move_in_parent(struct scoreboard *sb,
 		made_progress = 0;
 		for (e = sb->ent; e; e = e->next) {
 			if (e->guilty || !same_suspect(e->suspect, target) ||
-			    ent_score(sb, e) < blame_move_score)
+			    ent_score(sb, e) < sb->ssb->blame_move_score)
 				continue;
 			find_copy_in_blob(sb, e, parent, split, &file_p);
 			if (split[1].suspect &&
-			    blame_move_score < ent_score(sb, &split[1])) {
+			    sb->ssb->blame_move_score < ent_score(sb, &split[1])) {
 				split_blame(sb, split, e);
 				made_progress = 1;
 			}
@@ -998,7 +1029,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
 	struct blame_list *blame_list;
 	int num_ents;
 
-	blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
+	blame_list = setup_blame_list(sb, target, sb->ssb->blame_copy_score, &num_ents);
 	if (!blame_list)
 		return 1; /* nothing remains for this target */
 
@@ -1053,7 +1084,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
 
 			norigin = get_origin(sb, parent, p->one->path);
 			hashcpy(norigin->blob_sha1, p->one->sha1);
-			fill_origin_blob(norigin, &file_p);
+			fill_origin_blob(sb, norigin, &file_p);
 			if (!file_p.ptr)
 				continue;
 
@@ -1070,7 +1101,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
 		for (j = 0; j < num_ents; j++) {
 			struct blame_entry *split = blame_list[j].split;
 			if (split[1].suspect &&
-			    blame_copy_score < ent_score(sb, &split[1])) {
+			    sb->ssb->blame_copy_score < ent_score(sb, &split[1])) {
 				split_blame(sb, split, blame_list[j].ent);
 				made_progress = 1;
 			}
@@ -1082,7 +1113,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
 
 		if (!made_progress)
 			break;
-		blame_list = setup_blame_list(sb, target, blame_copy_score, &num_ents);
+		blame_list = setup_blame_list(sb, target, sb->ssb->blame_copy_score, &num_ents);
 		if (!blame_list) {
 			retval = 1;
 			break;
@@ -1122,17 +1153,21 @@ static void pass_whole_blame(struct scoreboard *sb,
  * "parent" (and "porigin"), but what we mean is to find scapegoat to
  * exonerate ourselves.
  */
-static struct commit_list *first_scapegoat(struct rev_info *revs, struct commit *commit)
+static struct commit_list *first_scapegoat(struct scoreboard *sb, 
+					   struct rev_info *revs, 
+					   struct commit *commit)
 {
-	if (!reverse)
+	if (!sb->ssb->reverse)
 		return commit->parents;
 	return lookup_decoration(&revs->children, &commit->object);
 }
 
-static int num_scapegoats(struct rev_info *revs, struct commit *commit)
+static int num_scapegoats(struct scoreboard *sb,
+			  struct rev_info *revs, 
+			  struct commit *commit)
 {
 	int cnt;
-	struct commit_list *l = first_scapegoat(revs, commit);
+	struct commit_list *l = first_scapegoat(sb, revs, commit);
 	for (cnt = 0; l; l = l->next)
 		cnt++;
 	return cnt;
@@ -1149,7 +1184,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
 	struct origin *sg_buf[MAXSG];
 	struct origin *porigin, **sg_origin = sg_buf;
 
-	num_sg = num_scapegoats(revs, commit);
+	num_sg = num_scapegoats(sb, revs, commit);
 	if (!num_sg)
 		goto finish;
 	else if (num_sg < ARRAY_SIZE(sg_buf))
@@ -1166,7 +1201,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
 				       struct commit *, struct origin *);
 		find = pass ? find_rename : find_origin;
 
-		for (i = 0, sg = first_scapegoat(revs, commit);
+		for (i = 0, sg = first_scapegoat(sb, revs, commit);
 		     i < num_sg && sg;
 		     sg = sg->next, i++) {
 			struct commit *p = sg->item;
@@ -1198,8 +1233,8 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
 		}
 	}
 
-	num_commits++;
-	for (i = 0, sg = first_scapegoat(revs, commit);
+	sb->ssb->stat->num_commits++;
+	for (i = 0, sg = first_scapegoat(sb, revs, commit);
 	     i < num_sg && sg;
 	     sg = sg->next, i++) {
 		struct origin *porigin = sg_origin[i];
@@ -1217,7 +1252,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
 	 * Optionally find moves in parents' files.
 	 */
 	if (opt & PICKAXE_BLAME_MOVE)
-		for (i = 0, sg = first_scapegoat(revs, commit);
+		for (i = 0, sg = first_scapegoat(sb, revs, commit);
 		     i < num_sg && sg;
 		     sg = sg->next, i++) {
 			struct origin *porigin = sg_origin[i];
@@ -1231,7 +1266,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
 	 * Optionally find copies from parents' files.
 	 */
 	if (opt & PICKAXE_BLAME_COPY)
-		for (i = 0, sg = first_scapegoat(revs, commit);
+		for (i = 0, sg = first_scapegoat(sb, revs, commit);
 		     i < num_sg && sg;
 		     sg = sg->next, i++) {
 			struct origin *porigin = sg_origin[i];
@@ -1274,8 +1309,8 @@ struct commit_info
 /*
  * Parse author/committer line in the commit object buffer
  */
-static void get_ac_line(const char *inbuf, const char *what,
-			int person_len, char *person,
+static void get_ac_line(struct scoreboard *sb, const char *inbuf, 
+			const char *what, int person_len, char *person,
 			int mail_len, char *mail,
 			unsigned long *time, const char **tz)
 {
@@ -1323,7 +1358,7 @@ static void get_ac_line(const char *inbuf, const char *what,
 	maillen = timepos - tmp;
 	memcpy(mail, mailpos, maillen);
 
-	if (!mailmap.nr)
+	if (!sb->ssb->mailmap.nr)
 		return;
 
 	/*
@@ -1338,7 +1373,7 @@ static void get_ac_line(const char *inbuf, const char *what,
 	/*
 	 * Now, convert both name and e-mail using mailmap
 	 */
-	if(map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
+	if(map_user(&sb->ssb->mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
 		/* Add a trailing '>' to email, since map_user returns plain emails
 		   Note: It already has '<', since we replace from mail+1 */
 		mailpos = memchr(mail, '\0', mail_len);
@@ -1349,7 +1384,8 @@ static void get_ac_line(const char *inbuf, const char *what,
 	}
 }
 
-static void get_commit_info(struct commit *commit,
+static void get_commit_info(struct scoreboard *sb,
+			    struct commit *commit,
 			    struct commit_info *ret,
 			    int detailed)
 {
@@ -1378,7 +1414,7 @@ static void get_commit_info(struct commit *commit,
 	message   = reencoded ? reencoded : commit->buffer;
 	ret->author = author_name;
 	ret->author_mail = author_mail;
-	get_ac_line(message, "\nauthor ",
+	get_ac_line(sb, message, "\nauthor ",
 		    sizeof(author_name), author_name,
 		    sizeof(author_mail), author_mail,
 		    &ret->author_time, &ret->author_tz);
@@ -1390,7 +1426,7 @@ static void get_commit_info(struct commit *commit,
 
 	ret->committer = committer_name;
 	ret->committer_mail = committer_mail;
-	get_ac_line(message, "\ncommitter ",
+	get_ac_line(sb, message, "\ncommitter ",
 		    sizeof(committer_name), committer_name,
 		    sizeof(committer_mail), committer_mail,
 		    &ret->committer_time, &ret->committer_tz);
@@ -1430,7 +1466,8 @@ static void write_filename_info(const char *path)
  * commit.  Instead of repeating this every line, emit it only once,
  * the first time each commit appears in the output.
  */
-static int emit_one_suspect_detail(struct origin *suspect)
+static int emit_one_suspect_detail(struct scoreboard *sb, 
+				   struct origin *suspect)
 {
 	struct commit_info ci;
 
@@ -1438,7 +1475,7 @@ static int emit_one_suspect_detail(struct origin *suspect)
 		return 0;
 
 	suspect->commit->object.flags |= METAINFO_SHOWN;
-	get_commit_info(suspect->commit, &ci, 1);
+	get_commit_info(sb, suspect->commit, &ci, 1);
 	printf("author %s\n", ci.author);
 	printf("author-mail %s\n", ci.author_mail);
 	printf("author-time %lu\n", ci.author_time);
@@ -1462,18 +1499,18 @@ static int emit_one_suspect_detail(struct origin *suspect)
  * The blame_entry is found to be guilty for the range.  Mark it
  * as such, and show it in incremental output.
  */
-static void found_guilty_entry(struct blame_entry *ent)
+static void found_guilty_entry(struct scoreboard *sb, struct blame_entry *ent)
 {
 	if (ent->guilty)
 		return;
 	ent->guilty = 1;
-	if (incremental) {
+	if (sb->ssb->incremental) {
 		struct origin *suspect = ent->suspect;
 
 		printf("%s %d %d %d\n",
 		       sha1_to_hex(suspect->commit->object.sha1),
 		       ent->s_lno + 1, ent->lno + 1, ent->num_lines);
-		emit_one_suspect_detail(suspect);
+		emit_one_suspect_detail(sb, suspect);
 		write_filename_info(suspect->path);
 		maybe_flush_or_die(stdout, "stdout");
 	}
@@ -1508,7 +1545,7 @@ static void assign_blame(struct scoreboard *sb, int opt)
 		commit = suspect->commit;
 		if (!commit->object.parsed)
 			parse_commit(commit);
-		if (reverse ||
+		if (sb->ssb->reverse ||
 		    (!(commit->object.flags & UNINTERESTING) &&
 		     !(revs->max_age != -1 && commit->date < revs->max_age)))
 			pass_blame(sb, suspect, opt);
@@ -1518,13 +1555,13 @@ static void assign_blame(struct scoreboard *sb, int opt)
 				mark_parents_uninteresting(commit);
 		}
 		/* treat root commit as boundary */
-		if (!commit->parents && !show_root)
+		if (!commit->parents && !sb->ssb->show_root)
 			commit->object.flags |= UNINTERESTING;
 
 		/* Take responsibility for the remaining entries */
 		for (ent = sb->ent; ent; ent = ent->next)
 			if (same_suspect(ent->suspect, suspect))
-				found_guilty_entry(ent);
+				found_guilty_entry(sb, ent);
 		origin_decref(suspect);
 
 		if (DEBUG) /* sanity */
@@ -1532,8 +1569,8 @@ static void assign_blame(struct scoreboard *sb, int opt)
 	}
 }
 
-static const char *format_time(unsigned long time, const char *tz_str,
-			       int show_raw_time)
+static const char *format_time(struct scoreboard *sb, unsigned long time, 
+			       const char *tz_str, int show_raw_time)
 {
 	static char time_buf[128];
 	const char *time_str;
@@ -1545,10 +1582,10 @@ static const char *format_time(unsigned long time, const char *tz_str,
 	}
 	else {
 		tz = atoi(tz_str);
-		time_str = show_date(time, tz, blame_date_mode);
+		time_str = show_date(time, tz, sb->ssb->blame_date_mode);
 		time_len = strlen(time_str);
 		memcpy(time_buf, time_str, time_len);
-		memset(time_buf + time_len, ' ', blame_date_width - time_len);
+		memset(time_buf + time_len, ' ', sb->ssb->blame_date_width - time_len);
 	}
 	return time_buf;
 }
@@ -1576,7 +1613,7 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent)
 	       ent->s_lno + 1,
 	       ent->lno + 1,
 	       ent->num_lines);
-	if (emit_one_suspect_detail(suspect) ||
+	if (emit_one_suspect_detail(sb, suspect) ||
 	    (suspect->commit->object.flags & MORE_THAN_ONE_PATH))
 		write_filename_info(suspect->path);
 
@@ -1605,7 +1642,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 	char hex[41];
 	int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
 
-	get_commit_info(suspect->commit, &ci, 1);
+	get_commit_info(sb, suspect->commit, &ci, 1);
 	strcpy(hex, sha1_to_hex(suspect->commit->object.sha1));
 
 	cp = nth_line(sb, ent->lno);
@@ -1614,7 +1651,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 		int length = (opt & OUTPUT_LONG_OBJECT_NAME) ? 40 : 8;
 
 		if (suspect->commit->object.flags & UNINTERESTING) {
-			if (blank_boundary)
+			if (sb->ssb->blank_boundary)
 				memset(hex, ' ', length);
 			else if (!(opt & OUTPUT_ANNOTATE_COMPAT)) {
 				length--;
@@ -1625,31 +1662,31 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
 		printf("%.*s", length, hex);
 		if (opt & OUTPUT_ANNOTATE_COMPAT)
 			printf("\t(%10s\t%10s\t%d)", ci.author,
-			       format_time(ci.author_time, ci.author_tz,
-					   show_raw_time),
+			       format_time(sb, ci.author_time, 
+					   ci.author_tz, show_raw_time),
 			       ent->lno + 1 + cnt);
 		else {
 			if (opt & OUTPUT_SHOW_SCORE)
 				printf(" %*d %02d",
-				       max_score_digits, ent->score,
+				       sb->ssb->max_score_digits, ent->score,
 				       ent->suspect->refcnt);
 			if (opt & OUTPUT_SHOW_NAME)
-				printf(" %-*.*s", longest_file, longest_file,
-				       suspect->path);
+				printf(" %-*.*s", sb->ssb->longest_file,
+						  sb->ssb->longest_file, suspect->path);
 			if (opt & OUTPUT_SHOW_NUMBER)
-				printf(" %*d", max_orig_digits,
+				printf(" %*d", sb->ssb->max_orig_digits,
 				       ent->s_lno + 1 + cnt);
 
 			if (!(opt & OUTPUT_NO_AUTHOR)) {
-				int pad = longest_author - utf8_strwidth(ci.author);
+				int pad = sb->ssb->longest_author - utf8_strwidth(ci.author);
 				printf(" (%s%*s %10s",
 				       ci.author, pad, "",
-				       format_time(ci.author_time,
+				       format_time(sb, ci.author_time,
 						   ci.author_tz,
 						   show_raw_time));
 			}
 			printf(" %*d) ",
-			       max_digits, ent->lno + 1 + cnt);
+			       sb->ssb->max_digits, ent->lno + 1 + cnt);
 		}
 		do {
 			ch = *cp++;
@@ -1773,14 +1810,14 @@ static void find_alignment(struct scoreboard *sb, int *option)
 		if (strcmp(suspect->path, sb->path))
 			*option |= OUTPUT_SHOW_NAME;
 		num = strlen(suspect->path);
-		if (longest_file < num)
-			longest_file = num;
+		if (sb->ssb->longest_file < num)
+			sb->ssb->longest_file = num;
 		if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
 			suspect->commit->object.flags |= METAINFO_SHOWN;
-			get_commit_info(suspect->commit, &ci, 1);
+			get_commit_info(sb, suspect->commit, &ci, 1);
 			num = utf8_strwidth(ci.author);
-			if (longest_author < num)
-				longest_author = num;
+			if (sb->ssb->longest_author < num)
+				sb->ssb->longest_author = num;
 		}
 		num = e->s_lno + e->num_lines;
 		if (longest_src_lines < num)
@@ -1791,9 +1828,9 @@ static void find_alignment(struct scoreboard *sb, int *option)
 		if (largest_score < ent_score(sb, e))
 			largest_score = ent_score(sb, e);
 	}
-	max_orig_digits = lineno_width(longest_src_lines);
-	max_digits = lineno_width(longest_dst_lines);
-	max_score_digits = lineno_width(largest_score);
+	sb->ssb->max_orig_digits = lineno_width(longest_src_lines);
+	sb->ssb->max_digits = lineno_width(longest_dst_lines);
+	sb->ssb->max_score_digits = lineno_width(largest_score);
 }
 
 /*
@@ -1945,19 +1982,19 @@ static void prepare_blame_range(struct scoreboard *sb,
 }
 
 static int git_blame_config(const char *var, const char *value, void *cb)
-{
+{ 
 	if (!strcmp(var, "blame.showroot")) {
-		show_root = git_config_bool(var, value);
+		((struct super_scoreboard *)cb)->show_root = git_config_bool(var, value);
 		return 0;
 	}
 	if (!strcmp(var, "blame.blankboundary")) {
-		blank_boundary = git_config_bool(var, value);
+		((struct super_scoreboard *)cb)->blank_boundary = git_config_bool(var, value);
 		return 0;
 	}
 	if (!strcmp(var, "blame.date")) {
 		if (!value)
 			return config_error_nonbool(var);
-		blame_date_mode = parse_date_format(value);
+		((struct super_scoreboard *)cb)->blame_date_mode = parse_date_format(value);
 		return 0;
 	}
 	return git_default_config(var, value, cb);
@@ -2155,7 +2192,7 @@ static int blame_copy_callback(const struct option *option, const char *arg, int
 	*opt |= PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE;
 
 	if (arg)
-		blame_copy_score = parse_score(arg);
+		opt_blame_copy_score = parse_score(arg);
 	return 0;
 }
 
@@ -2166,7 +2203,7 @@ static int blame_move_callback(const struct option *option, const char *arg, int
 	*opt |= PICKAXE_BLAME_MOVE;
 
 	if (arg)
-		blame_move_score = parse_score(arg);
+		opt_blame_move_score = parse_score(arg);
 	return 0;
 }
 
@@ -2185,9 +2222,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 {
 	struct rev_info revs;
 	const char *path;
-	struct scoreboard sb;
 	struct origin *o;
 	struct blame_entry *ent;
+	static struct blame_stat stat;
+	static struct super_scoreboard ssb = { .xdl_opts = XDF_NEED_MINIMAL, .blame_date_mode = DATE_ISO8601, .stat = &stat } ;
+	static struct scoreboard sb ;
 	long dashdash_pos, bottom, top, lno;
 	const char *final_commit_name = NULL;
 	enum object_type type;
@@ -2198,9 +2237,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 	static const char *revs_file = NULL;
 	static const char *contents_from = NULL;
 	static const struct option options[] = {
-		OPT_BOOLEAN(0, "incremental", &incremental, "Show blame entries as we find them, incrementally"),
-		OPT_BOOLEAN('b', NULL, &blank_boundary, "Show blank SHA-1 for boundary commits (Default: off)"),
-		OPT_BOOLEAN(0, "root", &show_root, "Do not treat root commits as boundaries (Default: off)"),
+		OPT_BOOLEAN(0, "incremental", &ssb.incremental, "Show blame entries as we find them, incrementally"),
+		OPT_BOOLEAN('b', NULL, &ssb.blank_boundary, "Show blank SHA-1 for boundary commits (Default: off)"),
+		OPT_BOOLEAN(0, "root", &ssb.show_root, "Do not treat root commits as boundaries (Default: off)"),
 		OPT_BOOLEAN(0, "show-stats", &show_stats, "Show work cost statistics"),
 		OPT_BIT(0, "score-debug", &output_option, "Show output score for blame entries", OUTPUT_SHOW_SCORE),
 		OPT_BIT('f', "show-name", &output_option, "Show original filename (Default: auto)", OUTPUT_SHOW_NAME),
@@ -2210,7 +2249,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 		OPT_BIT('t', NULL, &output_option, "Show raw timestamp (Default: off)", OUTPUT_RAW_TIMESTAMP),
 		OPT_BIT('l', NULL, &output_option, "Show long commit SHA1 (Default: off)", OUTPUT_LONG_OBJECT_NAME),
 		OPT_BIT('s', NULL, &output_option, "Suppress author name and timestamp (Default: off)", OUTPUT_NO_AUTHOR),
-		OPT_BIT('w', NULL, &xdl_opts, "Ignore whitespace differences", XDF_IGNORE_WHITESPACE),
+		OPT_BIT('w', NULL, &ssb.xdl_opts, "Ignore whitespace differences", XDF_IGNORE_WHITESPACE),
 		OPT_STRING('S', NULL, &revs_file, "file", "Use revisions from <file> instead of calling git-rev-list"),
 		OPT_STRING(0, "contents", &contents_from, "file", "Use <file>'s contents as the final image"),
 		{ OPTION_CALLBACK, 'C', NULL, &opt, "score", "Find line copies within and across files", PARSE_OPT_OPTARG, blame_copy_callback },
@@ -2222,9 +2261,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 	struct parse_opt_ctx_t ctx;
 	int cmd_is_annotate = !strcmp(argv[0], "annotate");
 
-	git_config(git_blame_config, NULL);
+	git_config(git_blame_config, &ssb);
 	init_revisions(&revs, NULL);
-	revs.date_mode = blame_date_mode;
+	revs.date_mode = ssb.blame_date_mode;
 
 	save_commit_buffer = 0;
 	dashdash_pos = 0;
@@ -2243,7 +2282,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 
 		if (!strcmp(ctx.argv[0], "--reverse")) {
 			ctx.argv[0] = "--children";
-			reverse = 1;
+			ssb.reverse = 1;
 		}
 		parse_revision_opt(&revs, &ctx, options, blame_opt_usage);
 	}
@@ -2252,42 +2291,45 @@ parse_done:
 
 	if (cmd_is_annotate) {
 		output_option |= OUTPUT_ANNOTATE_COMPAT;
-		blame_date_mode = DATE_ISO8601;
+		ssb.blame_date_mode = DATE_ISO8601;
 	} else {
-		blame_date_mode = revs.date_mode;
+		ssb.blame_date_mode = revs.date_mode;
 	}
 
+	ssb.blame_move_score = opt_blame_move_score ;
+	ssb.blame_copy_score = opt_blame_copy_score ;
+
 	/* The maximum width used to show the dates */
-	switch (blame_date_mode) {
+	switch (ssb.blame_date_mode) {
 	case DATE_RFC2822:
-		blame_date_width = sizeof("Thu, 19 Oct 2006 16:00:04 -0700");
+		ssb.blame_date_width = sizeof("Thu, 19 Oct 2006 16:00:04 -0700");
 		break;
 	case DATE_ISO8601:
-		blame_date_width = sizeof("2006-10-19 16:00:04 -0700");
+		ssb.blame_date_width = sizeof("2006-10-19 16:00:04 -0700");
 		break;
 	case DATE_RAW:
-		blame_date_width = sizeof("1161298804 -0700");
+		ssb.blame_date_width = sizeof("1161298804 -0700");
 		break;
 	case DATE_SHORT:
-		blame_date_width = sizeof("2006-10-19");
+		ssb.blame_date_width = sizeof("2006-10-19");
 		break;
 	case DATE_RELATIVE:
 		/* "normal" is used as the fallback for "relative" */
 	case DATE_LOCAL:
 	case DATE_NORMAL:
-		blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700");
+		ssb.blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700");
 		break;
 	}
-	blame_date_width -= 1; /* strip the null */
+	ssb.blame_date_width -= 1; /* strip the null */
 
 	if (DIFF_OPT_TST(&revs.diffopt, FIND_COPIES_HARDER))
 		opt |= (PICKAXE_BLAME_COPY | PICKAXE_BLAME_MOVE |
 			PICKAXE_BLAME_COPY_HARDER);
 
-	if (!blame_move_score)
-		blame_move_score = BLAME_DEFAULT_MOVE_SCORE;
-	if (!blame_copy_score)
-		blame_copy_score = BLAME_DEFAULT_COPY_SCORE;
+	if (!ssb.blame_move_score)
+		ssb.blame_move_score = BLAME_DEFAULT_MOVE_SCORE;
+	if (!ssb.blame_copy_score)
+		ssb.blame_copy_score = BLAME_DEFAULT_COPY_SCORE;
 
 	/*
 	 * We have collected options unknown to us in argv[1..unk]
@@ -2341,9 +2383,9 @@ parse_done:
 
 	setup_revisions(argc, argv, &revs, NULL);
 	memset(&sb, 0, sizeof(sb));
-
+	sb.ssb = &ssb ;
 	sb.revs = &revs;
-	if (!reverse)
+	if (!sb.ssb->reverse)
 		final_commit_name = prepare_final(&sb);
 	else if (contents_from)
 		die("--contents and --children do not blend well.");
@@ -2391,7 +2433,7 @@ parse_done:
 			    sha1_to_hex(o->blob_sha1),
 			    path);
 	}
-	num_read_blob++;
+	stat.num_read_blob++;
 	lno = prepare_lines(&sb);
 
 	bottom = top = 0;
@@ -2422,14 +2464,14 @@ parse_done:
 		die("reading graft file %s failed: %s",
 		    revs_file, strerror(errno));
 
-	read_mailmap(&mailmap, NULL);
+	read_mailmap(&sb.ssb->mailmap, NULL);
 
-	if (!incremental)
+	if (!sb.ssb->incremental)
 		setup_pager();
 
 	assign_blame(&sb, opt);
 
-	if (incremental)
+	if (sb.ssb->incremental)
 		return 0;
 
 	coalesce(&sb);
@@ -2446,9 +2488,9 @@ parse_done:
 	}
 
 	if (show_stats) {
-		printf("num read blob: %d\n", num_read_blob);
-		printf("num get patch: %d\n", num_get_patch);
-		printf("num commits: %d\n", num_commits);
+		printf("num read blob: %d\n", stat.num_read_blob);
+		printf("num get patch: %d\n", stat.num_get_patch);
+		printf("num commits: %d\n", stat.num_commits);
 	}
 	return 0;
 }
-- 
1.5.4.3

^ permalink raw reply related

* Re: [PATCH] Introduce a filter-path argument to git-daemon, for doing  custom path transformations
From: Johan Sørensen @ 2009-03-12 10:26 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: git
In-Reply-To: <49B7DFA1.4030409@viscovery.net>

On Wed, Mar 11, 2009 at 4:58 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
> Johan Sørensen schrieb:
>> This buys us a lot of flexibility when it comes to managing different
>> repositories, possibly located in many different dirs, but with a uniform
>> url-structure to the outside world.
>
> It's the first time that I see a deamon with this feature - except perhaps
> Apache's ModRewrite. Are you sure you are not working around your problem
> at the wrong place?
>
> Doesn't --interpolated-path already solve your problem? If not, then you
> at least you must describe in the documentation the use-cases when
> --path-filter should be preferred.

Maybe I am barking up the wrong tree, but here's my real-world use
case: I'm currently working on some bigger changes for gitorious.org,
where the repository url-structure could potentially change over time,
as a consequence of various features. Using the path-filter script I
can keep the old urls around and still working, and I can map any url
to a on-disk uniquely hashed path, so I don't have to move the files
around, maintain symlinks and so forth for information the gitorious
application already has nicely structured and easy to lookup.

I know these may be highly specialized needs, but so is
interpolated-path for the common user. I think this patch could be
useful for anyone else wanting to set up a flexible repo hosting
system. I think the url-structure is a major part of the UI for any
app exposing them, even for a git-daemon, so the mod_rewrite
comparison isn't too far fetched in my opinion...

> Your implementation does not pass the target hostname to the script, but
> it should; otherwise you lose flexibility (for virtual hosting).

Good point. I've added the hostname as well as the service name as
arguments for the script.

>> +     switch ((pid = fork())) {
[snip]
>
> Use start_command()/finish_command() instead of rolling your own fork/exec
> combo.

Ah nice! I'm sending an updated patch.


>
> -- Hannes
>

Cheers,
JS

^ permalink raw reply

* Re: [PATCH 2/2] Make Git respect changes to .gitattributes during checkout.
From: Kristian Amlie @ 2009-03-12 10:23 UTC (permalink / raw)
  To: ext Johannes Sixt; +Cc: git@vger.kernel.org
In-Reply-To: <49B8DD1D.3060908@viscovery.net>

ext Johannes Sixt wrote:
> Kristian Amlie schrieb:
>> We do this by popping off elements on the attribute stack, until we
>> reach the level where a new .gitattributes was checked out. The next
>> time someone calls git_checkattr(), it will reconstruct the
>> attributes from that point.
> ...
>> +	gitattrlen = strlen(GITATTRIBUTES_FILE);
>> +	pathlen = strlen(path);
>> +	if (!strncmp(path + pathlen - gitattrlen, GITATTRIBUTES_FILE, gitattrlen)) {
>> +		/* Invalidate attributes if a new .gitattributes file was checked out. */
> 
> But if there was file .abc.txt that was checked out before .gitattributes
> was checked out, then the new .gitattributes won't have been used for
> .abc.txt, yet, right?

You're right, that fails.

I'm guessing my initial patch (and testcase) works because the sorting
is alphabetical and .gitattributes happens to be checked out before
files with letters. I would need to make sure that .gitattributes gets
checked out first.

--
Kristian

^ permalink raw reply

* Re: [RFC/PATCH] git push usability improvements and default change
From: Finn Arne Gangstad @ 2009-03-12 10:22 UTC (permalink / raw)
  To: Nanako Shiraishi; +Cc: Junio C Hamano, git
In-Reply-To: <20090312120109.6117@nanako3.lavabit.com>

On Thu, Mar 12, 2009 at 12:01:09PM +0900, Nanako Shiraishi wrote:

[...]
> There can be two reasons you may want to give the branch a name other than 'next':
> 
> 1. Because you also have dschos-next that tracks remotes/dscho/next; or
> 
> 2. Because you also have junios-next2 that also tracks remotes/origin/next.

> The first case indicates that the project is using a workflow where
> each developer has his own publishing repository [1], and it is very
> unlikely that Finn Arne has push access to either your or
> Johannes'es public repositories.

No, think more of different repositories with different function, such
as "my-public", "my-group", "beta", "customers", "public" and so on.
You can have multiple repositories with different function. They (can)
have branches with the same name, but have different purposes. To
track more than one you _must_ rename at least one locally (and just
with two remotes "master" is going to give you some issues).

Maybe you want the name in the public repo to be different than the
name in your own repo.

[...]

> I don't understand how the new "--current" makes "sort-of" sense. It
> looks like it is making the command more complex and the only thing
> it does is to encourage a confused workflow.

The naming --current was not good, so I have changed it to --tracking
in my latest suggestion.  Why is it confused?  Why do I need to call
my branch locally the same as it is named remotely?  That does not
scale. Branch names are unique per repository, not globally.

I want to be able to "git pull" and then "git push --tracking" back to
the same branch, not push somewhere else. Curently this requires a
surprisingly complicated shellscript, and is not available from the
guis.

> [1] Your http://gitster.livejournal.com/30645.html showed different
> ways to collaborate very nicely. I think this is the third approach
> in your article.

The main problem with all these examples is that the underlying
assumption is that you can always use the same branch name locally and
remotely.  This just isn't always the case when you have many remotes,
and each remote repository has some implicit function (e.g. "beta",
"john", "graphics-group", "my-public", .....), and they have an active
"master" branch for example.

- Finn Arne

^ permalink raw reply

* [PATCH] Introduce a filter-path argument to git-daemon, for doing custom path transformations
From: Johan Sørensen @ 2009-03-12 10:13 UTC (permalink / raw)
  To: git; +Cc: Johan Sørensen
In-Reply-To: <49B7DFA1.4030409@viscovery.net>

The parameter for filter-path is an executable that will receive the service
name, the client hostname and path to the repos the client requests as as
arguments. It is then the responsibility of the script to return a zero
terminated string on its stdout with the real path of the target repository.
---
 Documentation/git-daemon.txt |   13 ++++++++++
 daemon.c                     |   53 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 36f00ae..efd1687 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -13,6 +13,7 @@ SYNOPSIS
 	     [--strict-paths] [--base-path=path] [--base-path-relaxed]
 	     [--user-path | --user-path=path]
 	     [--interpolated-path=pathtemplate]
+	     [--path-filter=executable]
 	     [--reuseaddr] [--detach] [--pid-file=file]
 	     [--enable=service] [--disable=service]
 	     [--allow-override=service] [--forbid-override=service]
@@ -71,6 +72,18 @@ OPTIONS
 	After interpolation, the path is validated against the directory
 	whitelist.
 
+--path-filter=executable::
+	To support a more flexible directory layout a path filter script 
+	can be used. The executable will receive the service name (upload-pack, 
+	upload-archive or receive-pack), the client hostname and the request git 
+	directory as arguments. The executable must return a zero-terminated string
+	on stdout which is the real path 'git-daemon' should serve. This is useful
+	when --interpolated-path doesn't buy you enough flexibility. You could for
+	instance keep support for old clone urls if you rename your repository, or
+	fetch a custom url-mapping from a third-party repo manager application, or
+	map deeply nested repository directories to a more sensible layout for the 
+	outside world.
+
 --export-all::
 	Allow pulling from all directories that look like GIT repositories
 	(have the 'objects' and 'refs' subdirectories), even if they
diff --git a/daemon.c b/daemon.c
index d93cf96..e6777c6 100644
--- a/daemon.c
+++ b/daemon.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "pkt-line.h"
 #include "exec_cmd.h"
+#include "run-command.h"
 
 #include <syslog.h>
 
@@ -22,6 +23,7 @@ static const char daemon_usage[] =
 "           [--strict-paths] [--base-path=path] [--base-path-relaxed]\n"
 "           [--user-path | --user-path=path]\n"
 "           [--interpolated-path=path]\n"
+"           [--path-filter=path]\n"
 "           [--reuseaddr] [--detach] [--pid-file=file]\n"
 "           [--[enable|disable|allow-override|forbid-override]=service]\n"
 "           [--inetd | [--listen=host_or_ipaddr] [--port=n]\n"
@@ -58,6 +60,10 @@ static char *canon_hostname;
 static char *ip_address;
 static char *tcp_port;
 
+/* if defined, the script will be executed with the requested path on stdin
+ * and _must_ return with a successful exitcode and the new path on stdout */
+static char *path_filter_script;
+
 static void logreport(int priority, const char *err, va_list params)
 {
 	if (log_syslog) {
@@ -287,6 +293,37 @@ static int git_daemon_config(const char *var, const char *value, void *cb)
 	return 0;
 }
 
+static char *run_path_filter_script(struct daemon_service *s, char *host, char *dir) {
+	char result[256]; /* arbitary */
+	char *real_path;
+	struct child_process filter_cmd;
+	const char *args[] = { path_filter_script, s->name, host, dir, NULL };
+
+	loginfo("Executing path filter script: '%s %s'", path_filter_script, dir);
+	memset(&filter_cmd, 0, sizeof(filter_cmd));
+	filter_cmd.argv = args;
+	filter_cmd.out = -1;
+	
+	if (start_command(&filter_cmd)) {
+		logerror("path filter: unable to fork path_filter_script");
+		return NULL;
+	}
+	
+	read(filter_cmd.out, result, sizeof(result) - 1);
+	
+	close(filter_cmd.out);
+	if (finish_command(&filter_cmd)) {
+		logerror("path filter died with strange error");
+		return NULL;
+	}
+
+	if (result) {
+		real_path = result;
+		return real_path;
+	}
+	return NULL;
+}
+
 static int run_service(char *dir, struct daemon_service *service)
 {
 	const char *path;
@@ -495,6 +532,7 @@ static void parse_extra_args(char *extra_args, int buflen)
 static int execute(struct sockaddr *addr)
 {
 	static char line[1000];
+	char *path;
 	int pktlen, len, i;
 
 	if (addr) {
@@ -553,11 +591,20 @@ static int execute(struct sockaddr *addr)
 		if (!prefixcmp(line, "git-") &&
 		    !strncmp(s->name, line + 4, namelen) &&
 		    line[namelen + 4] == ' ') {
+			path = line + namelen + 5;
+			if (path_filter_script) {
+				loginfo("path_filter_script %s for path %s", path_filter_script, path);
+				char *tdir;
+				if ((tdir = run_path_filter_script(s, hostname, path))) {
+					path = tdir;
+				}
+			}
+			
 			/*
 			 * Note: The directory here is probably context sensitive,
 			 * and might depend on the actual service being performed.
 			 */
-			return run_service(line + namelen + 5, s);
+			return run_service(path, s);
 		}
 	}
 
@@ -1018,6 +1065,10 @@ int main(int argc, char **argv)
 			pid_file = arg + 11;
 			continue;
 		}
+		if (!prefixcmp(arg, "--path-filter=")) {
+			path_filter_script = arg + 14;
+			continue;
+		}
 		if (!strcmp(arg, "--detach")) {
 			detach = 1;
 			log_syslog = 1;
-- 
1.6.1

^ permalink raw reply related

* Re: [PATCH 2/2] Make Git respect changes to .gitattributes during checkout.
From: Johannes Sixt @ 2009-03-12  9:59 UTC (permalink / raw)
  To: Kristian Amlie; +Cc: git
In-Reply-To: <1236850575-27973-3-git-send-email-kristian.amlie@nokia.com>

Kristian Amlie schrieb:
> We do this by popping off elements on the attribute stack, until we
> reach the level where a new .gitattributes was checked out. The next
> time someone calls git_checkattr(), it will reconstruct the
> attributes from that point.
...
> +	gitattrlen = strlen(GITATTRIBUTES_FILE);
> +	pathlen = strlen(path);
> +	if (!strncmp(path + pathlen - gitattrlen, GITATTRIBUTES_FILE, gitattrlen)) {
> +		/* Invalidate attributes if a new .gitattributes file was checked out. */

But if there was file .abc.txt that was checked out before .gitattributes
was checked out, then the new .gitattributes won't have been used for
.abc.txt, yet, right?

(Disclaimer: I didn't read the code, just your description and this comment.)

-- Hannes

^ permalink raw reply

* Re: [PATCH 1/2] Add a test for checking whether gitattributes is honored by checkout.
From: Kristian Amlie @ 2009-03-12  9:53 UTC (permalink / raw)
  To: ext Matthieu Moy; +Cc: git@vger.kernel.org
In-Reply-To: <vpqr613jcoa.fsf@bauges.imag.fr>

ext Matthieu Moy wrote:
> Kristian Amlie <kristian.amlie@nokia.com> writes:
> 
>> +test_expect_success 'setup' '
> 
> If you have two separate patches for test and bugfix, you probably
> want the first to introduce test_expect_failure, and the second to
> change it to test_expect_success. This way: 1) the test-suite passes
> for all commits (and git-bisect will be your friend again), and 2) the
> second patch is self-explanatory about the bug it fixes.

Good point. I'll fix that in my next batch.

--
Kristian

^ permalink raw reply

* Re: [PATCH 1/2] Add a test for checking whether gitattributes is honored by checkout.
From: Matthieu Moy @ 2009-03-12  9:47 UTC (permalink / raw)
  To: Kristian Amlie; +Cc: git
In-Reply-To: <1236850575-27973-2-git-send-email-kristian.amlie@nokia.com>

Kristian Amlie <kristian.amlie@nokia.com> writes:

> +test_expect_success 'setup' '

If you have two separate patches for test and bugfix, you probably
want the first to introduce test_expect_failure, and the second to
change it to test_expect_success. This way: 1) the test-suite passes
for all commits (and git-bisect will be your friend again), and 2) the
second patch is self-explanatory about the bug it fixes.

-- 
Matthieu

^ permalink raw reply

* [PATCH 2/2] Make Git respect changes to .gitattributes during checkout.
From: Kristian Amlie @ 2009-03-12  9:36 UTC (permalink / raw)
  To: git; +Cc: Kristian Amlie
In-Reply-To: <1236850575-27973-2-git-send-email-kristian.amlie@nokia.com>

We do this by popping off elements on the attribute stack, until we
reach the level where a new .gitattributes was checked out. The next
time someone calls git_checkattr(), it will reconstruct the
attributes from that point.
---
 attr.c  |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------
 attr.h  |    1 +
 entry.c |   23 ++++++++++++++++++++
 3 files changed, 84 insertions(+), 12 deletions(-)

diff --git a/attr.c b/attr.c
index 17f6a4d..7deb51a 100644
--- a/attr.c
+++ b/attr.c
@@ -455,6 +455,23 @@ static void bootstrap_attr_stack(void)
 	}
 }
 
+static void pop_attr_stack(const char *path, int dirlen)
+{
+	struct attr_stack *elem;
+	while (attr_stack && attr_stack->origin) {
+		int namelen = strlen(attr_stack->origin);
+
+		elem = attr_stack;
+		if (namelen <= dirlen &&
+			!strncmp(elem->origin, path, namelen))
+			break;
+
+		debug_pop(elem);
+		attr_stack = elem->prev;
+		free_attr_elem(elem);
+	}
+}
+
 static void prepare_attr_stack(const char *path, int dirlen)
 {
 	struct attr_stack *elem, *info;
@@ -489,18 +506,7 @@ static void prepare_attr_stack(const char *path, int dirlen)
 	 * Pop the ones from directories that are not the prefix of
 	 * the path we are checking.
 	 */
-	while (attr_stack && attr_stack->origin) {
-		int namelen = strlen(attr_stack->origin);
-
-		elem = attr_stack;
-		if (namelen <= dirlen &&
-		    !strncmp(elem->origin, path, namelen))
-			break;
-
-		debug_pop(elem);
-		attr_stack = elem->prev;
-		free_attr_elem(elem);
-	}
+	pop_attr_stack(path, dirlen);
 
 	/*
 	 * Read from parent directories and push them down
@@ -642,3 +648,45 @@ int git_checkattr(const char *path, int num, struct git_attr_check *check)
 
 	return 0;
 }
+
+void git_attr_invalidate_path(const char *path)
+{
+	int dirlen;
+	const char *cp;
+	struct attr_stack *info, *elem;
+
+	bootstrap_attr_stack();
+
+	/*
+	 * Pop the "info" one that is always at the top of the stack.
+	 */
+	info = attr_stack;
+	attr_stack = info->prev;
+
+	cp = strrchr(path, '/');
+	dirlen = cp ? cp - path : 0;
+	/* Pop everything up to, and including, path. */
+	pop_attr_stack(path, dirlen);
+
+	if (!strcmp(path, "") && attr_stack->origin && !strcmp(attr_stack->origin, "")) {
+		/* Special handling when the root attributes must be invalidated. */
+		elem = attr_stack;
+		debug_pop(elem);
+		attr_stack = elem->prev;
+		free_attr_elem(elem);
+
+		if (!is_bare_repository()) {
+			elem = read_attr(GITATTRIBUTES_FILE, 1);
+			elem->origin = strdup("");
+			elem->prev = attr_stack;
+			attr_stack = elem;
+			debug_push(elem);
+		}
+	}
+
+	/*
+	 * Finally push the "info" one at the top of the stack.
+	 */
+	info->prev = attr_stack;
+	attr_stack = info;
+}
diff --git a/attr.h b/attr.h
index f1c2038..8f4135b 100644
--- a/attr.h
+++ b/attr.h
@@ -30,5 +30,6 @@ struct git_attr_check {
 };
 
 int git_checkattr(const char *path, int, struct git_attr_check *);
+void git_attr_invalidate_path(const char *path);
 
 #endif /* ATTR_H */
diff --git a/entry.c b/entry.c
index 05aa58d..121c979 100644
--- a/entry.c
+++ b/entry.c
@@ -1,6 +1,7 @@
 #include "cache.h"
 #include "blob.h"
 #include "dir.h"
+#include "attr.h"
 
 static void create_directories(const char *path, const struct checkout *state)
 {
@@ -91,6 +92,9 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 {
 	int fd;
 	long wrote;
+	int gitattrlen;
+	int pathlen;
+	char *inv_path;
 
 	switch (ce->ce_mode & S_IFMT) {
 		char *new;
@@ -171,6 +175,25 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
 		return error("git checkout-index: unknown file mode for %s", path);
 	}
 
+	gitattrlen = strlen(GITATTRIBUTES_FILE);
+	pathlen = strlen(path);
+	if (!strncmp(path + pathlen - gitattrlen, GITATTRIBUTES_FILE, gitattrlen)) {
+		/* Invalidate attributes if a new .gitattributes file was checked out. */
+		inv_path = strrchr(path, '/');
+		if (!inv_path) {
+			pathlen = 0;
+			inv_path = xmalloc(1);
+			*inv_path = '\0';
+		} else {
+			pathlen = inv_path - path;
+			inv_path = xmalloc(pathlen + 1);
+			strncpy(inv_path, path, pathlen);
+			inv_path[pathlen] = '\0';
+		}
+		git_attr_invalidate_path(inv_path);
+		free(inv_path);
+	}
+
 	if (state->refresh_cache) {
 		struct stat st;
 		lstat(ce->name, &st);
-- 
1.6.2.105.g16bc7.dirty

^ permalink raw reply related

* [PATCH 1/2] Add a test for checking whether gitattributes is honored by checkout.
From: Kristian Amlie @ 2009-03-12  9:36 UTC (permalink / raw)
  To: git; +Cc: Kristian Amlie
In-Reply-To: <1236850575-27973-1-git-send-email-kristian.amlie@nokia.com>

The original bug will not honor new entries in gitattributes if they
are changed in the same checkout as the files they affect.
---
 t/t2013-checkout-crlf.sh |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
 create mode 100755 t/t2013-checkout-crlf.sh

diff --git a/t/t2013-checkout-crlf.sh b/t/t2013-checkout-crlf.sh
new file mode 100755
index 0000000..cb997a8
--- /dev/null
+++ b/t/t2013-checkout-crlf.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+test_description='checkout should honor .gitattributes'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+
+	git config core.autocrlf true &&
+	printf "dummy dummy=true\r\n" > .gitattributes &&
+	git add .gitattributes &&
+	git commit -m initial &&
+	printf "file -crlf\n" >> .gitattributes &&
+	printf "contents\n" > file &&
+	git add .gitattributes file &&
+	git commit -m second
+
+'
+
+test_expect_success 'checkout with existing .gitattributes' '
+
+	git checkout master~1 &&
+	git checkout master &&
+	test "$(git diff-files --raw)" = ""
+
+'
+
+test_done
+
-- 
1.6.2.105.g16bc7.dirty

^ permalink raw reply related

* Re: Honoring a checked out gitattributes file
From: Kristian Amlie @ 2009-03-12  9:36 UTC (permalink / raw)
  To: git
In-Reply-To: <1233320413-28069-1-git-send-email-kristian.amlie@trolltech.com>


Ok, it took a bit longer than I thought to get around to this, but I
finally have a patch for the problem. I am not so familiar with the
Git source code, so I apologize if I do something incredibly stupid.

Hopefully the commit message should explain what I do, but please ask
questions if it's not clear. I'm sure there's room for improvements.

--
Kristian

^ permalink raw reply

* Re: git-svn multiple branches and merging
From: Igor Lautar @ 2009-03-12  9:31 UTC (permalink / raw)
  To: git
In-Reply-To: <5fdd0830903020409j6e2b5269ubfb3ae6fe8266734@mail.gmail.com>

Hi,

Figured out a (little) better way.

Say A is point where last merge was done and B is head of branch we
want to cherry-pick from:

for c in $(git-rev-list --reverse A...B); do git-cherry-pick $c; done

I'm sure for can be replaced with something better, but it works for
me. However, I still need last merge (cherry-pick) point. It would be
nice to hear if anybody has a better idea...

Regards,
Igor

On Mon, Mar 2, 2009 at 1:09 PM, Igor Lautar <igor.lautar@gmail.com> wrote:
> Hi All,
>
> I'm using git-svn to manage quite large svn repository. This
> repository also does not follow 'general' svn rules about how to name
> branches.
>
> So we have something like:
> trunk -> development
> branches\version1 -> version1 maintenance
> branches\custom\version1_fix -> customized version1 with certain fixes
>
> etc.
>
> When importing, I've only imported trunk and branches I'm interested
> in. Thus, I have multiple remotes for which git-svn does not know they
> are related (or how they branched from each other). Also, I have not
> imported whole history, as its just to much trouble.
>
> Now, I want to start a new branch, lets say branches\dev1, which is
> branches from trunk. This will be used for various improvements, which
> do not go to trunk immediatelly.
> I also want to keep this branch in sync with main trunk.
>
> Up to now, I have been doing this by git-cherry-pick all changes from
> dev1 branch point. Is there a better way to do? Note that branch dev1
> in git-svn does not know about previous commits in trunk (git remote
> ref was initialized from branch point for dev1).
>
> Just merging trunk (represented by a remote in git-svn) makes a mess
> (as expected). Basically, what I want to do is tell git-svn that merge
> was already done up to a certain point from that branch so git-merge
> then only picks up new changes from that point on (and the ones that
> have not been cherry-picked).
>
> Is there a way to get out of this mess? I'm fine with cherry-pick, but
> it requires some manual labor (like remembering/finding last
> cherry-picked commit).
>
> Thank you,
> Igor
>

^ permalink raw reply

* Re: [PATCH][v2] http authentication via prompts (with correct line lengths)
From: Daniel Stenberg @ 2009-03-12  9:24 UTC (permalink / raw)
  To: Mike Ralphson; +Cc: Junio C Hamano, Mike Gaffney, git
In-Reply-To: <e2b179460903120212x67081f69wb66364918714add7@mail.gmail.com>

On Thu, 12 Mar 2009, Mike Ralphson wrote:

>> May I suggest perhaps require a libcurl version that is no older than three 
>> years or something like that?
>
> It might be a plan 8-) Though I was thinking technically in terms of 
> features we think git needs. Though doubtless there are several security 
> fixes it would be beneficial to keep up to date with.

Right, but if you set a common lowest denominator first you know what features 
to expect to be there _at least_, then there might of course be a set of 
additional ones brought by newer versions. It would reduce the amount of 
conditionals in the code and what-if-this-is-used scenarios (in the code and 
in support/docs). It also reduces the risks of git getting odd problems due to 
very old libcurl bugs.

>> (spoiler: libcurl 7.9.3 is more than seven years old!)
>
> And still the release IBM package for AIX [1]. 8-(

However, someone who's building/getting git might also be able to build/get a 
newer libcurl.

> The summary of automatic builds (http://curl.haxx.se/auto/) is very nicely 
> presented. Is that custom code?

The code is custom (perl) but present in the curl CVS repo for the web site 
and could probably fairly easy be adapted for other purposes/projects.

In the curl project we provide scripts for distributed automatic tests and 
then we have a central server that receives the reports by mail and the 
automatic summary script displays the status of those tests on that page.

-- 

  / daniel.haxx.se

^ permalink raw reply

* Re: [PATCH][v2] http authentication via prompts (with correct line  lengths)
From: Mike Ralphson @ 2009-03-12  9:12 UTC (permalink / raw)
  To: Daniel Stenberg; +Cc: Junio C Hamano, Mike Gaffney, git
In-Reply-To: <alpine.DEB.1.10.0903120956460.18527@yvahk2.pbagnpgbe.fr>

2009/3/12 Daniel Stenberg <daniel@haxx.se>:
> On Thu, 12 Mar 2009, Mike Ralphson wrote:
>
>> Elsewhere we seem to protect use of CURL_NETRC_OPTIONAL by checking for
>> LIBCURL_VERSION_NUM >= 0x070907. I have an ancient curl here
>> (curl-7.9.3-2ssl) which doesn't seem to have this option, so building next
>> is broken on AIX for me from this morning (c33976cb).
>>
>> Is there a specific minimum version of curl we want to continue
>> supporting?
>
> May I suggest perhaps require a libcurl version that is no older than three
> years or something like that?

It might be a plan 8-) Though I was thinking technically in terms of
features we think git needs. Though doubtless there are several
security fixes it would be beneficial to keep up to date with.

> (spoiler: libcurl 7.9.3 is more than seven years old!)

And still the release IBM package for AIX [1]. 8-(

The summary of automatic builds (http://curl.haxx.se/auto/) is very
nicely presented. Is that custom code?

Thanks for curl, even the old versions!

Mike

[1] http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html

^ permalink raw reply

* Re: [PATCH v2] git-clone: Add option --branch to override initial  branch
From: Felipe Contreras @ 2009-03-12  9:12 UTC (permalink / raw)
  To: Paolo Ciarrocchi
  Cc: Miles Bader, git, torarnv, Junio C Hamano, Johannes Schindelin
In-Reply-To: <4d8e3fd30903120148u52164fe3offe665bf70ef6d8d@mail.gmail.com>

On Thu, Mar 12, 2009 at 10:48 AM, Paolo Ciarrocchi
<paolo.ciarrocchi@gmail.com> wrote:
> On Thu, Mar 12, 2009 at 5:18 AM, Miles Bader <miles@gnu.org> wrote:
>> Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> writes:
>>> $ git clone -n URL
>>> $ git checkout -b foo origin/bar
>>>
>>> That being said, I see the following command as an improvement over
>>> the actual GIT UI:
>>>
>>>  $ git clone git://URI -b bar
>>
>> Note that in your original advice, foo and bar can be different, and
>> it's not clear to me what "-b bar" should do...
>>
>> Personally I frequently use foo == bar (no local master branch), but I
>> think another common pattern is foo != bar, but foo or bar == "master".
>>
>> Maybe a syntax similar to push, like "-b LOCAL_BR:REMOTE_BR",
>> with "-b BR" being shorthand for "-b BR:BR"?
>
> Yes, makes sense.

+1

-- 
Felipe Contreras

^ permalink raw reply

* Re: Deleting remote branch pointed by remote HEAD
From: Felipe Contreras @ 2009-03-12  9:02 UTC (permalink / raw)
  To: Jeff King; +Cc: Daniel Barkalow, Michael J Gruber, Marc-André Lureau, git
In-Reply-To: <20090121195348.GB3589@sigill.intra.peff.net>

On Wed, Jan 21, 2009 at 9:53 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Jan 21, 2009 at 02:50:40PM -0500, Daniel Barkalow wrote:
>
>> I think the ideal thing is to keep the symref as a reminder and just give
>> a non-confusing error message instead of a confusing one. E.g.:
>>
>> """
>> $foo is set to mean the tracking branch $foo/bar, which does not exist.
>> Use:
>>
>>   git remote set-default $foo <name>
>>
>> to set a new default branch for $foo.
>> """
>>
>> (And, of course, add that subcommand to remote)
>
> I think that would be reasonable behavior (and probably a special mode
> for set-default to just update from the remote's idea of HEAD).

Nobody is working on this, right?

-- 
Felipe Contreras

^ permalink raw reply

* Re: [PATCH][v2] http authentication via prompts (with correct line lengths)
From: Daniel Stenberg @ 2009-03-12  8:59 UTC (permalink / raw)
  To: Mike Ralphson; +Cc: Junio C Hamano, Mike Gaffney, git
In-Reply-To: <e2b179460903120153u5fdb58b6tf3027eea23673df0@mail.gmail.com>

On Thu, 12 Mar 2009, Mike Ralphson wrote:

> Elsewhere we seem to protect use of CURL_NETRC_OPTIONAL by checking for 
> LIBCURL_VERSION_NUM >= 0x070907. I have an ancient curl here 
> (curl-7.9.3-2ssl) which doesn't seem to have this option, so building next 
> is broken on AIX for me from this morning (c33976cb).
>
> Is there a specific minimum version of curl we want to continue supporting?

May I suggest perhaps require a libcurl version that is no older than three 
years or something like that?

Perhaps this list can serve as some help:

 	http://curl.haxx.se/docs/releases.html

(spoiler: libcurl 7.9.3 is more than seven years old!)

-- 

  / daniel.haxx.se

^ permalink raw reply

* Re: [PATCH][v2] http authentication via prompts (with correct line  lengths)
From: Mike Ralphson @ 2009-03-12  8:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Mike Gaffney, git
In-Reply-To: <7v63ihdgy6.fsf@gitster.siamese.dyndns.org>

2009/3/10 Junio C Hamano <gitster@pobox.com>:
> diff --git a/http.c b/http.c
> index f4f0bf6..3d5caa6 100644
> --- a/http.c
> +++ b/http.c
> @@ -25,6 +25,7 @@ static long curl_low_speed_limit = -1;
>  static long curl_low_speed_time = -1;
>  static int curl_ftp_no_epsv;
>  static const char *curl_http_proxy;
> +static char *user_name, *user_pass;
>
>  static struct curl_slist *pragma_header;
>
> @@ -135,6 +136,20 @@ static int http_options(const char *var, const char *value, void *cb)
>        return git_default_config(var, value, cb);
>  }
>
> +static void init_curl_http_auth(CURL *result)
> +{
> +       if (!user_name)
> +               curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
> +       else {
> +               struct strbuf up = STRBUF_INIT;
> +               if (!user_pass)
> +                       user_pass = xstrdup(getpass("Password: "));
> +               strbuf_addf(&up, "%s:%s", user_name, user_pass);
> +               curl_easy_setopt(result, CURLOPT_USERPWD,
> +                                strbuf_detach(&up, NULL));
> +       }
> +}
> +

Elsewhere we seem to protect use of CURL_NETRC_OPTIONAL by checking
for LIBCURL_VERSION_NUM >= 0x070907. I have an ancient curl here
(curl-7.9.3-2ssl) which doesn't seem to have this option, so building
next is broken on AIX for me from this morning (c33976cb).

Is there a specific minimum version of curl we want to continue supporting?

Mike

^ 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