Git development
 help / color / mirror / Atom feed
* Re: git cherry-pick feature request
From: Junio C Hamano @ 2006-08-23  9:51 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git
In-Reply-To: <17643.62896.396783.890223@cargo.ozlabs.ibm.com>

Paul Mackerras <paulus@samba.org> writes:

> Could I have a flag to git cherry-pick (-q for quiet, maybe) that
> tells it not to print anything if the command succeeds?  Could I also
> have a flag that tells it to clean up if the merge fails and leave the
> tree in its previous state?

Quiet sounds sane.

Reverting to its "previous state" I am not quite sure if it is
worth making it an option and run it as part of cherry-pick.

^ permalink raw reply

* [PATCH] Fix a comparison bug in diff-delta.c
From: Pierre Habouzit @ 2006-08-23  9:17 UTC (permalink / raw)
  To: git; +Cc: Pierre Habouzit

  (1 << i) < hspace is compared in the `int` space rather that in the
  unsigned one.  the result will be wrong if hspace is between 0x40000000
  and 0x80000000.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---

  This is a replacement for <1156300368160-git-send-email-madcoder@debian.org>
  avoiding the ugly cast, and using 1u instead.

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

diff --git a/diff-delta.c b/diff-delta.c
index 7da9205..51e2e56 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -152,7 +152,7 @@ struct delta_index * create_delta_index(
 	   initialization in create_delta(). */
 	entries = (bufsize - 1)  / RABIN_WINDOW;
 	hsize = entries / 4;
-	for (i = 4; (1 << i) < hsize && i < 31; i++);
+	for (i = 4; (1u << i) < hsize && i < 31; i++);
 	hsize = 1 << i;
 	hmask = hsize - 1;
 
-- 
1.4.1.1

^ permalink raw reply related

* Re: stgit: deleting a branch doesn't seem to work
From: Catalin Marinas @ 2006-08-23  9:15 UTC (permalink / raw)
  To: Torgil Svensson; +Cc: git
In-Reply-To: <e7bda7770608221012u269ca577ye83a3a548c4faf08@mail.gmail.com>

On 22/08/06, Torgil Svensson <torgil.svensson@gmail.com> wrote:
> Otherwise I had no problem in my first stgit experience. I first took
> a chance that "stgit import" recognized patches saved by
> "format-patch", but this was easily solved with "stg refresh -e" once
> I found it (thanks #git).

You could also use git-apply which understands the output of
format-patch and change the commits into StGIT patches with "stg
uncommit" (use the latest stgit snapshot as it has some bug-fixes and
can automatically generate the patch name from the commit subject
line).

The tutorial is pretty old and doesn't cover all the commands and options.

-- 
Catalin

^ permalink raw reply

* Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines
From: Haavard Skinnemoen @ 2006-08-23  9:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vd5asjkvb.fsf@assigned-by-dhcp.cox.net>

On Tue, 22 Aug 2006 18:34:16 -0700
Junio C Hamano <junkio@cox.net> wrote:

> The patch looks wrong.  If your name is on CC: and you want to
> suppress sending to yourself what happens?

It will still send it to you, I guess. The documentation only mentions
what happens with From: lines, so I wasn't really sure what behaviour is
expected...

> How about doing something like this instead?

Yeah, that's probably better. I just tested it by sending a mail to
myself, and it doesn't append an extra From: line, so it solves the
problem as far as I'm concerned.

Haavard

> diff --git a/git-send-email.perl b/git-send-email.perl
> index a83c7e9..8adb6b9 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -510,7 +510,7 @@ foreach my $t (@files) {
>  					if ($2 eq $from) {
>  						next if
> ($suppress_from); }
> -					else {
> +					elsif ($1 eq 'From') {
>  						$author_not_sender =
> $2; }
>  					printf("(mbox) Adding cc: %s
> from line '%s'\n",
> 

^ permalink raw reply

* Re: [PATCH 1/3] gitweb: Whitespace cleanup: realign, reindent
From: Andreas Ericsson @ 2006-08-23  9:07 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <ech55l$reh$1@sea.gmane.org>

Jakub Narebski wrote:
> Junio C Hamano wrote:
> 
>> Jakub Narebski <jnareb@gmail.com> writes:
>>
>>> This patch tries (but no too hard) to fit gitweb source in 80 columns,
>>> for 2 columns wide tabs, and indent and align source for better
>>> readibility.
>> If you are doing the wrapping, which I think is a good idea, I
>> do not think you should target for an oddball setting.  Where
>> did you get the idea of 2-column tabs?
> 
> So what is the default? 5-column tabs? 8-column tabs? And to what width?
> 80-column wide? 120-column wide?
> 
> I use 2-column tabs to have code not too wide; minimal sensible width.

Default is 8-column tabs. BSD folks use (used?) 4 column tabs by 
default. I've never seen 2 column tabs, although GNU does 2-step 
indentation (they use spaces though, not tabs).

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

^ permalink raw reply

* Re: [PATCH 1/3] gitweb: Whitespace cleanup: realign, reindent
From: Jakub Narebski @ 2006-08-23  8:55 UTC (permalink / raw)
  To: git
In-Reply-To: <7virkkjkvd.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> This patch tries (but no too hard) to fit gitweb source in 80 columns,
>> for 2 columns wide tabs, and indent and align source for better
>> readibility.
> 
> If you are doing the wrapping, which I think is a good idea, I
> do not think you should target for an oddball setting.  Where
> did you get the idea of 2-column tabs?

So what is the default? 5-column tabs? 8-column tabs? And to what width?
80-column wide? 120-column wide?

I use 2-column tabs to have code not too wide; minimal sensible width.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: [RFC] adding support for md5
From: Shawn Pearce @ 2006-08-23  6:49 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3bbojbzj.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> Shawn Pearce <spearce@spearce.org> writes:
> 
> > Junio C Hamano <junkio@cox.net> wrote:
> >> I personally am not interested in making this configurable at
> >> all.  The hashcmp() change on the other hand to abstract out 20
> >> was a good preparation, if we ever want to switch to longer
> >> hashes we would know where to look.
> >
> > What about all of those memcpy(a, b, 20)'s?  :-)
> 
> Surely.  If you are inclined to, go wild.

Like this?  :-)

-->--
Convert memcpy(a,b,20) to hashcpy(a,b).

This abstracts away the size of the hash values when copying them
from memory location to memory location, much as the introduction
of hashcmp abstracted away hash value comparsion.

A few call sites were using char* rather than unsigned char* so
I added the cast rather than open hashcpy to be void*.  This is a
reasonable tradeoff as most call sites already use unsigned char*
and the existing hashcmp is also declared to be unsigned char*.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 blame.c                  |    4 ++--
 builtin-diff.c           |    4 ++--
 builtin-pack-objects.c   |    6 +++---
 builtin-read-tree.c      |    2 +-
 builtin-unpack-objects.c |    4 ++--
 builtin-update-index.c   |    4 ++--
 builtin-write-tree.c     |    4 ++--
 cache-tree.c             |    6 +++---
 cache.h                  |    4 ++++
 combine-diff.c           |    6 +++---
 connect.c                |    6 +++---
 convert-objects.c        |    6 +++---
 csum-file.c              |    2 +-
 diff.c                   |    4 ++--
 fetch-pack.c             |    2 +-
 fetch.c                  |    2 +-
 fsck-objects.c           |    2 +-
 http-fetch.c             |    2 +-
 http-push.c              |    6 +++---
 index-pack.c             |    4 ++--
 merge-recursive.c        |   20 ++++++++++----------
 mktree.c                 |    4 ++--
 object.c                 |    2 +-
 patch-id.c               |    2 +-
 receive-pack.c           |    4 ++--
 revision.c               |    2 +-
 send-pack.c              |    4 ++--
 sha1_file.c              |   18 +++++++++---------
 sha1_name.c              |   22 +++++++++++-----------
 tree-walk.c              |    4 ++--
 tree.c                   |    2 +-
 unpack-trees.c           |    2 +-
 32 files changed, 85 insertions(+), 81 deletions(-)

diff --git a/blame.c b/blame.c
index c253b9c..5a8af72 100644
--- a/blame.c
+++ b/blame.c
@@ -176,7 +176,7 @@ static int get_blob_sha1(struct tree *t,
 	if (i == 20)
 		return -1;
 
-	memcpy(sha1, blob_sha1, 20);
+	hashcpy(sha1, blob_sha1);
 	return 0;
 }
 
@@ -191,7 +191,7 @@ static int get_blob_sha1_internal(const 
 	    strcmp(blame_file + baselen, pathname))
 		return -1;
 
-	memcpy(blob_sha1, sha1, 20);
+	hashcpy(blob_sha1, sha1);
 	return -1;
 }
 
diff --git a/builtin-diff.c b/builtin-diff.c
index 874f773..a659020 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -192,7 +192,7 @@ static int builtin_diff_combined(struct 
 	parent = xmalloc(ents * sizeof(*parent));
 	/* Again, the revs are all reverse */
 	for (i = 0; i < ents; i++)
-		memcpy(parent + i, ent[ents - 1 - i].item->sha1, 20);
+		hashcpy((unsigned char*)parent + i, ent[ents - 1 - i].item->sha1);
 	diff_tree_combined(parent[0], parent + 1, ents - 1,
 			   revs->dense_combined_merges, revs);
 	return 0;
@@ -290,7 +290,7 @@ int cmd_diff(int argc, const char **argv
 		if (obj->type == OBJ_BLOB) {
 			if (2 <= blobs)
 				die("more than two blobs given: '%s'", name);
-			memcpy(blob[blobs].sha1, obj->sha1, 20);
+			hashcpy(blob[blobs].sha1, obj->sha1);
 			blob[blobs].name = name;
 			blobs++;
 			continue;
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index f19f0d6..46f524d 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -534,7 +534,7 @@ static int add_object_entry(const unsign
 	entry = objects + idx;
 	nr_objects = idx + 1;
 	memset(entry, 0, sizeof(*entry));
-	memcpy(entry->sha1, sha1, 20);
+	hashcpy(entry->sha1, sha1);
 	entry->hash = hash;
 
 	if (object_ix_hashsz * 3 <= nr_objects * 4)
@@ -649,7 +649,7 @@ static struct pbase_tree_cache *pbase_tr
 		free(ent->tree_data);
 		nent = ent;
 	}
-	memcpy(nent->sha1, sha1, 20);
+	hashcpy(nent->sha1, sha1);
 	nent->tree_data = data;
 	nent->tree_size = size;
 	nent->ref = 1;
@@ -799,7 +799,7 @@ static void add_preferred_base(unsigned 
 	it->next = pbase_tree;
 	pbase_tree = it;
 
-	memcpy(it->pcache.sha1, tree_sha1, 20);
+	hashcpy(it->pcache.sha1, tree_sha1);
 	it->pcache.tree_data = data;
 	it->pcache.tree_size = size;
 }
diff --git a/builtin-read-tree.c b/builtin-read-tree.c
index 53087fa..c1867d2 100644
--- a/builtin-read-tree.c
+++ b/builtin-read-tree.c
@@ -53,7 +53,7 @@ static void prime_cache_tree_rec(struct 
 	struct name_entry entry;
 	int cnt;
 
-	memcpy(it->sha1, tree->object.sha1, 20);
+	hashcpy(it->sha1, tree->object.sha1);
 	desc.buf = tree->buffer;
 	desc.size = tree->size;
 	cnt = 0;
diff --git a/builtin-unpack-objects.c b/builtin-unpack-objects.c
index f0ae5c9..ca0ebc2 100644
--- a/builtin-unpack-objects.c
+++ b/builtin-unpack-objects.c
@@ -95,7 +95,7 @@ static void add_delta_to_list(unsigned c
 {
 	struct delta_info *info = xmalloc(sizeof(*info));
 
-	memcpy(info->base_sha1, base_sha1, 20);
+	hashcpy(info->base_sha1, base_sha1);
 	info->size = size;
 	info->delta = delta;
 	info->next = delta_list;
@@ -173,7 +173,7 @@ static int unpack_delta_entry(unsigned l
 	unsigned char base_sha1[20];
 	int result;
 
-	memcpy(base_sha1, fill(20), 20);
+	hashcpy(base_sha1, fill(20));
 	use(20);
 
 	delta_data = get_data(delta_size);
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 5dd91af..8675126 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -142,7 +142,7 @@ static int add_cacheinfo(unsigned int mo
 	size = cache_entry_size(len);
 	ce = xcalloc(1, size);
 
-	memcpy(ce->sha1, sha1, 20);
+	hashcpy(ce->sha1, sha1);
 	memcpy(ce->name, path, len);
 	ce->ce_flags = create_ce_flags(len, stage);
 	ce->ce_mode = create_ce_mode(mode);
@@ -333,7 +333,7 @@ static struct cache_entry *read_one_ent(
 	size = cache_entry_size(namelen);
 	ce = xcalloc(1, size);
 
-	memcpy(ce->sha1, sha1, 20);
+	hashcpy(ce->sha1, sha1);
 	memcpy(ce->name, path, namelen);
 	ce->ce_flags = create_ce_flags(namelen, stage);
 	ce->ce_mode = create_ce_mode(mode);
diff --git a/builtin-write-tree.c b/builtin-write-tree.c
index ca06149..50670dc 100644
--- a/builtin-write-tree.c
+++ b/builtin-write-tree.c
@@ -50,10 +50,10 @@ int write_tree(unsigned char *sha1, int 
 	if (prefix) {
 		struct cache_tree *subtree =
 			cache_tree_find(active_cache_tree, prefix);
-		memcpy(sha1, subtree->sha1, 20);
+		hashcpy(sha1, subtree->sha1);
 	}
 	else
-		memcpy(sha1, active_cache_tree->sha1, 20);
+		hashcpy(sha1, active_cache_tree->sha1);
 
 	rollback_lock_file(lock_file);
 
diff --git a/cache-tree.c b/cache-tree.c
index d9f7e1e..323c68a 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -335,7 +335,7 @@ static int update_one(struct cache_tree 
 		offset += sprintf(buffer + offset,
 				  "%o %.*s", mode, entlen, path + baselen);
 		buffer[offset++] = 0;
-		memcpy(buffer + offset, sha1, 20);
+		hashcpy((unsigned char*)buffer + offset, sha1);
 		offset += 20;
 
 #if DEBUG
@@ -412,7 +412,7 @@ #if DEBUG
 #endif
 
 	if (0 <= it->entry_count) {
-		memcpy(buffer + *offset, it->sha1, 20);
+		hashcpy((unsigned char*)buffer + *offset, it->sha1);
 		*offset += 20;
 	}
 	for (i = 0; i < it->subtree_nr; i++) {
@@ -478,7 +478,7 @@ static struct cache_tree *read_one(const
 	if (0 <= it->entry_count) {
 		if (size < 20)
 			goto free_return;
-		memcpy(it->sha1, buf, 20);
+		hashcpy(it->sha1, (unsigned char*)buf);
 		buf += 20;
 		size -= 20;
 	}
diff --git a/cache.h b/cache.h
index cd2ad90..df642a1 100644
--- a/cache.h
+++ b/cache.h
@@ -222,6 +222,10 @@ static inline int hashcmp(const unsigned
 {
 	return memcmp(sha1, sha2, 20);
 }
+static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
+{
+	memcpy(sha_dst, sha_src, 20);
+}
 
 int git_mkstemp(char *path, size_t n, const char *template);
 
diff --git a/combine-diff.c b/combine-diff.c
index 0682acd..466899d 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -31,9 +31,9 @@ static struct combine_diff_path *interse
 			memset(p->parent, 0,
 			       sizeof(p->parent[0]) * num_parent);
 
-			memcpy(p->sha1, q->queue[i]->two->sha1, 20);
+			hashcpy(p->sha1, q->queue[i]->two->sha1);
 			p->mode = q->queue[i]->two->mode;
-			memcpy(p->parent[n].sha1, q->queue[i]->one->sha1, 20);
+			hashcpy(p->parent[n].sha1, q->queue[i]->one->sha1);
 			p->parent[n].mode = q->queue[i]->one->mode;
 			p->parent[n].status = q->queue[i]->status;
 			*tail = p;
@@ -927,6 +927,6 @@ void diff_tree_combined_merge(const unsi
 	for (parents = commit->parents, num_parent = 0;
 	     parents;
 	     parents = parents->next, num_parent++)
-		memcpy(parent + num_parent, parents->item->object.sha1, 20);
+		hashcpy((unsigned char*)parent + num_parent, parents->item->object.sha1);
 	diff_tree_combined(sha1, parent, num_parent, dense, rev);
 }
diff --git a/connect.c b/connect.c
index 7a6a73f..e501ccc 100644
--- a/connect.c
+++ b/connect.c
@@ -77,7 +77,7 @@ struct ref **get_remote_heads(int in, st
 		if (nr_match && !path_match(name, nr_match, match))
 			continue;
 		ref = xcalloc(1, sizeof(*ref) + len - 40);
-		memcpy(ref->old_sha1, old_sha1, 20);
+		hashcpy(ref->old_sha1, old_sha1);
 		memcpy(ref->name, buffer + 41, len - 40);
 		*list = ref;
 		list = &ref->next;
@@ -208,7 +208,7 @@ static struct ref *try_explicit_object_n
 	len = strlen(name) + 1;
 	ref = xcalloc(1, sizeof(*ref) + len);
 	memcpy(ref->name, name, len);
-	memcpy(ref->new_sha1, sha1, 20);
+	hashcpy(ref->new_sha1, sha1);
 	return ref;
 }
 
@@ -318,7 +318,7 @@ int match_refs(struct ref *src, struct r
 			int len = strlen(src->name) + 1;
 			dst_peer = xcalloc(1, sizeof(*dst_peer) + len);
 			memcpy(dst_peer->name, src->name, len);
-			memcpy(dst_peer->new_sha1, src->new_sha1, 20);
+			hashcpy(dst_peer->new_sha1, src->new_sha1);
 			link_dst_tail(dst_peer, dst_tail);
 		}
 		dst_peer->peer_ref = src;
diff --git a/convert-objects.c b/convert-objects.c
index 4e7ff75..631678b 100644
--- a/convert-objects.c
+++ b/convert-objects.c
@@ -23,7 +23,7 @@ static struct entry * convert_entry(unsi
 static struct entry *insert_new(unsigned char *sha1, int pos)
 {
 	struct entry *new = xcalloc(1, sizeof(struct entry));
-	memcpy(new->old_sha1, sha1, 20);
+	hashcpy(new->old_sha1, sha1);
 	memmove(convert + pos + 1, convert + pos, (nr_convert - pos) * sizeof(struct entry *));
 	convert[pos] = new;
 	nr_convert++;
@@ -54,7 +54,7 @@ static struct entry *lookup_entry(unsign
 static void convert_binary_sha1(void *buffer)
 {
 	struct entry *entry = convert_entry(buffer);
-	memcpy(buffer, entry->new_sha1, 20);
+	hashcpy(buffer, entry->new_sha1);
 }
 
 static void convert_ascii_sha1(void *buffer)
@@ -104,7 +104,7 @@ static int write_subdirectory(void *buff
 		if (!slash) {
 			newlen += sprintf(new + newlen, "%o %s", mode, path);
 			new[newlen++] = '\0';
-			memcpy(new + newlen, (char *) buffer + len - 20, 20);
+			hashcpy((unsigned char*)new + newlen, (unsigned char *) buffer + len - 20);
 			newlen += 20;
 
 			used += len;
diff --git a/csum-file.c b/csum-file.c
index e227889..b7174c6 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -38,7 +38,7 @@ int sha1close(struct sha1file *f, unsign
 	}
 	SHA1_Final(f->buffer, &f->ctx);
 	if (result)
-		memcpy(result, f->buffer, 20);
+		hashcpy(result, f->buffer);
 	if (update)
 		sha1flush(f, 20);
 	if (close(f->fd))
diff --git a/diff.c b/diff.c
index ddf2dea..852c175 100644
--- a/diff.c
+++ b/diff.c
@@ -1107,7 +1107,7 @@ void fill_filespec(struct diff_filespec 
 {
 	if (mode) {
 		spec->mode = canon_mode(mode);
-		memcpy(spec->sha1, sha1, 20);
+		hashcpy(spec->sha1, sha1);
 		spec->sha1_valid = !is_null_sha1(sha1);
 	}
 }
@@ -1200,7 +1200,7 @@ static struct sha1_size_cache *locate_si
 			sizeof(*sha1_size_cache));
 	e = xmalloc(sizeof(struct sha1_size_cache));
 	sha1_size_cache[first] = e;
-	memcpy(e->sha1, sha1, 20);
+	hashcpy(e->sha1, sha1);
 	e->size = size;
 	return e;
 }
diff --git a/fetch-pack.c b/fetch-pack.c
index e18c148..377fede 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -404,7 +404,7 @@ static int everything_local(struct ref *
 			continue;
 		}
 
-		memcpy(ref->new_sha1, local, 20);
+		hashcpy(ref->new_sha1, local);
 		if (!verbose)
 			continue;
 		fprintf(stderr,
diff --git a/fetch.c b/fetch.c
index aeb6bf2..ef60b04 100644
--- a/fetch.c
+++ b/fetch.c
@@ -84,7 +84,7 @@ static int process_commit(struct commit 
 	if (commit->object.flags & COMPLETE)
 		return 0;
 
-	memcpy(current_commit_sha1, commit->object.sha1, 20);
+	hashcpy(current_commit_sha1, commit->object.sha1);
 
 	pull_say("walk %s\n", sha1_to_hex(commit->object.sha1));
 
diff --git a/fsck-objects.c b/fsck-objects.c
index 31e00d8..ae0ec8d 100644
--- a/fsck-objects.c
+++ b/fsck-objects.c
@@ -356,7 +356,7 @@ static void add_sha1_list(unsigned char 
 	int nr;
 
 	entry->ino = ino;
-	memcpy(entry->sha1, sha1, 20);
+	hashcpy(entry->sha1, sha1);
 	nr = sha1_list.nr;
 	if (nr == MAX_SHA1_ENTRIES) {
 		fsck_sha1_list();
diff --git a/http-fetch.c b/http-fetch.c
index d1f74b4..7619b33 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -393,7 +393,7 @@ void prefetch(unsigned char *sha1)
 	char *filename = sha1_file_name(sha1);
 
 	newreq = xmalloc(sizeof(*newreq));
-	memcpy(newreq->sha1, sha1, 20);
+	hashcpy(newreq->sha1, sha1);
 	newreq->repo = alt;
 	newreq->url = NULL;
 	newreq->local = -1;
diff --git a/http-push.c b/http-push.c
index 4849779..ebfcc73 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1874,7 +1874,7 @@ static int one_local_ref(const char *ref
 	struct ref *ref;
 	int len = strlen(refname) + 1;
 	ref = xcalloc(1, sizeof(*ref) + len);
-	memcpy(ref->new_sha1, sha1, 20);
+	hashcpy(ref->new_sha1, sha1);
 	memcpy(ref->name, refname, len);
 	*local_tail = ref;
 	local_tail = &ref->next;
@@ -1909,7 +1909,7 @@ static void one_remote_ref(char *refname
 	}
 
 	ref = xcalloc(1, sizeof(*ref) + len);
-	memcpy(ref->old_sha1, remote_sha1, 20);
+	hashcpy(ref->old_sha1, remote_sha1);
 	memcpy(ref->name, refname, len);
 	*remote_tail = ref;
 	remote_tail = &ref->next;
@@ -2445,7 +2445,7 @@ int main(int argc, char **argv)
 				continue;
 			}
 		}
-		memcpy(ref->new_sha1, ref->peer_ref->new_sha1, 20);
+		hashcpy(ref->new_sha1, ref->peer_ref->new_sha1);
 		if (is_zero_sha1(ref->new_sha1)) {
 			error("cannot happen anymore");
 			rc = -3;
diff --git a/index-pack.c b/index-pack.c
index 96ea687..80bc6cb 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -161,7 +161,7 @@ static void *unpack_raw_entry(unsigned l
 	case OBJ_DELTA:
 		if (pos + 20 >= pack_limit)
 			bad_object(offset, "object extends past end of pack");
-		memcpy(delta_base, pack_base + pos, 20);
+		hashcpy(delta_base, pack_base + pos);
 		pos += 20;
 		/* fallthru */
 	case OBJ_COMMIT:
@@ -304,7 +304,7 @@ static void parse_pack_objects(void)
 		if (obj->type == OBJ_DELTA) {
 			struct delta_entry *delta = &deltas[nr_deltas++];
 			delta->obj = obj;
-			memcpy(delta->base_sha1, base_sha1, 20);
+			hashcpy(delta->base_sha1, base_sha1);
 		} else
 			sha1_object(data, data_size, obj->type, obj->sha1);
 		free(data);
diff --git a/merge-recursive.c b/merge-recursive.c
index 048cca1..8a2f697 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -158,7 +158,7 @@ static struct cache_entry *make_cache_en
 	size = cache_entry_size(len);
 	ce = xcalloc(1, size);
 
-	memcpy(ce->sha1, sha1, 20);
+	hashcpy(ce->sha1, sha1);
 	memcpy(ce->name, path, len);
 	ce->ce_flags = create_ce_flags(len, stage);
 	ce->ce_mode = create_ce_mode(mode);
@@ -355,7 +355,7 @@ static struct path_list *get_unmerged(vo
 		}
 		e = item->util;
 		e->stages[ce_stage(ce)].mode = ntohl(ce->ce_mode);
-		memcpy(e->stages[ce_stage(ce)].sha, ce->sha1, 20);
+		hashcpy(e->stages[ce_stage(ce)].sha, ce->sha1);
 	}
 
 	return unmerged;
@@ -636,10 +636,10 @@ static struct merge_file_info merge_file
 		result.clean = 0;
 		if (S_ISREG(a->mode)) {
 			result.mode = a->mode;
-			memcpy(result.sha, a->sha1, 20);
+			hashcpy(result.sha, a->sha1);
 		} else {
 			result.mode = b->mode;
-			memcpy(result.sha, b->sha1, 20);
+			hashcpy(result.sha, b->sha1);
 		}
 	} else {
 		if (!sha_eq(a->sha1, o->sha1) && !sha_eq(b->sha1, o->sha1))
@@ -648,9 +648,9 @@ static struct merge_file_info merge_file
 		result.mode = a->mode == o->mode ? b->mode: a->mode;
 
 		if (sha_eq(a->sha1, o->sha1))
-			memcpy(result.sha, b->sha1, 20);
+			hashcpy(result.sha, b->sha1);
 		else if (sha_eq(b->sha1, o->sha1))
-			memcpy(result.sha, a->sha1, 20);
+			hashcpy(result.sha, a->sha1);
 		else if (S_ISREG(a->mode)) {
 			int code = 1, fd;
 			struct stat st;
@@ -699,7 +699,7 @@ static struct merge_file_info merge_file
 			if (!(S_ISLNK(a->mode) || S_ISLNK(b->mode)))
 				die("cannot merge modes?");
 
-			memcpy(result.sha, a->sha1, 20);
+			hashcpy(result.sha, a->sha1);
 
 			if (!sha_eq(a->sha1, b->sha1))
 				result.clean = 0;
@@ -1096,11 +1096,11 @@ static int process_entry(const char *pat
 
 		output("Auto-merging %s", path);
 		o.path = a.path = b.path = (char *)path;
-		memcpy(o.sha1, o_sha, 20);
+		hashcpy(o.sha1, o_sha);
 		o.mode = o_mode;
-		memcpy(a.sha1, a_sha, 20);
+		hashcpy(a.sha1, a_sha);
 		a.mode = a_mode;
-		memcpy(b.sha1, b_sha, 20);
+		hashcpy(b.sha1, b_sha);
 		b.mode = b_mode;
 
 		mfi = merge_file(&o, &a, &b,
diff --git a/mktree.c b/mktree.c
index 9324138..56205d1 100644
--- a/mktree.c
+++ b/mktree.c
@@ -30,7 +30,7 @@ static void append_to_tree(unsigned mode
 	ent = entries[used++] = xmalloc(sizeof(**entries) + len + 1);
 	ent->mode = mode;
 	ent->len = len;
-	memcpy(ent->sha1, sha1, 20);
+	hashcpy(ent->sha1, sha1);
 	memcpy(ent->name, path, len+1);
 }
 
@@ -64,7 +64,7 @@ static void write_tree(unsigned char *sh
 		offset += sprintf(buffer + offset, "%o ", ent->mode);
 		offset += sprintf(buffer + offset, "%s", ent->name);
 		buffer[offset++] = 0;
-		memcpy(buffer + offset, ent->sha1, 20);
+		hashcpy((unsigned char*)buffer + offset, ent->sha1);
 		offset += 20;
 	}
 	write_sha1_file(buffer, offset, tree_type, sha1);
diff --git a/object.c b/object.c
index fdcfff7..60bf16b 100644
--- a/object.c
+++ b/object.c
@@ -91,7 +91,7 @@ void created_object(const unsigned char 
 	obj->used = 0;
 	obj->type = OBJ_NONE;
 	obj->flags = 0;
-	memcpy(obj->sha1, sha1, 20);
+	hashcpy(obj->sha1, sha1);
 
 	if (obj_hash_size - 1 <= nr_objs * 2)
 		grow_object_hash();
diff --git a/patch-id.c b/patch-id.c
index 3b4c80f..086d2d9 100644
--- a/patch-id.c
+++ b/patch-id.c
@@ -47,7 +47,7 @@ static void generate_id_list(void)
 
 		if (!get_sha1_hex(p, n)) {
 			flush_current_id(patchlen, sha1, &ctx);
-			memcpy(sha1, n, 20);
+			hashcpy(sha1, n);
 			patchlen = 0;
 			continue;
 		}
diff --git a/receive-pack.c b/receive-pack.c
index 81e9190..2015316 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -247,8 +247,8 @@ static void read_head_info(void)
 				report_status = 1;
 		}
 		cmd = xmalloc(sizeof(struct command) + len - 80);
-		memcpy(cmd->old_sha1, old_sha1, 20);
-		memcpy(cmd->new_sha1, new_sha1, 20);
+		hashcpy(cmd->old_sha1, old_sha1);
+		hashcpy(cmd->new_sha1, new_sha1);
 		memcpy(cmd->ref_name, line + 82, len - 81);
 		cmd->error_string = "n/a (unpacker error)";
 		cmd->next = NULL;
diff --git a/revision.c b/revision.c
index 5a91d06..1d89d72 100644
--- a/revision.c
+++ b/revision.c
@@ -496,7 +496,7 @@ static int add_parents_only(struct rev_i
 		it = get_reference(revs, arg, sha1, 0);
 		if (it->type != OBJ_TAG)
 			break;
-		memcpy(sha1, ((struct tag*)it)->tagged->sha1, 20);
+		hashcpy(sha1, ((struct tag*)it)->tagged->sha1);
 	}
 	if (it->type != OBJ_COMMIT)
 		return 0;
diff --git a/send-pack.c b/send-pack.c
index f7c0cfc..fd79a61 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -185,7 +185,7 @@ static int one_local_ref(const char *ref
 	struct ref *ref;
 	int len = strlen(refname) + 1;
 	ref = xcalloc(1, sizeof(*ref) + len);
-	memcpy(ref->new_sha1, sha1, 20);
+	hashcpy(ref->new_sha1, sha1);
 	memcpy(ref->name, refname, len);
 	*local_tail = ref;
 	local_tail = &ref->next;
@@ -310,7 +310,7 @@ static int send_pack(int in, int out, in
 				continue;
 			}
 		}
-		memcpy(ref->new_sha1, ref->peer_ref->new_sha1, 20);
+		hashcpy(ref->new_sha1, ref->peer_ref->new_sha1);
 		if (is_zero_sha1(ref->new_sha1)) {
 			error("cannot happen anymore");
 			ret = -3;
diff --git a/sha1_file.c b/sha1_file.c
index 4b1be72..789deb7 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -558,7 +558,7 @@ struct packed_git *add_packed_git(char *
 	p->pack_use_cnt = 0;
 	p->pack_local = local;
 	if ((path_len > 44) && !get_sha1_hex(path + path_len - 44, sha1))
-		memcpy(p->sha1, sha1, 20);
+		hashcpy(p->sha1, sha1);
 	return p;
 }
 
@@ -589,7 +589,7 @@ struct packed_git *parse_pack_index_file
 	p->pack_base = NULL;
 	p->pack_last_used = 0;
 	p->pack_use_cnt = 0;
-	memcpy(p->sha1, sha1, 20);
+	hashcpy(p->sha1, sha1);
 	return p;
 }
 
@@ -971,7 +971,7 @@ int check_reuse_pack_delta(struct packed
 	ptr = unpack_object_header(p, ptr, kindp, sizep);
 	if (*kindp != OBJ_DELTA)
 		goto done;
-	memcpy(base, (unsigned char *) p->pack_base + ptr, 20);
+	hashcpy(base, (unsigned char *) p->pack_base + ptr);
 	status = 0;
  done:
 	unuse_packed_git(p);
@@ -999,7 +999,7 @@ void packed_object_info_detail(struct pa
 		if (p->pack_size <= offset + 20)
 			die("pack file %s records an incomplete delta base",
 			    p->pack_name);
-		memcpy(base_sha1, pack, 20);
+		hashcpy(base_sha1, pack);
 		do {
 			struct pack_entry base_ent;
 			unsigned long junk;
@@ -1219,7 +1219,7 @@ int nth_packed_object_sha1(const struct 
 	void *index = p->index_base + 256;
 	if (n < 0 || num_packed_objects(p) <= n)
 		return -1;
-	memcpy(sha1, (char *) index + (24 * n) + 4, 20);
+	hashcpy(sha1, (unsigned char *) index + (24 * n) + 4);
 	return 0;
 }
 
@@ -1236,7 +1236,7 @@ int find_pack_entry_one(const unsigned c
 		int cmp = hashcmp((unsigned char *)index + (24 * mi) + 4, sha1);
 		if (!cmp) {
 			e->offset = ntohl(*((unsigned int *) ((char *) index + (24 * mi))));
-			memcpy(e->sha1, sha1, 20);
+			hashcpy(e->sha1, sha1);
 			e->p = p;
 			return 1;
 		}
@@ -1349,7 +1349,7 @@ void *read_object_with_reference(const u
 	unsigned long isize;
 	unsigned char actual_sha1[20];
 
-	memcpy(actual_sha1, sha1, 20);
+	hashcpy(actual_sha1, sha1);
 	while (1) {
 		int ref_length = -1;
 		const char *ref_type = NULL;
@@ -1360,7 +1360,7 @@ void *read_object_with_reference(const u
 		if (!strcmp(type, required_type)) {
 			*size = isize;
 			if (actual_sha1_return)
-				memcpy(actual_sha1_return, actual_sha1, 20);
+				hashcpy(actual_sha1_return, actual_sha1);
 			return buffer;
 		}
 		/* Handle references */
@@ -1555,7 +1555,7 @@ int write_sha1_file(void *buf, unsigned 
 	 */
 	filename = write_sha1_file_prepare(buf, len, type, sha1, hdr, &hdrlen);
 	if (returnsha1)
-		memcpy(returnsha1, sha1, 20);
+		hashcpy(returnsha1, sha1);
 	if (has_sha1_file(sha1))
 		return 0;
 	fd = open(filename, O_RDONLY);
diff --git a/sha1_name.c b/sha1_name.c
index b6c198f..8a5809e 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -109,7 +109,7 @@ static int find_short_packed_object(int 
 				    !match_sha(len, match, next)) {
 					/* unique within this pack */
 					if (!found) {
-						memcpy(found_sha1, now, 20);
+						hashcpy(found_sha1, now);
 						found++;
 					}
 					else if (hashcmp(found_sha1, now)) {
@@ -126,7 +126,7 @@ static int find_short_packed_object(int 
 		}
 	}
 	if (found == 1)
-		memcpy(sha1, found_sha1, 20);
+		hashcpy(sha1, found_sha1);
 	return found;
 }
 
@@ -146,13 +146,13 @@ static int find_unique_short_object(int 
 	if (1 < has_unpacked || 1 < has_packed)
 		return SHORT_NAME_AMBIGUOUS;
 	if (has_unpacked != has_packed) {
-		memcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1), 20);
+		hashcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1));
 		return 0;
 	}
 	/* Both have unique ones -- do they match? */
 	if (hashcmp(packed_sha1, unpacked_sha1))
 		return SHORT_NAME_AMBIGUOUS;
-	memcpy(sha1, packed_sha1, 20);
+	hashcpy(sha1, packed_sha1);
 	return 0;
 }
 
@@ -326,13 +326,13 @@ static int get_parent(const char *name, 
 	if (parse_commit(commit))
 		return -1;
 	if (!idx) {
-		memcpy(result, commit->object.sha1, 20);
+		hashcpy(result, commit->object.sha1);
 		return 0;
 	}
 	p = commit->parents;
 	while (p) {
 		if (!--idx) {
-			memcpy(result, p->item->object.sha1, 20);
+			hashcpy(result, p->item->object.sha1);
 			return 0;
 		}
 		p = p->next;
@@ -353,9 +353,9 @@ static int get_nth_ancestor(const char *
 
 		if (!commit || parse_commit(commit) || !commit->parents)
 			return -1;
-		memcpy(sha1, commit->parents->item->object.sha1, 20);
+		hashcpy(sha1, commit->parents->item->object.sha1);
 	}
-	memcpy(result, sha1, 20);
+	hashcpy(result, sha1);
 	return 0;
 }
 
@@ -407,7 +407,7 @@ static int peel_onion(const char *name, 
 		o = deref_tag(o, name, sp - name - 2);
 		if (!o || (!o->parsed && !parse_object(o->sha1)))
 			return -1;
-		memcpy(sha1, o->sha1, 20);
+		hashcpy(sha1, o->sha1);
 	}
 	else {
 		/* At this point, the syntax look correct, so
@@ -419,7 +419,7 @@ static int peel_onion(const char *name, 
 			if (!o || (!o->parsed && !parse_object(o->sha1)))
 				return -1;
 			if (o->type == expected_type) {
-				memcpy(sha1, o->sha1, 20);
+				hashcpy(sha1, o->sha1);
 				return 0;
 			}
 			if (o->type == OBJ_TAG)
@@ -526,7 +526,7 @@ int get_sha1(const char *name, unsigned 
 			    memcmp(ce->name, cp, namelen))
 				break;
 			if (ce_stage(ce) == stage) {
-				memcpy(sha1, ce->sha1, 20);
+				hashcpy(sha1, ce->sha1);
 				return 0;
 			}
 			pos++;
diff --git a/tree-walk.c b/tree-walk.c
index 3f83e98..14cc5ae 100644
--- a/tree-walk.c
+++ b/tree-walk.c
@@ -179,7 +179,7 @@ static int find_tree_entry(struct tree_d
 		if (cmp < 0)
 			break;
 		if (entrylen == namelen) {
-			memcpy(result, sha1, 20);
+			hashcpy(result, sha1);
 			return 0;
 		}
 		if (name[entrylen] != '/')
@@ -187,7 +187,7 @@ static int find_tree_entry(struct tree_d
 		if (!S_ISDIR(*mode))
 			break;
 		if (++entrylen == namelen) {
-			memcpy(result, sha1, 20);
+			hashcpy(result, sha1);
 			return 0;
 		}
 		return get_tree_entry(sha1, name + entrylen, result, mode);
diff --git a/tree.c b/tree.c
index ef456be..ea386e5 100644
--- a/tree.c
+++ b/tree.c
@@ -25,7 +25,7 @@ static int read_one_entry(const unsigned
 	ce->ce_flags = create_ce_flags(baselen + len, stage);
 	memcpy(ce->name, base, baselen);
 	memcpy(ce->name + baselen, pathname, len+1);
-	memcpy(ce->sha1, sha1, 20);
+	hashcpy(ce->sha1, sha1);
 	return add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DFCHECK);
 }
 
diff --git a/unpack-trees.c b/unpack-trees.c
index 467d994..3ac0289 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -200,7 +200,7 @@ #endif
 
 			any_files = 1;
 
-			memcpy(ce->sha1, posns[i]->sha1, 20);
+			hashcpy(ce->sha1, posns[i]->sha1);
 			src[i + o->merge] = ce;
 			subposns[i] = df_conflict_list;
 			posns[i] = posns[i]->next;
-- 
1.4.2.gfec68

^ permalink raw reply related

* Re: Tiny default fonts in gitk
From: Paul Mackerras @ 2006-08-23  6:37 UTC (permalink / raw)
  To: Peter Eriksen; +Cc: git
In-Reply-To: <20060811100706.GA22767@bohr.gbar.dtu.dk>

Peter Eriksen writes:

> Is it just some X/Tk setting causing this, or is point 9 just very
> small?  This is under Fedora Core 5.  Changing these sizes to 12 gives
> the text the same size as in the rest of the desktop.  It would be nice,
> if that was the default.

First, check what X thinks your display resolution (dots per inch)
is.  If it thinks the resolution is 75dpi but your monitor is doing
more like 100dpi that will make the fonts small.

Secondly, you can use control -KP+ and control-KP- to change the font
size.

Paul.

^ permalink raw reply

* git cherry-pick feature request
From: Paul Mackerras @ 2006-08-23  6:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio,

I have added a feature on the "new" branch of gitk which allows the
user to cherry-pick commits on to the head of the current branch.
Currently I am using 'sh -c "git cherry-pick -r $id 2>&1"' for this.

The reason for the "2>&1" is that git cherry-pick writes stuff to
stderr even when there is no error, and the Tcl exec command assumes
that if the command writes to stderr that it failed somehow.

Also, if the merge fails, git cherry-pick leaves the commit partially
merged rather than restoring the original state.

Could I have a flag to git cherry-pick (-q for quiet, maybe) that
tells it not to print anything if the command succeeds?  Could I also
have a flag that tells it to clean up if the merge fails and leave the
tree in its previous state?

Or is there some other git command that already does all this that I
should use instead?

Thanks,
Paul.

^ permalink raw reply

* Re: [PATCH] gitweb: bugfix: a.list formatting regression
From: Junio C Hamano @ 2006-08-23  5:23 UTC (permalink / raw)
  To: ltuikov; +Cc: git, Jakub Narebski
In-Reply-To: <20060823044545.25836.qmail@web31802.mail.mud.yahoo.com>

Luben Tuikov <ltuikov@yahoo.com> writes:

>> The fix is to add "subject" class and use this class
>> to replace pre-format_subject_html formatting of subject
>> (comment) via using (or not) <b>...</b> element. This
>> should go back to the pre-17d0744318... style.
>> 
>> Regression noticed by Luben Tuikov.
>> 
>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
>> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
>> ---
>
> ACK. Looks good.
>
>     Luben

Thanks, both.

^ permalink raw reply

* Re: [RFC] adding support for md5
From: Junio C Hamano @ 2006-08-23  4:46 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: git
In-Reply-To: <20060823041453.GA25796@spearce.org>

Shawn Pearce <spearce@spearce.org> writes:

> Junio C Hamano <junkio@cox.net> wrote:
>> I personally am not interested in making this configurable at
>> all.  The hashcmp() change on the other hand to abstract out 20
>> was a good preparation, if we ever want to switch to longer
>> hashes we would know where to look.
>
> What about all of those memcpy(a, b, 20)'s?  :-)

Surely.  If you are inclined to, go wild.

> I can see us wanting to support say SHA-128 or SHA-256 in a few
> years.  Especially as processors get faster and better attacks are
> developed against SHA-1 such that its no longer really the best
> trade-off hash function available.

^ permalink raw reply

* Re: [PATCH] gitweb: bugfix: a.list formatting regression
From: Luben Tuikov @ 2006-08-23  4:45 UTC (permalink / raw)
  To: git, Jakub Narebski; +Cc: Junio C Hamano
In-Reply-To: <11562409683011-git-send-email-jnareb@git.vger.kernel.org>

--- Jakub Narebski <jnareb@git.vger.kernel.org> wrote:

> From: Jakub Narebski <jnareb@gmail.com>
> 
> Fix regression introduced by
> commit 17d07443188909ef5f8b8c24043cb6d9fef51bca.
> 
> "a.list" being "bold", makes a myriad of things shown by
> gitweb in bold font-weight, which is a regression from
> pre-17d07443188909ef5f8b8c24043cb6d9fef51bca behavior.
> 
> The fix is to add "subject" class and use this class
> to replace pre-format_subject_html formatting of subject
> (comment) via using (or not) <b>...</b> element. This
> should go back to the pre-17d0744318... style.
> 
> Regression noticed by Luben Tuikov.
> 
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> ---

ACK. Looks good.

    Luben


> Luben Tuikov wrote:
> 
> > 1. Commit 17d07443188909ef5f8b8c24043cb6d9fef51bca defines
> > "a.list" twice in gitweb.css, once with bold and once with
> > normal font-weight.
> 
> "table.tags a.list" means "a.list" inside "table.tags",
> so it is not redefinition of "a.list", but override
> (more specific CSS rule wins). It is for subject of tags
> list ("summary" and "tags" actions) to be in normal
> weight, as in such list the tag itself (ref) is in bold,
> not the tag comment (first line of free form part of tag).
> 
>  gitweb/gitweb.css  |    7 +++++--
>  gitweb/gitweb.perl |    4 ++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
> index 9013895..6c13d9e 100644
> --- a/gitweb/gitweb.css
> +++ b/gitweb/gitweb.css
> @@ -117,11 +117,14 @@ div.list_head {
>  
>  a.list {
>  	text-decoration: none;
> -	font-weight: bold;
>  	color: #000000;
>  }
>  
> -table.tags a.list {
> +a.subject {
> +	font-weight: bold;
> +}
> +
> +table.tags a.subject {
>  	font-weight: normal;
>  }
>  
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 90157d5..40c5177 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -504,11 +504,11 @@ sub format_subject_html {
>  	$extra = '' unless defined($extra);
>  
>  	if (length($short) < length($long)) {
> -		return $cgi->a({-href => $href, -class => "list",
> +		return $cgi->a({-href => $href, -class => "list subject",
>  		                -title => $long},
>  		       esc_html($short) . $extra);
>  	} else {
> -		return $cgi->a({-href => $href, -class => "list"},
> +		return $cgi->a({-href => $href, -class => "list subject"},
>  		       esc_html($long)  . $extra);
>  	}
>  }
> -- 
> 1.4.1.1
> 
> 

^ permalink raw reply

* Re: [PATCH] gitweb: bugfix: a.list formatting regression
From: Luben Tuikov @ 2006-08-23  4:43 UTC (permalink / raw)
  To: Jakub Narebski, git; +Cc: Junio C Hamano, Jakub Narebski
In-Reply-To: <11562409683011-git-send-email-jnareb@git.vger.kernel.org>

--- Jakub Narebski <jnareb@git.vger.kernel.org> wrote:

> From: Jakub Narebski <jnareb@gmail.com>
> 
> Fix regression introduced by
> commit 17d07443188909ef5f8b8c24043cb6d9fef51bca.
> 
> "a.list" being "bold", makes a myriad of things shown by
> gitweb in bold font-weight, which is a regression from
> pre-17d07443188909ef5f8b8c24043cb6d9fef51bca behavior.
> 
> The fix is to add "subject" class and use this class
> to replace pre-format_subject_html formatting of subject
> (comment) via using (or not) <b>...</b> element. This
> should go back to the pre-17d0744318... style.
> 
> Regression noticed by Luben Tuikov.
> 
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
> ---

ACK.  Looks good.

   Luben


> Luben Tuikov wrote:
> 
> > 1. Commit 17d07443188909ef5f8b8c24043cb6d9fef51bca defines
> > "a.list" twice in gitweb.css, once with bold and once with
> > normal font-weight.
> 
> "table.tags a.list" means "a.list" inside "table.tags",
> so it is not redefinition of "a.list", but override
> (more specific CSS rule wins). It is for subject of tags
> list ("summary" and "tags" actions) to be in normal
> weight, as in such list the tag itself (ref) is in bold,
> not the tag comment (first line of free form part of tag).
> 
>  gitweb/gitweb.css  |    7 +++++--
>  gitweb/gitweb.perl |    4 ++--
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
> index 9013895..6c13d9e 100644
> --- a/gitweb/gitweb.css
> +++ b/gitweb/gitweb.css
> @@ -117,11 +117,14 @@ div.list_head {
>  
>  a.list {
>  	text-decoration: none;
> -	font-weight: bold;
>  	color: #000000;
>  }
>  
> -table.tags a.list {
> +a.subject {
> +	font-weight: bold;
> +}
> +
> +table.tags a.subject {
>  	font-weight: normal;
>  }
>  
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 90157d5..40c5177 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -504,11 +504,11 @@ sub format_subject_html {
>  	$extra = '' unless defined($extra);
>  
>  	if (length($short) < length($long)) {
> -		return $cgi->a({-href => $href, -class => "list",
> +		return $cgi->a({-href => $href, -class => "list subject",
>  		                -title => $long},
>  		       esc_html($short) . $extra);
>  	} else {
> -		return $cgi->a({-href => $href, -class => "list"},
> +		return $cgi->a({-href => $href, -class => "list subject"},
>  		       esc_html($long)  . $extra);
>  	}
>  }
> -- 
> 1.4.1.1
> 
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply

* Re: [RFC] adding support for md5
From: Shawn Pearce @ 2006-08-23  4:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vr6z9s376.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano <junkio@cox.net> wrote:
> I personally am not interested in making this configurable at
> all.  The hashcmp() change on the other hand to abstract out 20
> was a good preparation, if we ever want to switch to longer
> hashes we would know where to look.

What about all of those memcpy(a, b, 20)'s?  :-)

I can see us wanting to support say SHA-128 or SHA-256 in a few
years.  Especially as processors get faster and better attacks are
developed against SHA-1 such that its no longer really the best
trade-off hash function available.

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] Fix a comparison bug in diff-delta.c
From: Nicolas Pitre @ 2006-08-23  3:17 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: git
In-Reply-To: <1156300368160-git-send-email-madcoder@debian.org>

On Wed, 23 Aug 2006, Pierre Habouzit wrote:

> (1 << i) < hspace is compared in the `int` space rather that in the unsigned one.
> the result will be wrong if hspace is between  0x40000000 and 0x80000000.
> 
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>

Could you use (1u << i) instead of (unsigned)(1 << i) ?  That looks 
prettier to me at least.


Nicolas

^ permalink raw reply

* [PATCH] proper C syntax (inline has to be placed before the return type).
From: Pierre Habouzit @ 2006-08-23  2:41 UTC (permalink / raw)
  To: git; +Cc: Pierre Habouzit

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
 strbuf.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/strbuf.c b/strbuf.c
index 9d9d8be..c8174b4 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -13,7 +13,7 @@ static void strbuf_begin(struct strbuf *
 	strbuf_init(sb);
 }
 
-static void inline strbuf_add(struct strbuf *sb, int ch) {
+static inline void strbuf_add(struct strbuf *sb, int ch) {
 	if (sb->alloc <= sb->len) {
 		sb->alloc = sb->alloc * 3 / 2 + 16;
 		sb->buf = xrealloc(sb->buf, sb->alloc);
-- 
1.4.1.1

^ permalink raw reply related

* Re: [PATCH] Fix a comparison bug in diff-delta.c
From: Pierre Habouzit @ 2006-08-23  2:38 UTC (permalink / raw)
  To: git
In-Reply-To: <1156300368160-git-send-email-madcoder@debian.org>

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

Le mer 23 août 2006 04:32, Pierre Habouzit a écrit :
>   I'm currently trying to make git compile with more strict gcc flags
> (-g -O2 -Wall -Wextra -Wno-unused -Werror to be precise) and I've
> spotted a first bug due to a signed/unsigned comparison.

still in the same kind of "problems" sha1_name.c:512 has:

		if (active_nr < 0)
			return -1;

but active_nr is defined as an unsigned (in cache.h/cache-read.c).

Also note that there is a *lot* of signed/unsigned comparisons due to 
the fact that it's unsigned, and that it's often compared to positions 
that are ints (I assume pos need the negative values to mean "error").

so either those two lines are too much, or active_nr has to be a plain 
signed int. I'm not used to git sources enough yet to be able to make 
the right decision.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

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

^ permalink raw reply

* [PATCH] Fix a comparison bug in diff-delta.c
From: Pierre Habouzit @ 2006-08-23  2:32 UTC (permalink / raw)
  To: git; +Cc: Pierre Habouzit

(1 << i) < hspace is compared in the `int` space rather that in the unsigned one.
the result will be wrong if hspace is between  0x40000000 and 0x80000000.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---

  I'm currently trying to make git compile with more strict gcc flags
(-g -O2 -Wall -Wextra -Wno-unused -Werror to be precise) and I've
spotted a first bug due to a signed/unsigned comparison.

  If I do understand that bit of code, it should not bite a lot of
people, but this is still a bug ;)


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

diff --git a/diff-delta.c b/diff-delta.c
index 7da9205..a1fadc9 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -152,7 +152,7 @@ struct delta_index * create_delta_index(
 	   initialization in create_delta(). */
 	entries = (bufsize - 1)  / RABIN_WINDOW;
 	hsize = entries / 4;
-	for (i = 4; (1 << i) < hsize && i < 31; i++);
+	for (i = 4; (unsigned)(1 << i) < hsize && i < 31; i++);
 	hsize = 1 << i;
 	hmask = hsize - 1;
 
-- 
1.4.1.1

^ permalink raw reply related

* Re: [PATCH repost] Multiple refs from the same remote in one git fetch
From: Junio C Hamano @ 2006-08-23  1:34 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: git
In-Reply-To: <20060822151029.GA19247@mellanox.co.il>

Although this round does not seem to break tests like before, I
still do not see a valid use case for it.  So...

^ permalink raw reply

* Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines
From: Junio C Hamano @ 2006-08-23  1:34 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: git
In-Reply-To: <1156253919761-git-send-email-hskinnemoen@atmel.com>

Haavard Skinnemoen <hskinnemoen@atmel.com> writes:

> When an mbox-style patch contains a Cc: line in the header,
> git-send-email will check the address against the sender specified
> on the command line. If they don't match, sender_not_author will
> be set to the address obtained from the Cc line.

> @@ -506,7 +506,7 @@ foreach my $t (@files) {
>  				if (/^Subject:\s+(.*)$/) {
>  					$subject = $1;
>  
> -				} elsif (/^(Cc|From):\s+(.*)$/) {
> +				} elsif (/^(From):\s+(.*)$/) {
>  					if ($2 eq $from) {
>  						next if ($suppress_from);
>  					}
> @@ -516,8 +516,11 @@ foreach my $t (@files) {
>  					printf("(mbox) Adding cc: %s from line '%s'\n",
>  						$2, $_) unless $quiet;
>  					push @cc, $2;
> +				} elsif (/^(Cc):\s+(.*)$/) {
> +					printf("(mbox) Adding cc: %s from line '%s'\n",
> +						$2, $_) unless $quiet;
> +					push @cc, $2;
>  				}
> -
>  			} else {
>  				# In the traditional
>  				# "send lots of email" format,

The patch looks wrong.  If your name is on CC: and you want to
suppress sending to yourself what happens?

How about doing something like this instead?

diff --git a/git-send-email.perl b/git-send-email.perl
index a83c7e9..8adb6b9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -510,7 +510,7 @@ foreach my $t (@files) {
 					if ($2 eq $from) {
 						next if ($suppress_from);
 					}
-					else {
+					elsif ($1 eq 'From') {
 						$author_not_sender = $2;
 					}
 					printf("(mbox) Adding cc: %s from line '%s'\n",

^ permalink raw reply related

* Re: [PATCH 1/3] gitweb: Whitespace cleanup: realign, reindent
From: Junio C Hamano @ 2006-08-23  1:34 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200608221652.50443.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> This patch tries (but no too hard) to fit gitweb source in 80 columns,
> for 2 columns wide tabs, and indent and align source for better
> readibility.

If you are doing the wrapping, which I think is a good idea, I
do not think you should target for an oddball setting.  Where
did you get the idea of 2-column tabs?

> While at it added comment to 'snapshot' entry defaults for %feature
> hash, corrected "blobl" action in git_blame2 and git_blame to "blob",
> key of argument to $cgi->a from 'class' to '-class'.

All look good otherwise; applied.

> +our %feature = (
> +	# feature => {'sub' => feature-sub, 'override' => allow-override, 'default' => [ default options...]
> +	# if feature is overridable, feature-sub will be called with default options;
> +	# return value indicates if to enable specified feature

I'd prefer if you wrapped these to match the real ones.

> +	'snapshot' => {
> +		'sub' => \&feature_snapshot,
> +		'override' => 0,
> +		#         => [content-encoding, suffix, program]
> +		'default' => ['x-gzip', 'gz', 'gzip']},
>  );

Because making this 3-tuple into a hashref would be an overkill,
it is a very good idea to comment it here.

^ permalink raw reply

* Re: [PATCH 4/3] gitweb: Use here-doc
From: Junio C Hamano @ 2006-08-23  1:34 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <200608222342.53861.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index e09204d..5301213 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1185,11 +1185,13 @@ sub die_error {
>  	my $error = shift || "Malformed query, file missing or permission 
> denied";

Corrupt patch applied by hand.  Please check the result in
"next".

^ permalink raw reply

* Re: [PATCH] Added support for dropping privileges to git-daemon.
From: Junio C Hamano @ 2006-08-22 23:40 UTC (permalink / raw)
  To: Tilman Sauerbeck; +Cc: git
In-Reply-To: <1156268432.16120@hammerfest>

Tilman Sauerbeck <tilman@code-monkey.de> writes:

> @@ -93,6 +94,21 @@ OPTIONS
>  --pid-file=file::
>  	Save the process id in 'file'.
>  
> +--user=user::
> +--group=group::

Probably

	--user=user, --group=group::

Also check for asciidoc formatting please; it's rather picky.

> +	These two options may be used to make `git-daemon` change its uid and
> +	gid	before entering the server loop.
> +	The uid that's used is the one of 'user'. If `group` is specified,
> +	the gid is set to the one of 'group', otherwise, the default gid
> +	of 'user' is used.

Funny whitespaces all over the place...

What is the pw_gid stored in struct passwd for the user?
getgroups(2) gives supplementary group IDs, so perhaps it is
called primary group ID?

> +	Both `group` and `user` need to be passed as the name of the resp of
> +	the group, ie you'll get unexpected results if you pass an uid/a gid.

Gaah, but that is probably OK.  I'd explicitly say they are
always interpreted as name and never numeric.  An alternative
would be to be nice and when getpwnam() and/or getgrnam()
returns NULL try to interpret them as numeric, which might help
a small dedicated server installation that does not have any
/etc/passwd or /etc/group file ;-) but I do not think that would
be worth the confusion.

> +	Note that you probably don't want to use these options if you run
> +	git-daemon in inetd mode, since inetd can do the privilege dropping
> +	for you.

Gaah again.  These options do not have any effect (other than
sanity checking) on the inetd_mode codepath, so instead of
saying this in the documentation I would suggest specifying
these options an error under --inetd.

Something like this on top of your patch perhaps.

diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 8f850fa..17619a3 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -94,20 +94,16 @@ OPTIONS
 --pid-file=file::
 	Save the process id in 'file'.
 
---user=user::
---group=group::
-	These two options may be used to make `git-daemon` change its uid and
-	gid	before entering the server loop.
-	The uid that's used is the one of 'user'. If `group` is specified,
-	the gid is set to the one of 'group', otherwise, the default gid
-	of 'user' is used.
-
-	Both `group` and `user` need to be passed as the name of the resp of
-	the group, ie you'll get unexpected results if you pass an uid/a gid.
-
-	Note that you probably don't want to use these options if you run
-	git-daemon in inetd mode, since inetd can do the privilege dropping
-	for you.
+--user=user, --group=group::
+	Change daemon's uid and gid before entering the service loop.
+	When only `--user` is given without `--group`, the
+	primary group ID for the user is used.  The values of
+	the option are given to `getpwnam(3)` and `getgrnam(3)`
+	and numeric IDs are not supported.
++
+Giving these options is an error when used with `--inetd`; use
+the facility of inet daemon to achieve the same before spawning
+`git-daemon` if needed.
 
 <directory>::
 	A directory to add to the whitelist of allowed directories. Unless
diff --git a/daemon.c b/daemon.c
index 4e94210..dd3915a 100644
--- a/daemon.c
+++ b/daemon.c
@@ -821,6 +821,9 @@ int main(int argc, char **argv)
 		usage(daemon_usage);
 	}
 
+	if (inetd_mode && (group_name || user_name))
+		die("--user and --group are incompatible with --inetd");
+
 	if (group_name && !user_name)
 		die("--group supplied without --user");
 

^ permalink raw reply related

* Re: [PATCH] gitweb: bugfix: a.list formatting regression
From: Junio C Hamano @ 2006-08-22 23:14 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git
In-Reply-To: <ecg1fd$3uj$2@sea.gmane.org>

Jakub Narebski <jnareb@gmail.com> writes:

> Junio C Hamano wrote:
>
>> It might be worthwhile to do a full sweep of the pages we
>> generate and identify what classes we would want.  I have a
>> feeling that we overuse a.list for example -- they are all in
>> some form of list alright but they might benefit from a bit
>> finer logical separatoin.  One list is enumaration of refs and
>> another is a chronological sequence of commits.
>> 
>> Then people who would want to tweak the presentation would have
>> an easier time changing only gitweb.css.
>
> Next patch in this series of patches 
>    [PATCH] gitweb: Replace some presentational HTML by CSS
>    Message-Id: <11562431392439-git-send-email-jnareb@git.vger.kernel.org>
> adds "name" subclass (a.list.name) for ref names. (I think
> subclasses/multiple classes is the way to do it, as all a.list
> elements have something in common: use next class to divide).

I agree about the implementation aspect, such as using
"list.name" as class names; I was suggesting to start from
design.

^ permalink raw reply

* Re: [PATCH] gitweb: bugfix: a.list formatting regression
From: Jakub Narebski @ 2006-08-22 22:46 UTC (permalink / raw)
  To: git
In-Reply-To: <7vr6z8mmb7.fsf@assigned-by-dhcp.cox.net>

Junio C Hamano wrote:

> Jakub Narebski <jnareb@git.vger.kernel.org> writes:
(the above is result of paste in wrong place in git-send-email invocation)
[...]
>> The fix is to add "subject" class and use this class
>> to replace pre-format_subject_html formatting of subject
>> (comment) via using (or not) <b>...</b> element. This
>> should go back to the pre-17d0744318... style.
[...]
> 
> I haven't seen an Ack from Luben for the proposed renaming of
> the class, although I very much like naming things for what they
> mean (i.e. "subject"), not what they do (i.e. "bold") myself.
> 
> It might be worthwhile to do a full sweep of the pages we
> generate and identify what classes we would want.  I have a
> feeling that we overuse a.list for example -- they are all in
> some form of list alright but they might benefit from a bit
> finer logical separatoin.  One list is enumaration of refs and
> another is a chronological sequence of commits.
> 
> Then people who would want to tweak the presentation would have
> an easier time changing only gitweb.css.

Next patch in this series of patches 
   [PATCH] gitweb: Replace some presentational HTML by CSS
   Message-Id: <11562431392439-git-send-email-jnareb@git.vger.kernel.org>
adds "name" subclass (a.list.name) for ref names. (I think
subclasses/multiple classes is the way to do it, as all a.list
elements have something in common: use next class to divide).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ 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