Git development
 help / color / mirror / Atom feed
* Re: [PATCH] make cg-export use tar-tree
From: Rene Scharfe @ 2005-04-27  1:16 UTC (permalink / raw)
  To: Joshua T. Corbin; +Cc: git, Petr Baudis
In-Reply-To: <200504261928.44538.jcorbin@wunjo.org>

Joshua T. Corbin schrieb:
> Here it is (this time with real tabs instead of two spaces ;) ), requires 
> Rene's tar-tree patch. Works quite speedily too I might add.

Maybe it's just Thunderbird, but I see single spaces instead of tabs
there.

> +  tar=$(mktemp -t cg-export.tar.XXXXXX)
> +  tar-tree $id "$base" > $tar
> +  case $ext in
> +  .tar.gz|.tgz)
> +   gzip -c9 $tar > $dest
> +   rm -f $tar
> +   ;;
> +  .tar.bz2)
> +   bzip2 -c $tar > $dest
> +   rm -f $tar
> +   ;;
> +  .tar)
> +   mv $tar $dest
> +   ;;
> +  esac

You don't need to create a temporary file using tar-tree.  The above can
be done like this:

  case $ext in
  .tar.gz|.tgz)
      tar-tree $id "$base" | gzip -9
      ;;
  .tar.bz2)
      tar-tree $id "$base" | bzip2
      ;;
  .tar)
      tar-tree $id "$base"
      ;;
  esac > $dest

This is both shorter and (a bit) faster.  More easily readable, too,
IMO.  Don't fear the pipe. ;-)  And I don't think we need to avoid
the triplication of tar-tree calls.

Thanks,
Rene

^ permalink raw reply

* Re: [PATCH] diff-cache/tree compatible output for show-diff (take 2).
From: Linus Torvalds @ 2005-04-27  1:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504261750030.18901@ppc970.osdl.org>



On Tue, 26 Apr 2005, Linus Torvalds wrote:
> 
> I'll need to fix that up, because right now it does the wrong thing (which
> it has always done): since we _remove_ all the merge entries, we'll first
> warn about them, but then we'll show the original file going away if there
> was one. Which is bogus.

Fixed. I think. My solution is clever, but untested.

What I do is that instead of _removing_ the unmerged entries (which we 
can't do, or we'd later think that the file has gone away if we see that 
same name in the tree we're comparing against), I make all unmerged 
entries be in "stage 3".

Then, when we read in the tree to compare against into stage 1, we have a 
few cases:

 - stage 0 only: new file
 - stage 0 and 1: modified file
 - stage 1 only: deleted file
 - stage 1 and 3: unmerged
 - stage 3 only: unmerged

See any problems with this? (a mix of 0 and 3 cannot happen - a file is
either unmerged or it is ok, since inserting a stage 0 entry always
removes all unmerged entires).

		Linus

^ permalink raw reply

* Re: Cogito Tutorial If It Helps
From: James Purser @ 2005-04-27  0:45 UTC (permalink / raw)
  To: Git Mailing List

Okay I sent a message in earlier but it must have been eaten by a grue
or something.

I have put in a little bit about the cg-update as well as describing
cg-patch but recommending cg-merge when dealing with different branches
due to the meta data problem.

Anything else you would like to see?
-- 
James Purser
Winnet Developer
+61 2 4223 4131
http://www.winnet.com.au


^ permalink raw reply

* Re: [PATCH] diff-cache/tree compatible output for show-diff (take 2).
From: Linus Torvalds @ 2005-04-27  0:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504261719230.18901@ppc970.osdl.org>



On Tue, 26 Apr 2005, Linus Torvalds wrote:
>
> [ "U" for "unmerged" ]
> 
> Btw, diff-cache definitely _can_ output this form, so we probably should 
> make diff-cache do so too, to match, no?

Actually, we should decide on what diff-tree-helper does before that. 
Right now it always either calls out to the external diff program, or it 
says "cannot parse".

It's possible that an external "diff" program might actually want to know
about unmerged files (maybe people don't actually do "diff", but something
else altogether), so one approach might be to just make that an option.

The other approach is to just have something like "<pathname> is unmerged"
as output from diff-tree-helper. That isn't quite as flexible, but it sure 
is simpler..

		Linus

^ permalink raw reply

* Re: [PATCH] Add -r flag to show-diff for diff-cache/diff-tree like output.
From: Linus Torvalds @ 2005-04-27  0:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vd5shkrs5.fsf@assigned-by-dhcp.cox.net>



On Tue, 26 Apr 2005, Junio C Hamano wrote:
> 
> By the way, how about renaming show-diff to diff-file?
> 
>     diff-tree  : compares two trees.
>     diff-cache : compares a tree and the cache, or a tree and files.
>     diff-file  : compares the cache and files.

Yes. Except I think that the "big renaming" is coming up, and we should 
just rename them to have a "git-" prefix too.

		Linus

^ permalink raw reply

* Re: [PATCH] diff-cache/tree compatible output for show-diff (take 2).
From: Linus Torvalds @ 2005-04-27  0:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vy8b5ksqi.fsf_-_@assigned-by-dhcp.cox.net>



On Tue, 26 Apr 2005, Junio C Hamano wrote:
>
> This patch changes the output format of the show-diff command to
> match that of the diff-cache/tree commands.  One type of record
> it can produce that diff-cache/tree do not is of this form:

Dang, I already did this in my tree. I pushed mine out, and I don't want 
to see the "-p" flag until the others also do it (ie diff-tree and 
diff-cache ;).

Btw, diff-cache definitely _can_ output this form, so we probably should 
make diff-cache do so too, to match, no?

		Linus

^ permalink raw reply

* Re: [PATCH] Add -r flag to show-diff for diff-cache/diff-tree like output.
From: Junio C Hamano @ 2005-04-27  0:05 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504261639420.18901@ppc970.osdl.org>

>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:

>> Later I'll add -p flag to diff-cache and diff-tree, so the usage
>> of these three commands match.

LT> The thing is, "-p" is strictly weaker than doing the UNIX
LT> pipe way, since the latter trivially does the same time (add
LT> a simple script if you don't want to type it), but can also
LT> do things like "grep the filenames going past" or similar.

I do not disagree with that.  Having only "-p" and not having
diff-cache/tree output _is_ weaker, and I am _not_ advocating
for removing the diff-cache/tree like output format from these
three commands.

What I _am_ advocating for is to obsolete the diff-tree-helper
program.  What it does can be done, with the diff.[ch] change
you merged this morning, without going through a pipe to the
diff-tree-helper process but directly from these three commands,
once diff-cache/tree acquires the "-p" flag.

By the way, how about renaming show-diff to diff-file?

    diff-tree  : compares two trees.
    diff-cache : compares a tree and the cache, or a tree and files.
    diff-file  : compares the cache and files.


^ permalink raw reply

* [PATCH] Move common date code to the library file
From: Jonas Fonseca @ 2005-04-26 23:55 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git
In-Reply-To: <20050426233439.GS13224@pasky.ji.cz>

Move common date conversion code to showdate() library function.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit e7ab52f0d69a45e69d78f2992c7997283855ac48
tree 01c206a9520ffa599c3ce17c901b4fce9b162b08
parent 09da825be78580e991bfd0ccbb90de15bfa18113
author Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:53:04 +0200
committer Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:53:04 +0200

 cg-Xlib    |    9 +++++++++
 cg-log     |    7 ++-----
 cg-mkpatch |    7 ++-----
 3 files changed, 13 insertions(+), 10 deletions(-)

Index: cg-Xlib
===================================================================
--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-Xlib  (mode:100755 sha1:5d84bbdb19510b7399f39ffd920636821a37248c)
+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-Xlib  (mode:100755 sha1:665b84360050e7151eb2aa34327a10821ddc9ccf)
@@ -33,6 +33,15 @@
 	$(which mktemp) $dirarg $prefix"$1"
 }
 
+showdate () {
+	date="$1"
+	sec=${date[0]}; tz=${date[1]}
+	dtz=${tz/+/}
+	lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
+	pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
+
+	echo "${pdate/+0000/$tz}"
+}
 
 # Compatibility hacks:
 # 2005-04-26
Index: cg-log
===================================================================
--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-log  (mode:100755 sha1:1c53b31a956e7c8cbfe653143cc0f91df02a2f86)
+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-log  (mode:100755 sha1:5d0b602d32068af0d6e958f1c9c4dd6c870a9ce1)
@@ -96,12 +96,9 @@
 				fi
 
 				date=(${rest#*> })
-				sec=${date[0]}; tz=${date[1]}
-				dtz=${tz/+/}
-				lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
-				pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
+				pdate="$(showdate $date)"
 				if [ "$pdate" ]; then
-					echo -n $color$key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/"
+					echo -n $color$key $rest | sed "s/>.*/> $pdate/"
 					echo $coldefault
 				else
 					echo $color$key $rest $coldefault
Index: cg-mkpatch
===================================================================
--- 6b45f2ad7c95fa110c7e8b53dae6d099d726bd4c/cg-mkpatch  (mode:100755 sha1:efee5dc887677d3122d8630b9ee3ef396b7adbd3)
+++ 01c206a9520ffa599c3ce17c901b4fce9b162b08/cg-mkpatch  (mode:100755 sha1:c6aa52b6c773718a64feef47a165885b684b593b)
@@ -16,12 +16,9 @@
 		case "$key" in
 			"author"|"committer")
 				date=(${rest#*> })
-				sec=${date[0]}; tz=${date[1]}
-				dtz=${tz/+/}
-				lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
-				pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
+				pdate="$(showdate $date)"
 				if [ "$pdate" ]; then
-					echo $key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/" >> $header
+					echo $key $rest | sed "s/>.*/> $pdate/" >> $header
 				else
 					echo $key $rest >> $header
 				fi

-- 
Jonas Fonseca

^ permalink raw reply

* [PATCH] diff-cache/tree compatible output for show-diff (take 2).
From: Junio C Hamano @ 2005-04-26 23:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <7vd5shm94l.fsf@assigned-by-dhcp.cox.net>

This patch changes the output format of the show-diff command to
match that of the diff-cache/tree commands.  One type of record
it can produce that diff-cache/tree do not is of this form:

    U path <record-terminator>

This is emitted once per unmerged path, no matter how many
unmerged stages there are.  The diff-tree-helper program is also
taught about this and warns about such input records.

The -z flag has the same meaning as diff-cache/tree commands;
the output records are terminated with a NUL instead of a '\n'.
Just like diff-cache takes a meaningless -r flag, it also
ignores a -r.

The previous default behaviour of getting patch output can be
obtained by specifying a -p flag.

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

diff-tree-helper.c |   27 ++++++++++++++++---------
show-diff.c        |   57 +++++++++++++++++++++++++++++++++++++----------------
2 files changed, 58 insertions(+), 26 deletions(-)

--- k/diff-tree-helper.c
+++ l/diff-tree-helper.c
@@ -44,6 +44,9 @@ static int parse_oneside_change(const ch
 	return 0;
 }
 
+#define PLEASE_WARN -1
+#define WARNED_OURSELVES -2
+ 
 static int parse_diff_tree_output(const char *buf,
 				  struct diff_spec *old,
 				  struct diff_spec *new,
@@ -52,6 +55,9 @@ static int parse_diff_tree_output(const 
 	int ch;
 
 	switch (*cp++) {
+	case 'U':
+		fprintf(stderr, "warning: unmerged path %s\n", cp+1);
+		return WARNED_OURSELVES;
 	case '+':
 		old->file_valid = 0;
 		return parse_oneside_change(cp, new, path);
@@ -61,7 +67,7 @@ static int parse_diff_tree_output(const 
 	case '*':
 		break;
 	default:
-		return -1;
+		return PLEASE_WARN;
 	}
 	
 	/* This is for '*' entries */
@@ -74,26 +80,26 @@ static int parse_diff_tree_output(const 
 		cp++;
 	}
 	if (strncmp(cp, "->", 2))
-		return -1;
+		return PLEASE_WARN;
 	cp += 2;
 	while ((ch = *cp) && ('0' <= ch && ch <= '7')) {
 		new->mode = (new->mode << 3) | (ch - '0');
 		cp++;
 	}
 	if (strncmp(cp, "\tblob\t", 6))
-		return -1;
+		return PLEASE_WARN;
 	cp += 6;
 	if (get_sha1_hex(cp, old->u.sha1))
-		return -1;
+		return PLEASE_WARN;
 	cp += 40;
 	if (strncmp(cp, "->", 2))
-		return -1;
+		return PLEASE_WARN;
 	cp += 2;
 	if (get_sha1_hex(cp, new->u.sha1))
-		return -1;
+		return PLEASE_WARN;
 	cp += 40;
 	if (*cp++ != '\t')
-		return -1;
+		return PLEASE_WARN;
 	strcpy(path, cp);
 	return 0;
 }
@@ -120,13 +126,16 @@ int main(int ac, char **av) {
 	/* the remaining parameters are paths patterns */
 
 	while (1) {
+		int status;
 		struct diff_spec old, new;
 		char path[PATH_MAX];
 		read_line(&sb, stdin, line_termination);
 		if (sb.eof)
 			break;
-		if (parse_diff_tree_output(sb.buf, &old, &new, path)) { 
-			fprintf(stderr, "cannot parse %s\n", sb.buf);
+		status = parse_diff_tree_output(sb.buf, &old, &new, path);
+		if (status) {
+			if (status == PLEASE_WARN)
+				fprintf(stderr, "cannot parse %s\n", sb.buf);
 			continue;
 		}
 		if (1 < ac && !matches_pathspec(path, av+1, ac-1))
--- k/show-diff.c
+++ l/show-diff.c
@@ -6,7 +6,8 @@
 #include "cache.h"
 #include "diff.h"
 
-static const char *show_diff_usage = "show-diff [-q] [-s] [-z] [paths...]";
+static const char *show_diff_usage =
+"show-diff [-q] [-s] [-r] [-z] [-p] [paths...]";
 
 static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt)
 {
@@ -23,24 +24,40 @@ static int matches_pathspec(struct cache
 	return 0;
 }
 
+static void show_file(int pfx, struct cache_entry *ce, int line_termination)
+{
+	printf("%c%o\t%s\t%s\t%s%c", pfx, ntohl(ce->ce_mode), "blob",
+	       sha1_to_hex(ce->sha1), ce->name, line_termination);
+}
+
 int main(int argc, char **argv)
 {
 	int silent = 0;
 	int silent_on_nonexisting_files = 0;
-	int machine_readable = 0;
+	int patch = 0;
+	int line_termination = '\n';
 	int reverse = 0;
 	int entries = read_cache();
 	int i;
 
 	while (1 < argc && argv[1][0] == '-') {
 		if  (!strcmp(argv[1], "-R"))
-			reverse = 1;
+			patch = reverse = 1; /* works only for patch */
 		else if (!strcmp(argv[1], "-s"))
-			silent_on_nonexisting_files = silent = 1;
+			patch = silent_on_nonexisting_files = silent = 1;
 		else if (!strcmp(argv[1], "-q"))
-			silent_on_nonexisting_files = 1;
+			patch = silent_on_nonexisting_files = 1;
+		else if (!strcmp(argv[1], "-p")) {
+			patch = 1;
+			line_termination = '\n';
+		}
+		else if (!strcmp(argv[1], "-r"))
+			; /* diff-cache and diff-tree compatible
+			   * is the default now.
+			   */
 		else if (!strcmp(argv[1], "-z"))
-			machine_readable = 1;
+			/* makes sense only non-patch */
+			patch = line_termination = 0;
 		else
 			usage(show_diff_usage);
 		argv++; argc--;
@@ -64,11 +81,10 @@ int main(int argc, char **argv)
 			continue;
 
 		if (ce_stage(ce)) {
-			if (machine_readable)
-				printf("U %s%c", ce->name, 0);
+			if (patch)
+				printf("%s: unmerged\n", ce->name);
 			else
-				printf("%s: Unmerged\n",
-				       ce->name);
+				printf("U %s%c", ce->name, line_termination);
 			while (i < entries &&
 			       !strcmp(ce->name, active_cache[i]->name))
 				i++;
@@ -77,26 +93,33 @@ int main(int argc, char **argv)
 		}
  
 		if (stat(ce->name, &st) < 0) {
+			/* deleted */
 			if (errno == ENOENT && silent_on_nonexisting_files)
 				continue;
-			if (machine_readable)
-				printf("X %s%c", ce->name, 0);
-			else {
+			if (patch) {
 				printf("%s: %s\n", ce->name, strerror(errno));
 				if (errno == ENOENT)
 					show_diff_empty(ce, reverse);
 			}
+			else
+				show_file('-', ce, line_termination);
 			continue;
 		}
 		changed = cache_match_stat(ce, &st);
 		if (!changed)
 			continue;
-		if (!machine_readable)
-			printf("%s: %s\n", ce->name, sha1_to_hex(ce->sha1));
-		else {
-			printf("%s %s%c", sha1_to_hex(ce->sha1), ce->name, 0);
+		if (!patch) {
+			static char *no_sha1_hex = 
+				"0000000000000000000000000000000000000000";
+			printf("*%o->%o\t%s\t%s->%s\t%s%c",
+			       ntohl(ce->ce_mode), st.st_mode,
+			       "blob", sha1_to_hex(ce->sha1), no_sha1_hex,
+			       ce->name, line_termination);
 			continue;
 		}
+		else
+			printf("%s %s%c", sha1_to_hex(ce->sha1), ce->name,
+			       line_termination);
 		if (silent)
 			continue;
 


^ permalink raw reply

* Re: Mercurial 0.3 vs git benchmarks
From: H. Peter Anvin @ 2005-04-26 23:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linus Torvalds, magnus.damm, mason, mike.taht, mpm, linux-kernel,
	git
In-Reply-To: <20050426155609.06e3ddcf.akpm@osdl.org>

Andrew Morton wrote:
> Linus Torvalds <torvalds@osdl.org> wrote:
> 
>>
>>
>>On Tue, 26 Apr 2005, Andrew Morton wrote:
>>
>>>Mounting as ext2 is a useful technique for determining whether the fs is
>>>getting in the way.
>>
>>What's the preferred way to try to convert a root filesystem to a bigger
>>journal? Forcing "rootfstype=ext2" at boot and boot into single-user, and
>>then the appropriate magic tune2fs? Or what?
>>
> 
> 
> Gee, it's been ages.  umm,
> 
> - umount the fs
> - tune2fs -O ^has_journal /dev/whatever
> - fsck -fy                              (to clean up the now-orphaned journal inode)
> - tune2fs -j -J size=nblocks    (normally 4k blocks)
> - mount the fs
> 

I think this is overkill, but should of course be safe.

While you're doing this anyway, you might want to make sure you enable 
-O +dir_index and run fsck -D.

	-hpa

^ permalink raw reply

* Re: [PATCH] Add -r flag to show-diff for diff-cache/diff-tree like output.
From: Linus Torvalds @ 2005-04-26 23:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vd5shm94l.fsf@assigned-by-dhcp.cox.net>



On Tue, 26 Apr 2005, Junio C Hamano wrote:
>
> >>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:
> 
> LT> Why not just make this the default? Who really cares about
> LT> show-diff?
> 
> Me, to care enough about it to send patches in ;-).

Well, I actually care abotu "show-diff" too, in the sense that I actually 
use it all the time.

The thing is, I just care about the format. To me, a "diff-tree" like
format is actually _better_ than the full diff, 99% of the time, since
what I really want to know "what state is my repository in", I don't
usually care about the details within the files.

Ie I want to know exactly the same thing that most scripts would want to 
know: which files are dirty and need to be checked in, which ones are 
still unmerged etc.

> Later I'll add -p flag to diff-cache and diff-tree, so the usage
> of these three commands match.

I don't know why you're so dead set on creating the diff directly, when 
you _don't_ actually create the diff directly anyway (ie you call out to a 
helper process - "diff", regardless).

The thing is, "-p" is strictly weaker than doing the UNIX pipe way, since 
the latter trivially does the same time (add a simple script if you don't 
want to type it), but can also do things like "grep the filenames going 
past" or similar.

But hey, as long as the source code is clean, I don't care _that_ much. 

		Linus

^ permalink raw reply

* Re: [PATCH] cg-mkpatch: Show human-readable dates
From: Petr Baudis @ 2005-04-26 23:34 UTC (permalink / raw)
  To: git
In-Reply-To: <20050426232729.GE28560@diku.dk>

Dear diary, on Wed, Apr 27, 2005 at 01:27:29AM CEST, I got a letter
where Jonas Fonseca <fonseca@diku.dk> told me that...
> Use the approach from from cg-log to show author and commit date
> in a human-readable format.
> 
> Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

That means you want this in the library. ;-)

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor

^ permalink raw reply

* [PATCH] cg-mkpatch: Show human-readable dates
From: Jonas Fonseca @ 2005-04-26 23:27 UTC (permalink / raw)
  To: pasky; +Cc: git

Use the approach from from cg-log to show author and commit date
in a human-readable format.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit e9f5d35741f92d64945a072759450b1c43b2b6e4
tree 01bda4c4ac0c3b938fb4e7954193f2441554acfb
parent e5eb91b0a47e1169006034af434312c7f38dc902
author Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:24:31 +0200
committer Jonas Fonseca <fonseca@diku.dk> Wed, 27 Apr 2005 01:24:31 +0200

 cg-mkpatch |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

Index: cg-mkpatch
===================================================================
--- bd580d135661ff0bc8eb32cb36025cd1e7bdda13/cg-mkpatch  (mode:100755 sha1:25c67a29296730daeac00e43fd4c18cf914a1c87)
+++ 01bda4c4ac0c3b938fb4e7954193f2441554acfb/cg-mkpatch  (mode:100755 sha1:efee5dc887677d3122d8630b9ee3ef396b7adbd3)
@@ -12,15 +12,31 @@
 showpatch () {
 	header=$(mktemp -t gitpatch.XXXXXX)
 	id=$1
-	cat-file commit $id | while read line; do
-		if [ ! "$line" ]; then
-			cat
-			echo
-			echo ---
-			echo commit $id
-			cat $header
-		fi
-		echo $line >>$header
+	cat-file commit $id | while read key rest; do
+		case "$key" in
+		"author"|"committer")
+			date=(${rest#*> })
+			sec=${date[0]}; tz=${date[1]}
+			dtz=${tz/+/}
+			lsec=$(expr $dtz / 100 \* 3600 + $dtz % 100 \* 60 + $sec)
+			pdate="$(date -Rud "1970-01-01 UTC + $lsec sec" 2>/dev/null)"
+			if [ "$pdate" ]; then
+				echo $key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/" >> $header
+			else
+				echo $key $rest >> $header
+			fi
+			;;
+		"")
+			cat
+			echo
+			echo ---
+			echo commit $id
+			cat $header
+			;;
+		*)
+			echo $key $rest >>$header
+			;;
+		esac
 	done
 	echo
 	cg-diff -p -r $id > $header

-- 
Jonas Fonseca

^ permalink raw reply

* Re: [PATCH] Add -r flag to show-diff for diff-cache/diff-tree like output.
From: Junio C Hamano @ 2005-04-26 23:05 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.58.0504261534590.18901@ppc970.osdl.org>

>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:

LT> Why not just make this the default? Who really cares about
LT> show-diff?

Me, to care enough about it to send patches in ;-).

LT> So why not just make "rational" the standard format, and then make 
LT> "diff-tree-helper" warn about unmerged ("U") files?

LT> As far as I can tell, that is really what _everybody_ wants.

I do not think of a good reason to forbid people from getting a
patch out of core GIT without going through the wrapper layer,
and the code is already there.  That said, I agree that scripts
usually do not use patch generating form.  I checked Cogito
before doing the patch to make sure it is not affected by this,
and my JIT core tools do not use it either.

I think making the diff-tree/cache compatible output default
would be fine.  The current diff-producing behaviour can be made
into an option (yes, I want to keep it).

LT> And calling "-r" "rational", when it means "recursive" for
LT> diff-tree and diff-cache doesn't sound rational to me.

Well, the truth is that -r does not stand for anything.  It just
is there to match useless -r to diff-cache (the change you made
to it to accept the same command line parameters -r (and
optionally -z) people would always give diff-tree.  You can call
it recursive if you want.

How about me doing the following and resubmitting?

 - Make this diff-tree/cache compatible output the default.

 - Take but ignore -r flag like diff-cache.

 - Add U warning to diff-tree-helper.

 - Add -p flag (patch) and have it cause the patch generating
   behaviour. 

Later I'll add -p flag to diff-cache and diff-tree, so the usage
of these three commands match.  That is:

    show-diff  -r (useless) -z           | diff-tree-helper -z
    diff-cache -r (useless) -z tree      | diff-tree-helper -z
    diff-tree  -r           -z tree tree | diff-tree-helper -z

    show-diff  -p [-r (useless)]
    diff-cache -p [-r (useless)]
    diff-tree  -p [-r]

With the GIT_EXTERNAL_DIFF envioronment variable, I suspect that
wrapper scripts do not have to use the diff-tree-helper but
directly use the -p form; but that will come later.  Thoughts?


^ permalink raw reply

* [PATCH] cg-log: Add -f switch to list changed files
From: Jonas Fonseca @ 2005-04-26 23:03 UTC (permalink / raw)
  To: pasky; +Cc: git

Add -f switch to show changed files between the commit header and log message.
It doesn't do anything fancy like wrapping long lines and can be quite costly.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit e5eb91b0a47e1169006034af434312c7f38dc902
tree bd580d135661ff0bc8eb32cb36025cd1e7bdda13
parent 580058cf4cbb6c95e5e84480499ca1c635d99376
author Jonas Fonseca <fonseca@diku.dk> 1114556053 +0200
committer Jonas Fonseca <fonseca@diku.dk> 1114556053 +0200

 cg-help |    2 +-
 cg-log  |   44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

Index: cg-help
===================================================================
--- 57a559984564e31e79db28d9ad62b8ea3a55dda1/cg-help  (mode:100755 sha1:86f29161aadf15411244db9514a1fdfb03e664bd)
+++ bd580d135661ff0bc8eb32cb36025cd1e7bdda13/cg-help  (mode:100755 sha1:18cc6a72de1cbe8ad7c66c30485350b5da252f9f)
@@ -21,7 +21,7 @@
 	cg-export	DESTDIR [TREE_ID]
 	cg-help
 	cg-init		[SOURCE_LOC]
-	cg-log		[-c] [COMMIT_ID | COMMIT_ID:COMMIT_ID]
+	cg-log		[-c] [-f] [COMMIT_ID | COMMIT_ID:COMMIT_ID]
 	cg-ls		[TREE_ID]
 	cg-merge	[-c] [-b BASE_ID] FROM_ID
 	cg-mkpatch	[COMMIT_ID | COMMIT_ID:COMMIT_ID]
Index: cg-log
===================================================================
--- 57a559984564e31e79db28d9ad62b8ea3a55dda1/cg-log  (mode:100755 sha1:58dd26ebf549cfb2e8e96fa2128f0dd34561ad55)
+++ bd580d135661ff0bc8eb32cb36025cd1e7bdda13/cg-log  (mode:100755 sha1:1c53b31a956e7c8cbfe653143cc0f91df02a2f86)
@@ -13,8 +13,11 @@
 #	header		Green	
 #	author 		Cyan
 #	committer	Magenta
+#	files		Blue
 #	signoff		Yellow
 #
+# Takes an -f option to show which files was changed.
+#
 # Takes an id resolving to a commit to start from (HEAD by default),
 # or id1:id2 representing an (id1;id2] range of commits to show.
 
@@ -26,16 +29,44 @@
 	colheader="$(tput setaf 2)"    # Green
 	colauthor="$(tput setaf 6)"    # Cyan
 	colcommitter="$(tput setaf 5)" # Magenta
+	colfiles="$(tput setaf 4)"     # Blue
 	colsignoff="$(tput setaf 3)"   # Yellow
 	coldefault="$(tput op)"        # Restore default
 else
 	colheader=
 	colauthor=
 	colcommitter=
+	colfiles=
 	colsignoff=
 	coldefault=
 fi
 
+if [ "$1" = "-f" ]; then
+	shift
+	list_files=1
+else
+	list_files=
+fi
+
+list_commit_files()
+{
+	tree1="$1"
+	tree2="$2"
+	sep="    * $colfiles"
+	# List all files for for the initial commit
+	if [ -z $tree2 ]; then
+		list_cmd="ls-tree $tree1"
+	else
+		list_cmd="diff-tree -r $tree1 $tree2"
+	fi
+	echo
+	$list_cmd | while read modes type sha1s file; do
+		echo -n "$sep$file"
+		sep=", "
+	done
+	echo "$coldefault:"
+}
+
 if echo "$1" | grep -q ':'; then
 	id1=$(commit-id $(echo "$1" | cut -d : -f 1)) || exit 1
 	id2=$(commit-id $(echo "$1" | cut -d : -f 2)) || exit 1
@@ -51,6 +82,8 @@
 
 $revls | $revsort | while read time commit parents; do
 	[ "$revfmt" = "rev-list" ] && commit="$time"
+	tree1=
+	tree2=
 	echo $colheader""commit ${commit%:*} $coldefault;
 	cat-file commit $commit | \
 		while read key rest; do
@@ -75,11 +108,22 @@
 				fi
 				;;
 			"")
+				if [ -n "$list_files" ]; then
+					list_commit_files "$tree1" "$tree2"
+				fi
 				echo; sed -re '
 					/ *Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/
 					s/./    &/
 				'
 				;;
+			"tree"|"parent")
+				if [ -z $tree1 ]; then
+					tree1=$rest
+				elif [ -z $tree2 ]; then
+					tree2=$rest
+				fi
+				echo $colheader$key $rest $coldefault
+				;;
 			*)
 				echo $colheader$key $rest $coldefault
 				;;


-- 
Jonas Fonseca

^ permalink raw reply

* [PATCH] cg-diff: Always refresh the cache before diffing
From: Jonas Fonseca @ 2005-04-26 23:01 UTC (permalink / raw)
  To: pasky; +Cc: git

Call update-cache --refresh before calling diff-cache so only modified
files are included in the diff.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit 580058cf4cbb6c95e5e84480499ca1c635d99376
tree 57a559984564e31e79db28d9ad62b8ea3a55dda1
parent 74f5ad9d566408b4d352570ccde67ece0f2650a7
author Jonas Fonseca <fonseca@diku.dk> 1114555427 +0200
committer Jonas Fonseca <fonseca@diku.dk> 1114555427 +0200

 cg-diff |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

Index: cg-diff
===================================================================
--- 7a6c485bceed70459c1855ab3c4d8ddfdeeb65d1/cg-diff  (mode:100755 sha1:b0c3e7389c06718c789e40b9a4fdce0afcb17917)
+++ 57a559984564e31e79db28d9ad62b8ea3a55dda1/cg-diff  (mode:100755 sha1:aecb9add527a72238f00c0581bf615625fec8663)
@@ -63,12 +63,14 @@
 		export GIT_INDEX_FILE=$(mktemp -t gitdiff.XXXXXX)
 		cp .git/index $GIT_INDEX_FILE
 		read-tree -m $(tree-id "$id1")
-		update-cache --refresh
 		tree=$(tree-id "$id1")
 	else
 		tree=$(tree-id)
 	fi
 
+	# Ensure to only diff modified files
+	update-cache --refresh
+
 	# FIXME: Update ret based on what did we match. And take "$@"
 	# to account after all.
 	ret=


-- 
Jonas Fonseca

^ permalink raw reply

* [PATCH] read_tree_recursive(): Fix leaks
From: Jonas Fonseca @ 2005-04-26 23:00 UTC (permalink / raw)
  To: pasky; +Cc: git

Fix two potential leaks.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit 74f5ad9d566408b4d352570ccde67ece0f2650a7
tree 7a6c485bceed70459c1855ab3c4d8ddfdeeb65d1
parent a738ed98e4557877f8bcd3b992aa55579b22b9d1
author Jonas Fonseca <fonseca@diku.dk> 1114555146 +0200
committer Jonas Fonseca <fonseca@diku.dk> 1114555146 +0200

 tree.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Index: tree.c
===================================================================
--- 2447d3a399200c8f736344822969f88f675612dd/tree.c  (mode:100644 sha1:15a16d560619aee80e41bf816dd8474a3253b1a5)
+++ 7a6c485bceed70459c1855ab3c4d8ddfdeeb65d1/tree.c  (mode:100644 sha1:7c55bb9bfa1565dc9df5cab31207a02004d7fe10)
@@ -39,14 +39,17 @@
 		if (S_ISDIR(mode)) {
 			int retval;
 			int pathlen = strlen(path);
-			char *newbase = xmalloc(baselen + 1 + pathlen);
+			char *newbase;
 			void *eltbuf;
 			char elttype[20];
 			unsigned long eltsize;
 
 			eltbuf = read_sha1_file(sha1, elttype, &eltsize);
-			if (!eltbuf || strcmp(elttype, "tree"))
+			if (!eltbuf || strcmp(elttype, "tree")) {
+				if (eltbuf) free(eltbuf);
 				return -1;
+			}
+			newbase = xmalloc(baselen + 1 + pathlen);
 			memcpy(newbase, base, baselen);
 			memcpy(newbase + baselen, path, pathlen);
 			newbase[baselen + pathlen] = '/';


-- 
Jonas Fonseca

^ permalink raw reply

* [PATCH] cg-mkpatch: Show diffstat before the patch
From: Jonas Fonseca @ 2005-04-26 22:58 UTC (permalink / raw)
  To: pasky; +Cc: git

Show diffstat before the patch.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
commit a738ed98e4557877f8bcd3b992aa55579b22b9d1
tree 2447d3a399200c8f736344822969f88f675612dd
parent ed095b1a965517f1674b812a9978c60eb907e192
author Jonas Fonseca <fonseca@diku.dk> 1114554627 +0200
committer Jonas Fonseca <fonseca@diku.dk> 1114554627 +0200

 cg-mkpatch |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

Index: cg-mkpatch
===================================================================
--- 6159f313b10f0cfcdfedd63d6fb044029fe46aaa/cg-mkpatch  (mode:100755 sha1:5ba423cbbb3e5f72cd7fb74f2873d49b60557f12)
+++ 2447d3a399200c8f736344822969f88f675612dd/cg-mkpatch  (mode:100755 sha1:25c67a29296730daeac00e43fd4c18cf914a1c87)
@@ -23,7 +23,10 @@
 		echo $line >>$header
 	done
 	echo
-	cg-diff -p -r $id
+	cg-diff -p -r $id > $header
+	cat $header | diffstat
+	echo
+	cat $header
 	rm $header
 }
 


-- 
Jonas Fonseca

^ permalink raw reply

* Re: Mercurial 0.3 vs git benchmarks
From: Andrew Morton @ 2005-04-26 22:56 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: magnus.damm, mason, mike.taht, mpm, linux-kernel, git
In-Reply-To: <Pine.LNX.4.58.0504261405050.18901@ppc970.osdl.org>

Linus Torvalds <torvalds@osdl.org> wrote:
>
> 
> 
> On Tue, 26 Apr 2005, Andrew Morton wrote:
> > 
> > Mounting as ext2 is a useful technique for determining whether the fs is
> > getting in the way.
> 
> What's the preferred way to try to convert a root filesystem to a bigger
> journal? Forcing "rootfstype=ext2" at boot and boot into single-user, and
> then the appropriate magic tune2fs? Or what?
> 

Gee, it's been ages.  umm,

- umount the fs
- tune2fs -O ^has_journal /dev/whatever
- fsck -fy                              (to clean up the now-orphaned journal inode)
- tune2fs -j -J size=nblocks    (normally 4k blocks)
- mount the fs


^ permalink raw reply

* Re: Mercurial 0.3 vs git benchmarks
From: H. Peter Anvin @ 2005-04-26 22:50 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Magnus Damm, mason, mike.taht, mpm, linux-kernel,
	git
In-Reply-To: <Pine.LNX.4.58.0504261405050.18901@ppc970.osdl.org>

Linus Torvalds wrote:
> 
> On Tue, 26 Apr 2005, Andrew Morton wrote:
> 
>>Mounting as ext2 is a useful technique for determining whether the fs is
>>getting in the way.
> 
> 
> What's the preferred way to try to convert a root filesystem to a bigger
> journal? Forcing "rootfstype=ext2" at boot and boot into single-user, and
> then the appropriate magic tune2fs? Or what?
> 

Boot single-user, "remount -o ro,remount /", "tune2fs -J size=xxxM" and 
reboot.

	-hpa

^ permalink raw reply

* Re: Full linux-2.6 history?
From: H. Peter Anvin @ 2005-04-26 22:47 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Thomas Gleixner, git
In-Reply-To: <20050426071723.GA15580@pasky.ji.cz>

Petr Baudis wrote:
>   Hello,
> 
>   I would like to ask about the status of the project to export the
> linux-2.6 history from BitKeeper to GIT repository; it looked very
> hopeful about a week or two ago, but got covered in silence soon.
> Did Larry come upon you? ;-)
> 
>   I kept having people asking about this, so I would like to know.
> 

There is a human-readable log file of the linux-2.5 repo posted on the 
sourcepuller site, http://www.sf.net/projects/sourcepuller

	-hpa


^ permalink raw reply

* Re: git-pasky "tutorial"
From: Benjamin Herrenschmidt @ 2005-04-26 22:42 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git
In-Reply-To: <20050426195752.GG13224@pasky.ji.cz>


> you might want to try again with cogito-0.8; I hope I simplified the
> concepts a lot.

Yup, I figured that out, thanks.

> There is no tracking, and branches are trivial - branches correspond to
> repositories. When you do cg-init <remoterepo>, you get a branch origin
> which represents the remoterepo (and gets updated when you do cg-pull or
> cg-update), you can make Cogito know of more remote repositories by
> doing cg-branch-add.
> 
> 
> Yes, the README sucks; but apparently it helps at least some people. ;-)
> 
-- 
Benjamin Herrenschmidt <benh@kernel.crashing.org>


^ permalink raw reply

* Re: [PATCH] Add -r flag to show-diff for diff-cache/diff-tree like output.
From: Linus Torvalds @ 2005-04-26 22:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vy8b5mawy.fsf_-_@assigned-by-dhcp.cox.net>



On Tue, 26 Apr 2005, Junio C Hamano wrote:
>
> This adds a new option -r (rational) to show-diff command, to
> produce diff-cache/diff-tree compatible output.

Why not just make this the default? Who really cares about show-diff? I 
see that "cg-merge" uses it, but does so with the "s" flag, just to see 
whether there are any changes at all.

So why not just make "rational" the standard format, and then make 
"diff-tree-helper" warn about unmerged ("U") files?

As far as I can tell, that is really what _everybody_ wants.

And calling "-r" "rational", when it means "recursive" for diff-tree and 
diff-cache doesn't sound rational to me. It _is_ rational to just silently 
accept it as "recursive", the same way diff-cache does.

		Linus

^ permalink raw reply

* Re: Merge with git-pasky II.
From: Linus Torvalds @ 2005-04-26 22:30 UTC (permalink / raw)
  To: Fabian Franz; +Cc: Bram Cohen, git
In-Reply-To: <200504262336.02583.FabianFranz@gmx.de>



On Tue, 26 Apr 2005, Fabian Franz wrote:
> 
> Am Dienstag, 26. April 2005 23:28 schrieb Bram Cohen:
> > Now you've just gone off the deep end. This is an apples-to-apples
> > comparison. Please accept one of thee following two statements:
> >
> > (a) Git doesn't do merging, and none of the related new tools around it do
> > merging.
> >
> > (b) Codeville merge (sans rename functionality) would be superior for the
> > merging which will be done.
> 
> I have one very humble question:
> 
> Why don't you write and contribute some code for git to do good merging?

Don't bother. Bram doesn't know what he's talking about. 

		Linus

^ permalink raw reply

* Re: [ANNOUNCE] Cogito-0.8 (former git-pasky, big changes!)
From: Pavel Machek @ 2005-04-26 22:21 UTC (permalink / raw)
  To: pasky, git
In-Reply-To: <20050426032422.GQ13467@pasky.ji.cz>

Hi!

>   here goes Cogito-0.8, my SCMish layer over Linus Torvald's git tree
> history tracker. This package was formerly called git-pasky, however
> this release brings big changes. The usage is significantly different,
> as well as some basic concepts; the history changed again (hopefully the
> last time?) because of fixing dates of some old commits. The .git/
> directory layout changed too.
> 
>   Upgrading through pull is possible, but rather difficult and requires
> some intimacy with both git, git-pasky and Cogito. So probably the best
> way to go is to just get cogito-0.8 tarball at
> 
> 	http://www.kernel.org/pub/software/scm/cogito/
> 
> or
> 
> 	ftp://ftp.kernel.org/pub/software/scm/cogito/
> 
> build and install it, and do
> 
> 	cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
> 
> 
> 
>   Yes, this is a huge change. No, I don't expect any further changes of
> similar scale. I think the new interface is significantly simpler _and_
> cleaner than the old one.

It seems to need libcurl-dev... installed.

Error handling could certainly be improved:

pavel@amd:/data/l/cogito$ cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
./cg-clone: line 22: cg-init: command not found
pavel@amd:/data/l/cogito$ PATH=/data/l/cogito:$PATH
pavel@amd:/data/l/cogito$ cg-clone rsync://rsync.kernel.org/pub/scm/cogito/cogito.git
cg-clone: cogito/ already exists

										Pavel
-- 
Boycott Kodak -- for their patent abuse against Java.

^ 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