* Re: [PATCH] Add git-imap-send.
From: Linus Torvalds @ 2006-03-09 18:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Mike McCormack
In-Reply-To: <7vmzfz5w2k.fsf@assigned-by-dhcp.cox.net>
On Thu, 9 Mar 2006, Junio C Hamano wrote:
>
> Linus Torvalds <torvalds@osdl.org> writes:
>
> > it's entirely possible that it will load bytes from "string" _past_ the
> > end of the string because of an unrolled inner loop that does things
> > multiple bytes at a time. They won't be used in the eventual result, but
> > just the fact that they are loaded from memory can mean that your program
> > takes a SIGSEGV, for example, becaue it turns out "string" was just a
> > single NUL byte at the end of a page, and there's nothing after it.
>
> Funny. I've seen this exact bug in memcmp and strcmp in earlier
> SunOS (pre Solaris) libc when I was working on something like
> Valgrind in my previous life.
Well, Valgrind actually can complain for no good reason.
System libraries often take advantage of knowing how the CPU and the
system memory layout works. For example, just from knowing that pages are
always aligned to a certain (largish) boundary, you can know that it's
perfectly safe to do certain optimizations and prefetch past the end of an
object, as long as it's in the same page (and the easiest way to verify
that is to just do it when something is aligned).
So Valgrind will sometimes complain about perfectly bug-free code, just
because the bug-free code accesses outside the "strictly allowable"
region because it knows it can.
Valgrind can be taught about system libraries like that, but especially if
it's an early port to a new architecture or OS, valgrind will often
complain unnecessarily.
Linus
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Junio C Hamano @ 2006-03-09 18:09 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git, Mike McCormack
In-Reply-To: <Pine.LNX.4.64.0603090836030.18022@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> it's entirely possible that it will load bytes from "string" _past_ the
> end of the string because of an unrolled inner loop that does things
> multiple bytes at a time. They won't be used in the eventual result, but
> just the fact that they are loaded from memory can mean that your program
> takes a SIGSEGV, for example, becaue it turns out "string" was just a
> single NUL byte at the end of a page, and there's nothing after it.
Funny. I've seen this exact bug in memcmp and strcmp in earlier
SunOS (pre Solaris) libc when I was working on something like
Valgrind in my previous life.
^ permalink raw reply
* Re: [PATCH 0/3] Make the output of 'git' nicer
From: Ryan Anderson @ 2006-03-09 17:32 UTC (permalink / raw)
To: Fredrik Kuivinen; +Cc: git, junkio
In-Reply-To: <20060309161722.GA4484@c165.ib.student.liu.se>
On Thu, Mar 09, 2006 at 05:17:22PM +0100, Fredrik Kuivinen wrote:
> Hi,
>
> This series makes the output of 'git' easier to read (IMHO). With this
> patch the output will look like this:
You'll probably want to add "show" to that list.
--
Ryan Anderson
sometimes Pug Majere
^ permalink raw reply
* Re: Pulling tags from git.git
From: Andreas Ericsson @ 2006-03-09 17:24 UTC (permalink / raw)
To: Florian Weimer; +Cc: git
In-Reply-To: <87zmk0dq75.fsf@mid.deneb.enyo.de>
Florian Weimer wrote:
> * Andreas Ericsson:
>
> [lightweight tags]
>
>
>>I'm fairly sure we shouldn't. The default update-hook prevents them
>>(if enabled), and I can't for the life of me think of why anyone would
>>want to distribute such tags.
>
>
> The current implementation is rather counter-intuitive because it's
> much easier to create lightweight tags, and you wonder why they aren't
> replicated by fetches (but some other tags are).
Well, you wouldn't want to go through the trouble of writing a
tag-message for a temporary tag, but signing and writing a short note
for a tag that you intend those who share your workload to have is not
that much of a bother imo.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: [PATCH] fetch/parse-remote: refs/remotes/* support
From: Junio C Hamano @ 2006-03-09 17:23 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20060309115452.GA13369@localdomain>
> @@ -103,6 +103,9 @@ append_fetch_head () {
> refs/tags/*)
> note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
> note_="tag '$note_' of " ;;
> + refs/remotes/*)
> + note_="$(expr "$remote_name_" : 'refs/remotes/\(.*\)')"
> + note_="remote branch '$note_' of " ;;
> *)
> note_="$remote_name of " ;;
> esac
I vaguely recall that if you touch this part of the code you
would also need to check if fmt-merge-msg does sensible thing
for it.
^ permalink raw reply
* Re: [PATCH 1/3] Nicer output from 'git'
From: Jan-Benedict Glaw @ 2006-03-09 17:14 UTC (permalink / raw)
To: Fredrik Kuivinen; +Cc: git, junkio
In-Reply-To: <20060309162419.GB4484@c165.ib.student.liu.se>
[-- Attachment #1: Type: text/plain, Size: 1668 bytes --]
On Thu, 2006-03-09 17:24:19 +0100, Fredrik Kuivinen <freku045@student.liu.se> wrote:
> --- /dev/null
> +++ b/generate-cmdlist.sh
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +echo "/* Automatically generated by $0 */
> +struct cmdname_help
> +{
> + char name[16];
> + char help[64];
> +};
> +
> +struct cmdname_help common_cmds[] = {"
I'd use a here document for this.
> +# Please keep this list sorted
> +for i in "add" "apply" "bisect" "branch" "checkout" "cherry-pick" "clone" \
> +"commit" "diff" "fetch" "grep" "init-db" "log" "merge" "mv" \
> +"prune" "pull" "push" "rebase" "reset" "revert" "rm" "show-branch" \
> +"status" "tag" "verify-tag" "whatchanged"
You can omit all the quotes here--these words won't change by any
means of variable substitution or whitespace rearrangement...
> +static void list_common_cmds_help()
> +{
> + int i, longest = 0;
> +
> + for(i = 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) {
This smells like a good candidate for ARRAY_SIZE()?
> + if(strlen(common_cmds[i].name) > longest)
> + longest = strlen(common_cmds[i].name);
> + }
Maybe make len a size_t instead of int?
> + puts("The most commonly used git commands are:");
> + for(i = 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) {
ARRAY_SIZE()
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Linus Torvalds @ 2006-03-09 16:41 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, Mike McCormack, git
In-Reply-To: <Pine.LNX.4.63.0603091227560.20277@wbgn013.biozentrum.uni-wuerzburg.de>
On Thu, 9 Mar 2006, Johannes Schindelin wrote:
> >
> > > + if (!memcmp( "imaps:", val, 6 )) {
> > > + if (!memcmp( "imap:", val, 5 ))
> >
> > Is val always longer than 5 or 6 bytes here?
>
> That does not matter, since they are strings, and the memcmp should not
> look further if they are shorter (because the comparison to '\0' failed
> already).
No.
It's true that any sane memcmp() will stop when it notices a difference,
and it's also true that the return value semantics of memcmp() means that
it has to walk beginning-to-end.
HOWEVER. The key phrase is "_when_ it notices a difference".
It's quite common for optimized memcmp()'s to do things like loading
several words from both the source and the destinations, and testing them
together, and only start doing the byte-by-byte comparison when the "big"
comparison has failed.
So when you do a
if (!memcmp(string, mystring, mystringlength))
...
it's entirely possible that it will load bytes from "string" _past_ the
end of the string because of an unrolled inner loop that does things
multiple bytes at a time. They won't be used in the eventual result, but
just the fact that they are loaded from memory can mean that your program
takes a SIGSEGV, for example, becaue it turns out "string" was just a
single NUL byte at the end of a page, and there's nothing after it.
IOW, it's a bad optimization.
Use "strncmp()" instead. Yes, it can be slower, exactly because it has to
check more, but it checks more exactly because memcmp() can cause
undefined behaviour by running off the end of a string.
Linus
^ permalink raw reply
* Re: Pulling tags from git.git
From: Florian Weimer @ 2006-03-09 7:37 UTC (permalink / raw)
To: git
In-Reply-To: <440D7A7D.8070507@op5.se>
* Andreas Ericsson:
[lightweight tags]
> I'm fairly sure we shouldn't. The default update-hook prevents them
> (if enabled), and I can't for the life of me think of why anyone would
> want to distribute such tags.
The current implementation is rather counter-intuitive because it's
much easier to create lightweight tags, and you wonder why they aren't
replicated by fetches (but some other tags are).
^ permalink raw reply
* [PATCH 2/3] Fix some inconsistencies in the docs
From: Fredrik Kuivinen @ 2006-03-09 16:24 UTC (permalink / raw)
To: git; +Cc: junkio
In-Reply-To: <20060309161722.GA4484@c165.ib.student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
Documentation/git-grep.txt | 2 +-
Documentation/git-mv.txt | 2 +-
Documentation/git-tag.txt | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-grep.txt b/Documentation/git-grep.txt
index bf4b592..fbd2394 100644
--- a/Documentation/git-grep.txt
+++ b/Documentation/git-grep.txt
@@ -3,7 +3,7 @@ git-grep(1)
NAME
----
-git-grep - print lines matching a pattern
+git-grep - Print lines matching a pattern
SYNOPSIS
diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index d242b39..21a8664 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -3,7 +3,7 @@ git-mv(1)
NAME
----
-git-mv - Script used to move or rename a file, directory or symlink.
+git-mv - Move or rename a file, directory or symlink.
SYNOPSIS
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index e1c76c6..45476c2 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -3,7 +3,7 @@ git-tag(1)
NAME
----
-git-tag - Create a tag object signed with GPG
+git-tag - Create a tag object signed with GPG
SYNOPSIS
^ permalink raw reply related
* [PATCH 3/3] Remove trailing dot after short description
From: Fredrik Kuivinen @ 2006-03-09 16:24 UTC (permalink / raw)
To: git; +Cc: junkio
In-Reply-To: <20060309161722.GA4484@c165.ib.student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
Documentation/git-add.txt | 2 +-
Documentation/git-applypatch.txt | 2 +-
Documentation/git-branch.txt | 2 +-
Documentation/git-check-ref-format.txt | 2 +-
Documentation/git-checkout.txt | 2 +-
Documentation/git-cherry-pick.txt | 2 +-
Documentation/git-cherry.txt | 2 +-
Documentation/git-clone-pack.txt | 2 +-
Documentation/git-clone.txt | 2 +-
Documentation/git-count-objects.txt | 2 +-
Documentation/git-daemon.txt | 2 +-
Documentation/git-describe.txt | 2 +-
Documentation/git-diff-stages.txt | 2 +-
Documentation/git-diff.txt | 2 +-
Documentation/git-fetch-pack.txt | 2 +-
Documentation/git-fetch.txt | 2 +-
Documentation/git-format-patch.txt | 2 +-
Documentation/git-get-tar-commit-id.txt | 2 +-
Documentation/git-hash-object.txt | 2 +-
Documentation/git-http-push.txt | 2 +-
Documentation/git-lost-found.txt | 2 +-
Documentation/git-ls-remote.txt | 2 +-
Documentation/git-ls-tree.txt | 2 +-
Documentation/git-mailinfo.txt | 2 +-
Documentation/git-mailsplit.txt | 2 +-
Documentation/git-mv.txt | 2 +-
Documentation/git-name-rev.txt | 2 +-
Documentation/git-pack-objects.txt | 2 +-
Documentation/git-pack-redundant.txt | 2 +-
Documentation/git-patch-id.txt | 2 +-
Documentation/git-peek-remote.txt | 2 +-
Documentation/git-pull.txt | 2 +-
Documentation/git-push.txt | 2 +-
Documentation/git-rebase.txt | 2 +-
Documentation/git-relink.txt | 2 +-
Documentation/git-repo-config.txt | 2 +-
Documentation/git-request-pull.txt | 2 +-
Documentation/git-reset.txt | 2 +-
Documentation/git-rev-parse.txt | 2 +-
Documentation/git-revert.txt | 2 +-
Documentation/git-rm.txt | 2 +-
Documentation/git-send-pack.txt | 2 +-
Documentation/git-sh-setup.txt | 2 +-
Documentation/git-shortlog.txt | 2 +-
Documentation/git-show-branch.txt | 2 +-
Documentation/git-show.txt | 2 +-
Documentation/git-status.txt | 2 +-
Documentation/git-stripspace.txt | 2 +-
Documentation/git-unpack-objects.txt | 2 +-
Documentation/git-upload-pack.txt | 2 +-
Documentation/git-verify-pack.txt | 2 +-
Documentation/git-verify-tag.txt | 2 +-
Documentation/git-whatchanged.txt | 2 +-
53 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 5b7c354..ae24547 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -3,7 +3,7 @@ git-add(1)
NAME
----
-git-add - Add files to the index file.
+git-add - Add files to the index file
SYNOPSIS
--------
diff --git a/Documentation/git-applypatch.txt b/Documentation/git-applypatch.txt
index 5b9037d..2b1ff14 100644
--- a/Documentation/git-applypatch.txt
+++ b/Documentation/git-applypatch.txt
@@ -3,7 +3,7 @@ git-applypatch(1)
NAME
----
-git-applypatch - Apply one patch extracted from an e-mail.
+git-applypatch - Apply one patch extracted from an e-mail
SYNOPSIS
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index b1bc827..4cd0cb9 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -3,7 +3,7 @@ git-branch(1)
NAME
----
-git-branch - Create a new branch, or remove an old one.
+git-branch - Create a new branch, or remove an old one
SYNOPSIS
--------
diff --git a/Documentation/git-check-ref-format.txt b/Documentation/git-check-ref-format.txt
index f7f84c6..7dc1bdb 100644
--- a/Documentation/git-check-ref-format.txt
+++ b/Documentation/git-check-ref-format.txt
@@ -3,7 +3,7 @@ git-check-ref-format(1)
NAME
----
-git-check-ref-format - Make sure ref name is well formed.
+git-check-ref-format - Make sure ref name is well formed
SYNOPSIS
--------
diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index df9a618..556e733 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -3,7 +3,7 @@ git-checkout(1)
NAME
----
-git-checkout - Checkout and switch to a branch.
+git-checkout - Checkout and switch to a branch
SYNOPSIS
--------
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index 4f323fa..bfa950c 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -3,7 +3,7 @@ git-cherry-pick(1)
NAME
----
-git-cherry-pick - Apply the change introduced by an existing commit.
+git-cherry-pick - Apply the change introduced by an existing commit
SYNOPSIS
--------
diff --git a/Documentation/git-cherry.txt b/Documentation/git-cherry.txt
index af87966..9a5e371 100644
--- a/Documentation/git-cherry.txt
+++ b/Documentation/git-cherry.txt
@@ -3,7 +3,7 @@ git-cherry(1)
NAME
----
-git-cherry - Find commits not merged upstream.
+git-cherry - Find commits not merged upstream
SYNOPSIS
--------
diff --git a/Documentation/git-clone-pack.txt b/Documentation/git-clone-pack.txt
index 39906fc..09f43ee 100644
--- a/Documentation/git-clone-pack.txt
+++ b/Documentation/git-clone-pack.txt
@@ -3,7 +3,7 @@ git-clone-pack(1)
NAME
----
-git-clone-pack - Clones a repository by receiving packed objects.
+git-clone-pack - Clones a repository by receiving packed objects
SYNOPSIS
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 684e4bd..9ac54c2 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -3,7 +3,7 @@ git-clone(1)
NAME
----
-git-clone - Clones a repository.
+git-clone - Clones a repository
SYNOPSIS
diff --git a/Documentation/git-count-objects.txt b/Documentation/git-count-objects.txt
index 36888d9..47216f4 100644
--- a/Documentation/git-count-objects.txt
+++ b/Documentation/git-count-objects.txt
@@ -3,7 +3,7 @@ git-count-objects(1)
NAME
----
-git-count-objects - Reports on unpacked objects.
+git-count-objects - Reports on unpacked objects
SYNOPSIS
--------
diff --git a/Documentation/git-daemon.txt b/Documentation/git-daemon.txt
index 2cc6075..924a676 100644
--- a/Documentation/git-daemon.txt
+++ b/Documentation/git-daemon.txt
@@ -3,7 +3,7 @@ git-daemon(1)
NAME
----
-git-daemon - A really simple server for git repositories.
+git-daemon - A really simple server for git repositories
SYNOPSIS
--------
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index 0efe82a..7a253ea 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -3,7 +3,7 @@ git-describe(1)
NAME
----
-git-describe - Show the most recent tag that is reachable from a commit.
+git-describe - Show the most recent tag that is reachable from a commit
SYNOPSIS
diff --git a/Documentation/git-diff-stages.txt b/Documentation/git-diff-stages.txt
index 28c60fc..3273918 100644
--- a/Documentation/git-diff-stages.txt
+++ b/Documentation/git-diff-stages.txt
@@ -3,7 +3,7 @@ git-diff-stages(1)
NAME
----
-git-diff-stages - Compares content and mode of blobs between stages in an unmerged index file.
+git-diff-stages - Compares content and mode of blobs between stages in an unmerged index file
SYNOPSIS
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index ca41634..890931c 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -3,7 +3,7 @@ git-diff(1)
NAME
----
-git-diff - Show changes between commits, commit and working tree, etc.
+git-diff - Show changes between commits, commit and working tree, etc
SYNOPSIS
diff --git a/Documentation/git-fetch-pack.txt b/Documentation/git-fetch-pack.txt
index 913b75b..bff9aa6 100644
--- a/Documentation/git-fetch-pack.txt
+++ b/Documentation/git-fetch-pack.txt
@@ -3,7 +3,7 @@ git-fetch-pack(1)
NAME
----
-git-fetch-pack - Receive missing objects from another repository.
+git-fetch-pack - Receive missing objects from another repository
SYNOPSIS
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index a67dc34..a9e86fd 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -3,7 +3,7 @@ git-fetch(1)
NAME
----
-git-fetch - Download objects and a head from another repository.
+git-fetch - Download objects and a head from another repository
SYNOPSIS
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 9ac0636..7c467c5 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -3,7 +3,7 @@ git-format-patch(1)
NAME
----
-git-format-patch - Prepare patches for e-mail submission.
+git-format-patch - Prepare patches for e-mail submission
SYNOPSIS
diff --git a/Documentation/git-get-tar-commit-id.txt b/Documentation/git-get-tar-commit-id.txt
index 30b1fbf..48805b6 100644
--- a/Documentation/git-get-tar-commit-id.txt
+++ b/Documentation/git-get-tar-commit-id.txt
@@ -3,7 +3,7 @@ git-get-tar-commit-id(1)
NAME
----
-git-get-tar-commit-id - Extract commit ID from an archive created using git-tar-tree.
+git-get-tar-commit-id - Extract commit ID from an archive created using git-tar-tree
SYNOPSIS
diff --git a/Documentation/git-hash-object.txt b/Documentation/git-hash-object.txt
index 0924931..04e8d00 100644
--- a/Documentation/git-hash-object.txt
+++ b/Documentation/git-hash-object.txt
@@ -3,7 +3,7 @@ git-hash-object(1)
NAME
----
-git-hash-object - Computes object ID and optionally creates a blob from a file.
+git-hash-object - Computes object ID and optionally creates a blob from a file
SYNOPSIS
diff --git a/Documentation/git-http-push.txt b/Documentation/git-http-push.txt
index c7066d6..7e1f894 100644
--- a/Documentation/git-http-push.txt
+++ b/Documentation/git-http-push.txt
@@ -3,7 +3,7 @@ git-http-push(1)
NAME
----
-git-http-push - Push missing objects using HTTP/DAV.
+git-http-push - Push missing objects using HTTP/DAV
SYNOPSIS
diff --git a/Documentation/git-lost-found.txt b/Documentation/git-lost-found.txt
index 03156f2..f52a9d7 100644
--- a/Documentation/git-lost-found.txt
+++ b/Documentation/git-lost-found.txt
@@ -3,7 +3,7 @@ git-lost-found(1)
NAME
----
-git-lost-found - Recover lost refs that luckily have not yet been pruned.
+git-lost-found - Recover lost refs that luckily have not yet been pruned
SYNOPSIS
--------
diff --git a/Documentation/git-ls-remote.txt b/Documentation/git-ls-remote.txt
index 66fe60f..ae4c1a2 100644
--- a/Documentation/git-ls-remote.txt
+++ b/Documentation/git-ls-remote.txt
@@ -3,7 +3,7 @@ git-ls-remote(1)
NAME
----
-git-ls-remote - Look at references other repository has.
+git-ls-remote - Look at references other repository has
SYNOPSIS
diff --git a/Documentation/git-ls-tree.txt b/Documentation/git-ls-tree.txt
index b92a8b2..5bf6d8b 100644
--- a/Documentation/git-ls-tree.txt
+++ b/Documentation/git-ls-tree.txt
@@ -3,7 +3,7 @@ git-ls-tree(1)
NAME
----
-git-ls-tree - Lists the contents of a tree object.
+git-ls-tree - Lists the contents of a tree object
SYNOPSIS
diff --git a/Documentation/git-mailinfo.txt b/Documentation/git-mailinfo.txt
index 8890754..ea0a065 100644
--- a/Documentation/git-mailinfo.txt
+++ b/Documentation/git-mailinfo.txt
@@ -3,7 +3,7 @@ git-mailinfo(1)
NAME
----
-git-mailinfo - Extracts patch from a single e-mail message.
+git-mailinfo - Extracts patch from a single e-mail message
SYNOPSIS
diff --git a/Documentation/git-mailsplit.txt b/Documentation/git-mailsplit.txt
index e0703e9..209e36b 100644
--- a/Documentation/git-mailsplit.txt
+++ b/Documentation/git-mailsplit.txt
@@ -3,7 +3,7 @@ git-mailsplit(1)
NAME
----
-git-mailsplit - Totally braindamaged mbox splitter program.
+git-mailsplit - Totally braindamaged mbox splitter program
SYNOPSIS
--------
diff --git a/Documentation/git-mv.txt b/Documentation/git-mv.txt
index 21a8664..207c43a 100644
--- a/Documentation/git-mv.txt
+++ b/Documentation/git-mv.txt
@@ -3,7 +3,7 @@ git-mv(1)
NAME
----
-git-mv - Move or rename a file, directory or symlink.
+git-mv - Move or rename a file, directory or symlink
SYNOPSIS
diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index e37b0b8..6870708 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -3,7 +3,7 @@ git-name-rev(1)
NAME
----
-git-name-rev - Find symbolic names for given revs.
+git-name-rev - Find symbolic names for given revs
SYNOPSIS
diff --git a/Documentation/git-pack-objects.txt b/Documentation/git-pack-objects.txt
index 567dabf..4991f88 100644
--- a/Documentation/git-pack-objects.txt
+++ b/Documentation/git-pack-objects.txt
@@ -3,7 +3,7 @@ git-pack-objects(1)
NAME
----
-git-pack-objects - Create a packed archive of objects.
+git-pack-objects - Create a packed archive of objects
SYNOPSIS
diff --git a/Documentation/git-pack-redundant.txt b/Documentation/git-pack-redundant.txt
index a81cb97..8fb0659 100644
--- a/Documentation/git-pack-redundant.txt
+++ b/Documentation/git-pack-redundant.txt
@@ -3,7 +3,7 @@ git-pack-redundant(1)
NAME
----
-git-pack-redundant - Program used to find redundant pack files.
+git-pack-redundant - Program used to find redundant pack files
SYNOPSIS
diff --git a/Documentation/git-patch-id.txt b/Documentation/git-patch-id.txt
index c8bd197..723b8cc 100644
--- a/Documentation/git-patch-id.txt
+++ b/Documentation/git-patch-id.txt
@@ -3,7 +3,7 @@ git-patch-id(1)
NAME
----
-git-patch-id - Generate a patch ID.
+git-patch-id - Generate a patch ID
SYNOPSIS
--------
diff --git a/Documentation/git-peek-remote.txt b/Documentation/git-peek-remote.txt
index 915d3f8..a00060c 100644
--- a/Documentation/git-peek-remote.txt
+++ b/Documentation/git-peek-remote.txt
@@ -3,7 +3,7 @@ git-peek-remote(1)
NAME
----
-git-peek-remote - Lists the references in a remote repository.
+git-peek-remote - Lists the references in a remote repository
SYNOPSIS
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index 20175f4..51577fc 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -3,7 +3,7 @@ git-pull(1)
NAME
----
-git-pull - Pull and merge from another repository.
+git-pull - Pull and merge from another repository
SYNOPSIS
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 6f4a48a..d5b5ca1 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -3,7 +3,7 @@ git-push(1)
NAME
----
-git-push - Update remote refs along with associated objects.
+git-push - Update remote refs along with associated objects
SYNOPSIS
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index f037d12..4d5b546 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -3,7 +3,7 @@ git-rebase(1)
NAME
----
-git-rebase - Rebase local commits to new upstream head.
+git-rebase - Rebase local commits to new upstream head
SYNOPSIS
--------
diff --git a/Documentation/git-relink.txt b/Documentation/git-relink.txt
index 6240535..aca6012 100644
--- a/Documentation/git-relink.txt
+++ b/Documentation/git-relink.txt
@@ -3,7 +3,7 @@ git-relink(1)
NAME
----
-git-relink - Hardlink common objects in local repositories.
+git-relink - Hardlink common objects in local repositories
SYNOPSIS
--------
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index 00efde5..26759a8 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -3,7 +3,7 @@ git-repo-config(1)
NAME
----
-git-repo-config - Get and set options in .git/config.
+git-repo-config - Get and set options in .git/config
SYNOPSIS
diff --git a/Documentation/git-request-pull.txt b/Documentation/git-request-pull.txt
index 2463ec9..478a5fd 100644
--- a/Documentation/git-request-pull.txt
+++ b/Documentation/git-request-pull.txt
@@ -3,7 +3,7 @@ git-request-pull(1)
NAME
----
-git-request-pull - Generates a summary of pending changes.
+git-request-pull - Generates a summary of pending changes
SYNOPSIS
--------
diff --git a/Documentation/git-reset.txt b/Documentation/git-reset.txt
index b4e737e..b7b9798 100644
--- a/Documentation/git-reset.txt
+++ b/Documentation/git-reset.txt
@@ -3,7 +3,7 @@ git-reset(1)
NAME
----
-git-reset - Reset current HEAD to the specified state.
+git-reset - Reset current HEAD to the specified state
SYNOPSIS
--------
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 29b5789..8b95df0 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -3,7 +3,7 @@ git-rev-parse(1)
NAME
----
-git-rev-parse - Pick out and massage parameters.
+git-rev-parse - Pick out and massage parameters
SYNOPSIS
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index e27c680..71f7815 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -3,7 +3,7 @@ git-revert(1)
NAME
----
-git-revert - Revert an existing commit.
+git-revert - Revert an existing commit
SYNOPSIS
--------
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
index d8a5afa..c9c3088 100644
--- a/Documentation/git-rm.txt
+++ b/Documentation/git-rm.txt
@@ -3,7 +3,7 @@ git-rm(1)
NAME
----
-git-rm - Remove files from the working tree and from the index.
+git-rm - Remove files from the working tree and from the index
SYNOPSIS
--------
diff --git a/Documentation/git-send-pack.txt b/Documentation/git-send-pack.txt
index 577f06a..08e0705 100644
--- a/Documentation/git-send-pack.txt
+++ b/Documentation/git-send-pack.txt
@@ -3,7 +3,7 @@ git-send-pack(1)
NAME
----
-git-send-pack - Push missing objects packed.
+git-send-pack - Push missing objects packed
SYNOPSIS
diff --git a/Documentation/git-sh-setup.txt b/Documentation/git-sh-setup.txt
index 6ef59ac..6742c9b 100644
--- a/Documentation/git-sh-setup.txt
+++ b/Documentation/git-sh-setup.txt
@@ -3,7 +3,7 @@ git-sh-setup(1)
NAME
----
-git-sh-setup - Common git shell script setup code.
+git-sh-setup - Common git shell script setup code
SYNOPSIS
--------
diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index bf8db8b..54fb922 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -3,7 +3,7 @@ git-shortlog(1)
NAME
----
-git-shortlog - Summarize 'git log' output.
+git-shortlog - Summarize 'git log' output
SYNOPSIS
diff --git a/Documentation/git-show-branch.txt b/Documentation/git-show-branch.txt
index e474cd0..d3b6e62 100644
--- a/Documentation/git-show-branch.txt
+++ b/Documentation/git-show-branch.txt
@@ -3,7 +3,7 @@ git-show-branch(1)
NAME
----
-git-show-branch - Show branches and their commits.
+git-show-branch - Show branches and their commits
SYNOPSIS
--------
diff --git a/Documentation/git-show.txt b/Documentation/git-show.txt
index 9c359a4..2b4df3f 100644
--- a/Documentation/git-show.txt
+++ b/Documentation/git-show.txt
@@ -3,7 +3,7 @@ git-show(1)
NAME
----
-git-show - Show one commit with difference it introduces.
+git-show - Show one commit with difference it introduces
SYNOPSIS
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 753fc08..e446f48 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -3,7 +3,7 @@ git-status(1)
NAME
----
-git-status - Show working tree status.
+git-status - Show working tree status
SYNOPSIS
diff --git a/Documentation/git-stripspace.txt b/Documentation/git-stripspace.txt
index 528a1b6..3a03dd0 100644
--- a/Documentation/git-stripspace.txt
+++ b/Documentation/git-stripspace.txt
@@ -3,7 +3,7 @@ git-stripspace(1)
NAME
----
-git-stripspace - Filter out empty lines.
+git-stripspace - Filter out empty lines
SYNOPSIS
diff --git a/Documentation/git-unpack-objects.txt b/Documentation/git-unpack-objects.txt
index 31ea34d..1828062 100644
--- a/Documentation/git-unpack-objects.txt
+++ b/Documentation/git-unpack-objects.txt
@@ -3,7 +3,7 @@ git-unpack-objects(1)
NAME
----
-git-unpack-objects - Unpack objects from a packed archive.
+git-unpack-objects - Unpack objects from a packed archive
SYNOPSIS
diff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt
index 3d8f8ef..4795e98 100644
--- a/Documentation/git-upload-pack.txt
+++ b/Documentation/git-upload-pack.txt
@@ -3,7 +3,7 @@ git-upload-pack(1)
NAME
----
-git-upload-pack - Send missing objects packed.
+git-upload-pack - Send missing objects packed
SYNOPSIS
diff --git a/Documentation/git-verify-pack.txt b/Documentation/git-verify-pack.txt
index d032280..4962d69 100644
--- a/Documentation/git-verify-pack.txt
+++ b/Documentation/git-verify-pack.txt
@@ -3,7 +3,7 @@ git-verify-pack(1)
NAME
----
-git-verify-pack - Validate packed git archive files.
+git-verify-pack - Validate packed git archive files
SYNOPSIS
diff --git a/Documentation/git-verify-tag.txt b/Documentation/git-verify-tag.txt
index b8a73c4..0f9bdb5 100644
--- a/Documentation/git-verify-tag.txt
+++ b/Documentation/git-verify-tag.txt
@@ -3,7 +3,7 @@ git-verify-tag(1)
NAME
----
-git-verify-tag - Check the GPG signature of tag.
+git-verify-tag - Check the GPG signature of tag
SYNOPSIS
--------
diff --git a/Documentation/git-whatchanged.txt b/Documentation/git-whatchanged.txt
index 6c150b0..f02f939 100644
--- a/Documentation/git-whatchanged.txt
+++ b/Documentation/git-whatchanged.txt
@@ -3,7 +3,7 @@ git-whatchanged(1)
NAME
----
-git-whatchanged - Show logs with difference each commit introduces.
+git-whatchanged - Show logs with difference each commit introduces
SYNOPSIS
^ permalink raw reply related
* [PATCH 1/3] Nicer output from 'git'
From: Fredrik Kuivinen @ 2006-03-09 16:24 UTC (permalink / raw)
To: git; +Cc: junkio
In-Reply-To: <20060309161722.GA4484@c165.ib.student.liu.se>
Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se>
---
.gitignore | 1 +
Documentation/git.txt | 11 ++++++-----
Makefile | 7 +++++--
generate-cmdlist.sh | 22 ++++++++++++++++++++++
git.c | 50 +++++++++++++++++++++++++++++++++++++------------
5 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/.gitignore b/.gitignore
index abbc509..8e94cbd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,7 @@ git-write-tree
git-core-*/?*
test-date
test-delta
+common-cmds.h
*.tar.gz
*.dsc
*.deb
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 2d0ca9d..8610d36 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -20,15 +20,16 @@ brings your stuff to the plumbing).
OPTIONS
-------
--version::
- prints the git suite version that the 'git' program came from.
+ Prints the git suite version that the 'git' program came from.
--help::
- prints the synopsis and a list of available commands.
- If a git command is named this option will bring up the
- man-page for that command.
+ Prints the synopsis and a list of the most commonly used
+ commands. If a git command is named this option will bring up
+ the man-page for that command. If the option '--all' or '-a' is
+ given then all available commands are printed.
--exec-path::
- path to wherever your core git programs are installed.
+ Path to wherever your core git programs are installed.
This can also be controlled by setting the GIT_EXEC_PATH
environment variable. If no path is given 'git' will print
the current setting and then exit.
diff --git a/Makefile b/Makefile
index 1c555da..dc9a742 100644
--- a/Makefile
+++ b/Makefile
@@ -452,10 +452,13 @@ all:
strip: $(PROGRAMS) git$X
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
-git$X: git.c $(LIB_FILE)
+git$X: git.c common-cmds.h $(LIB_FILE)
$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
$(ALL_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE) $(LIBS)
+common-cmds.h: Documentation/git-*.txt
+ ./generate-cmdlist.sh > $@
+
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
rm -f $@
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
@@ -612,7 +615,7 @@ rpm: dist
clean:
rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o $(LIB_FILE)
rm -f $(ALL_PROGRAMS) git$X
- rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo
+ rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h
rm -rf $(GIT_TARNAME)
rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz
$(MAKE) -C Documentation/ clean
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
new file mode 100755
index 0000000..02091b5
--- /dev/null
+++ b/generate-cmdlist.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+echo "/* Automatically generated by $0 */
+struct cmdname_help
+{
+ char name[16];
+ char help[64];
+};
+
+struct cmdname_help common_cmds[] = {"
+
+# Please keep this list sorted
+for i in "add" "apply" "bisect" "branch" "checkout" "cherry-pick" "clone" \
+"commit" "diff" "fetch" "grep" "init-db" "log" "merge" "mv" \
+"prune" "pull" "push" "rebase" "reset" "revert" "rm" "show-branch" \
+"status" "tag" "verify-tag" "whatchanged"
+do
+ sed -n "/NAME/,/git-$i/H;
+ \$ {x; s/.*git-$i - \\(.*\\)/{\"$i\", \"\1\"},/; p}" \
+ "Documentation/git-$i.txt"
+done
+echo "};"
diff --git a/git.c b/git.c
index 164d3e9..2cbb471 100644
--- a/git.c
+++ b/git.c
@@ -11,6 +11,7 @@
#include <sys/ioctl.h>
#include "git-compat-util.h"
#include "exec_cmd.h"
+#include "common-cmds.h"
#include "cache.h"
#include "commit.h"
@@ -171,11 +172,29 @@ static void list_commands(const char *ex
putchar('\n');
}
+static void list_common_cmds_help()
+{
+ int i, longest = 0;
+
+ for(i = 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) {
+ if(strlen(common_cmds[i].name) > longest)
+ longest = strlen(common_cmds[i].name);
+ }
+
+ puts("The most commonly used git commands are:");
+ for(i = 0; i < sizeof(common_cmds)/sizeof(struct cmdname_help); i++) {
+ printf(" %s", common_cmds[i].name);
+ mput_char(' ', longest - strlen(common_cmds[i].name) + 4);
+ puts(common_cmds[i].help);
+ }
+ puts("(use 'git help -a' to get a list of all installed git commands)");
+}
+
#ifdef __GNUC__
-static void cmd_usage(const char *exec_path, const char *fmt, ...)
- __attribute__((__format__(__printf__, 2, 3), __noreturn__));
+static void cmd_usage(int show_all, const char *exec_path, const char *fmt, ...)
+ __attribute__((__format__(__printf__, 3, 4), __noreturn__));
#endif
-static void cmd_usage(const char *exec_path, const char *fmt, ...)
+static void cmd_usage(int show_all, const char *exec_path, const char *fmt, ...)
{
if (fmt) {
va_list ap;
@@ -189,11 +208,14 @@ static void cmd_usage(const char *exec_p
else
puts(git_usage);
- putchar('\n');
-
- if(exec_path)
- list_commands(exec_path, "git-*");
-
+ if(exec_path) {
+ putchar('\n');
+ if(show_all)
+ list_commands(exec_path, "git-*");
+ else
+ list_common_cmds_help();
+ }
+
exit(1);
}
@@ -244,8 +266,12 @@ static int cmd_help(int argc, const char
{
const char *help_cmd = argv[1];
if (!help_cmd)
- cmd_usage(git_exec_path(), NULL);
- show_man_page(help_cmd);
+ cmd_usage(0, git_exec_path(), NULL);
+ else if(!strcmp(help_cmd, "--all") ||
+ !strcmp(help_cmd, "-a"))
+ cmd_usage(1, git_exec_path(), NULL);
+ else
+ show_man_page(help_cmd);
return 0;
}
@@ -420,7 +446,7 @@ int main(int argc, const char **argv, ch
puts(git_exec_path());
exit(0);
}
- cmd_usage(NULL, NULL);
+ cmd_usage(0, NULL, NULL);
}
argv[0] = cmd;
@@ -443,7 +469,7 @@ int main(int argc, const char **argv, ch
execv_git_cmd(argv);
if (errno == ENOENT)
- cmd_usage(exec_path, "'%s' is not a git-command", cmd);
+ cmd_usage(0, exec_path, "'%s' is not a git-command", cmd);
fprintf(stderr, "Failed to run command '%s': %s\n",
git_command, strerror(errno));
^ permalink raw reply related
* [PATCH 0/3] Make the output of 'git' nicer
From: Fredrik Kuivinen @ 2006-03-09 16:17 UTC (permalink / raw)
To: git; +Cc: junkio
Hi,
This series makes the output of 'git' easier to read (IMHO). With this
patch the output will look like this:
Usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--help] COMMAND [ ARGS ]
The most commonly used git commands are:
add Add files to the index file
apply Apply patch on a git index file and a work tree
bisect Find the change that introduced a bug
branch Create a new branch, or remove an old one
checkout Checkout and switch to a branch
cherry-pick Apply the change introduced by an existing commit
clone Clones a repository
commit Record your changes
diff Show changes between commits, commit and working tree, etc
fetch Download objects and a head from another repository
grep Print lines matching a pattern
init-db Creates an empty git repository
log Show commit logs
merge Grand Unified Merge Driver
mv Move or rename a file, directory or symlink
prune Prunes all unreachable objects from the object database
pull Pull and merge from another repository
push Update remote refs along with associated objects
rebase Rebase local commits to new upstream head
reset Reset current HEAD to the specified state
revert Revert an existing commit
rm Remove files from the working tree and from the index
show-branch Show branches and their commits
status Show working tree status
tag Create a tag object signed with GPG
verify-tag Check the GPG signature of tag
whatchanged Show logs with difference each commit introduces
(use 'git help -a' to get a list of all installed git commands)
- Fredrik
^ permalink raw reply
* git-ls-files --unmerged implies --stages: ?
From: Matthias Urlichs @ 2006-03-09 15:19 UTC (permalink / raw)
To: git
Hi,
I wonder why git-ls-files --unmerged implies --stages. One nice use case
for this command is to edit all the conflicting files after a failed
merge, i.e.
$ vi $(git-ls-files --unmerged)
except I need a pipe to throw out all the cruft in there.
Does anybody depend on that implication, or do I need to add a "no-stages"
option, or am I blind and there's a better way to do this?
--
Matthias Urlichs
^ permalink raw reply
* "fatal: protocol error: bad line length character": ??
From: Matthias Urlichs @ 2006-03-09 15:15 UTC (permalink / raw)
To: git
Anybody seen this? The problem is benign, but ...
$ git push HOST master
updating 'refs/heads/master'
from f18c5d41ede0c4179d6821d2cc7ef7feaaca2f99
to d9205cd53bb97febbff8b43cbc93e60f735e32dd
Generating pack...
Done counting 5 objects.
Deltifying 5 objects.
100% (5/5) done
Total 5, written 5 (delta 0), reused 0 (delta 0)
Unpacking 5 objects
fatal: protocol error: bad line length character
refs/heads/master: f18c5d41ede0c4179d6821d2cc7ef7feaaca2f99 -> d9205cd53bb97febbff8b43cbc93e60f735e32dd
$ git push HOST master
Everything up-to-date
$
^ permalink raw reply
* Re: [PATCH] Allow git-repack to optionally run git-prune-packed.
From: Alex Riesen @ 2006-03-09 14:48 UTC (permalink / raw)
To: Alex Riesen, git
In-Reply-To: <20060309102419.GA9961@igloo.ds.co.ug>
On 3/9/06, Martin Atukunda <matlads@dsmagic.com> wrote:
> Your suggestion has merit, though it's different from the behaviour I
> desired. I _sometimes_ need the pruning, and it felt appropriate to make
> it an option as opposed to default behaviour.
>
> What do you think?
>
I think that my patch didn't change the default. git-prune-packed is called
only if -d is given, which is not the default.
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Johannes Schindelin @ 2006-03-09 13:47 UTC (permalink / raw)
To: Mark Wooding; +Cc: git
In-Reply-To: <slrne10b8c.fr9.mdw@metalzone.distorted.org.uk>
Hi,
On Thu, 9 Mar 2006, Mark Wooding wrote:
> There are reasons for which it'd be desirable that memcmp really compare
> all the bytes, even if it can in theory stop early: in particular, there
> are cases where early exit can leak timing information which makes it
> possible to attack cryptographic protocols.
I would be astonished if memcmp has to be timing proof for *all*
applications, just to keep crypto people happy. I don't *want* a slow-down
in my super-duper 3d shooter.
> I'd have to recommend strncmp for this job.
Fully agree.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Mark Wooding @ 2006-03-09 13:26 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.63.0603091243001.20908@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Sorry, I was unclear. Of course, memcmp() does not stop on NUL. But it
> stops when that NUL is different from what the other pointer has. Which is
> the case here.
Does it really? My copy of the spec doesn't say that. It says only
this:
: 7.21.4.1 The memcmp function
:
: Synopsis
:
: #include <string.h>
: int memcmp(const void *s1, const void *s2, size_t n);
:
: Description
:
: The memcmp() function compares the first n characters of the object
: pointed to by s1 to the first n characters of the object pointed to by
: s2.262)
:
: Returns
:
: The memcmp function returns an integer greater than, equal to, or less
: than zero, accordingly as the object pointed to by s1 is greater than,
: equal to, or less than the object pointed to by s2.
:
: 262) The contents of ``holes'' used as padding for purposes of
: alignment within structure objects are indeterminate. Strings shorter
: than their allocated space and unions may also cause problems in
: comparison.
There are reasons for which it'd be desirable that memcmp really compare
all the bytes, even if it can in theory stop early: in particular, there
are cases where early exit can leak timing information which makes it
possible to attack cryptographic protocols.
I'd have to recommend strncmp for this job.
-- [mdw]
^ permalink raw reply
* [PATCH] clone: add refs/remotes/* to Pull: targets when cloning
From: Eric Wong @ 2006-03-09 11:55 UTC (permalink / raw)
To: git, Junio C Hamano
In-Reply-To: <20060309115452.GA13369@localdomain>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
git-clone.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
be2db2344099b3713c1136e84bab7390b6198895
diff --git a/git-clone.sh b/git-clone.sh
index 4ed861d..a8ab7fd 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -249,6 +249,12 @@ Pull: $head_points_at:$origin" &&
test "$origin" = "$head" ||
echo "Pull: ${head}:${head}"
done >>"$GIT_DIR/remotes/origin"
+ (test -d "$GIT_DIR"/refs/remotes && cd "$GIT_DIR" &&
+ find "refs/remotes" -type f -print | sed -e 's|^refs/||') |
+ while read ref
+ do
+ echo "Pull: $ref:$ref"
+ done >>"$GIT_DIR/remotes/origin"
esac
case "$no_checkout" in
--
1.2.4.ga2910
^ permalink raw reply related
* [PATCH] fetch/parse-remote: refs/remotes/* support
From: Eric Wong @ 2006-03-09 11:54 UTC (permalink / raw)
To: git, Junio C Hamano
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
git-fetch.sh | 5 ++++-
git-parse-remote.sh | 8 ++++----
2 files changed, 8 insertions(+), 5 deletions(-)
34f9d6c64bd686f29db4cd410882aab607e1b628
diff --git a/git-fetch.sh b/git-fetch.sh
index 0346d4a..2748573 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -103,6 +103,9 @@ append_fetch_head () {
refs/tags/*)
note_="$(expr "$remote_name_" : 'refs/tags/\(.*\)')"
note_="tag '$note_' of " ;;
+ refs/remotes/*)
+ note_="$(expr "$remote_name_" : 'refs/remotes/\(.*\)')"
+ note_="remote branch '$note_' of " ;;
*)
note_="$remote_name of " ;;
esac
@@ -150,7 +153,7 @@ fast_forward_local () {
git-update-ref "$1" "$2"
;;
- refs/heads/*)
+ refs/heads/* | refs/remotes/*)
# $1 is the ref being updated.
# $2 is the new value for the ref.
local=$(git-rev-parse --verify "$1^0" 2>/dev/null)
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index 5f158c6..63f2281 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -86,14 +86,14 @@ canon_refs_list_for_fetch () {
local=$(expr "$ref" : '[^:]*:\(.*\)')
case "$remote" in
'') remote=HEAD ;;
- refs/heads/* | refs/tags/*) ;;
- heads/* | tags/* ) remote="refs/$remote" ;;
+ refs/heads/* | refs/tags/* | refs/remotes/*) ;;
+ heads/* | tags/* | remotes/* ) remote="refs/$remote" ;;
*) remote="refs/heads/$remote" ;;
esac
case "$local" in
'') local= ;;
- refs/heads/* | refs/tags/*) ;;
- heads/* | tags/* ) local="refs/$local" ;;
+ refs/heads/* | refs/tags/* | refs/remotes/*) ;;
+ heads/* | tags/* | remotes/* ) local="refs/$local" ;;
*) local="refs/heads/$local" ;;
esac
--
1.2.4.ga2910
^ permalink raw reply related
* [PATCH] contrib/git-svn: fix a harmless warning on rebuild (with old repos)
From: Eric Wong @ 2006-03-09 11:52 UTC (permalink / raw)
To: Junio C Hamano, git
It's only for repositories that were imported with very early
versions of git-svn. Unfortunately, some of those repos are out
in the wild already, so fix this warning.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
contrib/git-svn/git-svn.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
3c3753ad761d1802cc79418ae337ee4a3110a109
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 43b50ec..cf233ef 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -155,7 +155,7 @@ sub rebuild {
# if we merged or otherwise started elsewhere, this is
# how we break out of it
next if (defined $SVN_UUID && ($uuid ne $SVN_UUID));
- next if (defined $SVN_URL && ($url ne $SVN_URL));
+ next if (defined $SVN_URL && defined $url && ($url ne $SVN_URL));
print "r$rev = $c\n";
unless (defined $latest) {
--
1.2.4.ga2910
^ permalink raw reply related
* [PATCH] contrib/git-svn: remove the --no-stop-on-copy flag
From: Eric Wong @ 2006-03-09 11:50 UTC (permalink / raw)
To: Yann Dirson, Junio C Hamano; +Cc: GIT list
In-Reply-To: <20060308014207.GA31137@localdomain>
Output a big warning if somebody actually has a pre-1.0 version
of svn that doesn't support it.
Thanks to Yann Dirson for reminding me it still existed
and attempting to re-enable it :)
I think I subconciously removed support for it earlier...
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
contrib/git-svn/git-svn.perl | 11 +++++++++++
contrib/git-svn/git-svn.txt | 13 -------------
2 files changed, 11 insertions(+), 13 deletions(-)
0ec45e489232fad4f1aa3d2c648fa53295efd7ec
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index dca4e5c..43b50ec 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -1019,6 +1019,17 @@ sub svn_compat_check {
if (grep /usage: checkout URL\[\@REV\]/,@co_help) {
$_svn_co_url_revs = 1;
}
+
+ # I really, really hope nobody hits this...
+ unless (grep /stop-on-copy/, (safe_qx(qw(svn log -h)))) {
+ print STDERR <<'';
+W: The installed svn version does not support the --stop-on-copy flag in
+ the log command.
+ Lets hope the directory you're tracking is not a branch or tag
+ and was never moved within the repository...
+
+ $_no_stop_copy = 1;
+ }
}
# *sigh*, new versions of svn won't honor -r<rev> without URL@<rev>,
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index 5fb5b7c..7a6e0c4 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -162,19 +162,6 @@ COMPATIBILITY OPTIONS
Otherwise, do not enable this flag unless you know what you're
doing.
---no-stop-on-copy::
- Only used with the 'fetch' command.
-
- By default, git-svn passes --stop-on-copy to avoid dealing with
- the copied/renamed branch directory problem entirely. A
- copied/renamed branch is the result of a <SVN_URL> being created
- in the past from a different source. These are problematic to
- deal with even when working purely with svn if you work inside
- subdirectories.
-
- Do not use this flag unless you know exactly what you're getting
- yourself into. You have been warned.
-
Basic Examples
~~~~~~~~~~~~~~
--
1.2.4.ga2910
^ permalink raw reply related
* [PATCH] contrib/git-svn: fix svn compat and fetch args
From: Eric Wong @ 2006-03-09 11:48 UTC (permalink / raw)
To: Junio C Hamano, Yann Dirson; +Cc: git
In-Reply-To: <7vacc07wwp.fsf@assigned-by-dhcp.cox.net>
'svn info' doesn't work with URLs in svn <= 1.1. Now we
only run svn info in local directories.
As a side effect, this should also work better for 'init' off
directories that are no longer in the latest revision of the
repository.
svn checkout -r<revision> arguments are fixed.
Newer versions of svn (1.2.x) seem to need URL@REV as well as
-rREV to checkout a particular revision...
Add an example in the manpage of how to track directory that has
been moved since its initial revision.
A huge thanks to Yann Dirson for the bug reporting and testing
my original patch. Thanks also to Junio C Hamano for suggesting
a safer way to use git-rev-parse.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Junio C Hamano <junkio@cox.net> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
>
> > Junio: please don't apply this patch to git.git just yet. It seems fine
> > to me, but I haven't tested it heavily yet (Yann can help me, I hope :)
> > I hardly slept the past few days and I may have broken something badly
> > (it pasts all the tests, though).
>
> I won't be applying it then.
You can apply this one :)
> I think this part is wrong.
Cool, thanks for the example.
contrib/git-svn/git-svn.perl | 63 ++++++++++++++++++++++++++++++------------
contrib/git-svn/git-svn.txt | 32 ++++++++++++++++++++-
2 files changed, 75 insertions(+), 20 deletions(-)
1e07c915bbc3ff06967a85a71c0cbad82fa40cf6
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 3c860e4..dca4e5c 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -30,6 +30,7 @@ my $sha1_short = qr/[a-f\d]{4,40}/;
my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,
$_find_copies_harder, $_l, $_version, $_upgrade, $_authors);
my (@_branch_from, %tree_map, %users);
+my $_svn_co_url_revs;
my %fc_opts = ( 'no-ignore-externals' => \$_no_ignore_ext,
'branch|b=s' => \@_branch_from,
@@ -77,7 +78,7 @@ usage(0) if $_help;
version() if $_version;
usage(1) unless defined $cmd;
load_authors() if $_authors;
-svn_check_ignore_externals();
+svn_compat_check();
$cmd{$cmd}->[0]->(@ARGV);
exit 0;
@@ -162,7 +163,8 @@ sub rebuild {
croak "SVN repository location required: $url\n";
}
$SVN_URL ||= $url;
- $SVN_UUID ||= setup_git_svn();
+ $SVN_UUID ||= $uuid;
+ setup_git_svn();
$latest = $rev;
}
assert_revision_eq_or_unknown($rev, $c);
@@ -171,9 +173,7 @@ sub rebuild {
}
close $rev_list or croak $?;
if (!chdir $SVN_WC) {
- my @svn_co = ('svn','co',"-r$latest");
- push @svn_co, '--ignore-externals' unless $_no_ignore_ext;
- sys(@svn_co, $SVN_URL, $SVN_WC);
+ svn_cmd_checkout($SVN_URL, $latest, $SVN_WC);
chdir $SVN_WC or croak $!;
}
@@ -222,14 +222,14 @@ sub fetch {
my $base = shift @$svn_log or croak "No base revision!\n";
my $last_commit = undef;
unless (-d $SVN_WC) {
- my @svn_co = ('svn','co',"-r$base->{revision}");
- push @svn_co,'--ignore-externals' unless $_no_ignore_ext;
- sys(@svn_co, $SVN_URL, $SVN_WC);
+ svn_cmd_checkout($SVN_URL,$base->{revision},$SVN_WC);
chdir $SVN_WC or croak $!;
+ read_uuid();
$last_commit = git_commit($base, @parents);
assert_svn_wc_clean($base->{revision}, $last_commit);
} else {
chdir $SVN_WC or croak $!;
+ read_uuid();
$last_commit = file_to_s("$REV_DIR/$base->{revision}");
}
my @svn_up = qw(svn up);
@@ -275,7 +275,9 @@ sub commit {
fetch();
chdir $SVN_WC or croak $!;
- my $svn_current_rev = svn_info('.')->{'Last Changed Rev'};
+ my $info = svn_info('.');
+ read_uuid($info);
+ my $svn_current_rev = $info->{'Last Changed Rev'};
foreach my $c (@revs) {
my $mods = svn_checkout_tree($svn_current_rev, $c);
if (scalar @$mods == 0) {
@@ -314,6 +316,14 @@ sub show_ignore {
########################### utility functions #########################
+sub read_uuid {
+ return if $SVN_UUID;
+ my $info = shift || svn_info('.');
+ $SVN_UUID = $info->{'Repository UUID'} or
+ croak "Repository UUID unreadable\n";
+ s_to_file($SVN_UUID,"$GIT_DIR/$GIT_SVN/info/uuid");
+}
+
sub setup_git_svn {
defined $SVN_URL or croak "SVN repository location required\n";
unless (-d $GIT_DIR) {
@@ -323,14 +333,10 @@ sub setup_git_svn {
mkpath(["$GIT_DIR/$GIT_SVN/info"]);
mkpath([$REV_DIR]);
s_to_file($SVN_URL,"$GIT_DIR/$GIT_SVN/info/url");
- $SVN_UUID = svn_info($SVN_URL)->{'Repository UUID'} or
- croak "Repository UUID unreadable\n";
- s_to_file($SVN_UUID,"$GIT_DIR/$GIT_SVN/info/uuid");
open my $fd, '>>', "$GIT_DIR/$GIT_SVN/info/exclude" or croak $!;
print $fd '.svn',"\n";
close $fd or croak $!;
- return $SVN_UUID;
}
sub assert_svn_wc_clean {
@@ -860,7 +866,6 @@ sub git_commit {
my ($log_msg, @parents) = @_;
assert_revision_unknown($log_msg->{revision});
my $out_fh = IO::File->new_tmpfile or croak $!;
- $SVN_UUID ||= svn_info('.')->{'Repository UUID'};
map_tree_joins() if (@_branch_from && !%tree_map);
@@ -922,7 +927,16 @@ sub git_commit {
}
my @update_ref = ('git-update-ref',"refs/remotes/$GIT_SVN",$commit);
if (my $primary_parent = shift @exec_parents) {
- push @update_ref, $primary_parent;
+ $pid = fork;
+ defined $pid or croak $!;
+ if (!$pid) {
+ close STDERR;
+ close STDOUT;
+ exec 'git-rev-parse','--verify',
+ "refs/remotes/$GIT_SVN^0";
+ }
+ waitpid $pid, 0;
+ push @update_ref, $primary_parent unless $?;
}
sys(@update_ref);
sys('git-update-ref',"$GIT_SVN/revs/$log_msg->{revision}",$commit);
@@ -995,13 +1009,26 @@ sub safe_qx {
return wantarray ? @ret : join('',@ret);
}
-sub svn_check_ignore_externals {
- return if $_no_ignore_ext;
- unless (grep /ignore-externals/,(safe_qx(qw(svn co -h)))) {
+sub svn_compat_check {
+ my @co_help = safe_qx(qw(svn co -h));
+ unless (grep /ignore-externals/,@co_help) {
print STDERR "W: Installed svn version does not support ",
"--ignore-externals\n";
$_no_ignore_ext = 1;
}
+ if (grep /usage: checkout URL\[\@REV\]/,@co_help) {
+ $_svn_co_url_revs = 1;
+ }
+}
+
+# *sigh*, new versions of svn won't honor -r<rev> without URL@<rev>,
+# (and they won't honor URL@<rev> without -r<rev>, too!)
+sub svn_cmd_checkout {
+ my ($url, $rev, $dir) = @_;
+ my @cmd = ('svn','co', "-r$rev");
+ push @cmd, '--ignore-externals' unless $_no_ignore_ext;
+ $url .= "\@$rev" if $_svn_co_url_revs;
+ sys(@cmd, $url, $dir);
}
sub check_upgrade_needed {
diff --git a/contrib/git-svn/git-svn.txt b/contrib/git-svn/git-svn.txt
index 8e9a971..5fb5b7c 100644
--- a/contrib/git-svn/git-svn.txt
+++ b/contrib/git-svn/git-svn.txt
@@ -175,8 +175,8 @@ COMPATIBILITY OPTIONS
Do not use this flag unless you know exactly what you're getting
yourself into. You have been warned.
-Examples
-~~~~~~~~
+Basic Examples
+~~~~~~~~~~~~~~
Tracking and contributing to an Subversion managed-project:
@@ -234,6 +234,34 @@ This allows you to tie unfetched SVN rev
git-svn fetch 375=$(git-rev-parse HEAD)
+Advanced Example: Tracking a Reorganized Repository
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+If you're tracking a directory that has moved, or otherwise been
+branched or tagged off of another directory in the repository and you
+care about the full history of the project, then you can read this
+section.
+
+This is how Yann Dirson tracked the trunk of the ufoai directory when
+the /trunk directory of his repository was moved to /ufoai/trunk and
+he needed to continue tracking /ufoai/trunk where /trunk left off.
+
+ # This log message shows when the repository was reorganized::
+ r166 | ydirson | 2006-03-02 01:36:55 +0100 (Thu, 02 Mar 2006) | 1 line
+ Changed paths:
+ D /trunk
+ A /ufoai/trunk (from /trunk:165)
+
+ # First we start tracking the old revisions::
+ GIT_SVN_ID=git-oldsvn git-svn init \
+ https://svn.sourceforge.net/svnroot/ufoai/trunk
+ GIT_SVN_ID=git-oldsvn git-svn fetch -r1:165
+
+ # And now, we continue tracking the new revisions::
+ GIT_SVN_ID=git-newsvn git-svn init \
+ https://svn.sourceforge.net/svnroot/ufoai/ufoai/trunk
+ GIT_SVN_ID=git-newsvn git-svn fetch \
+ 166=`git-rev-parse refs/remotes/git-oldsvn`
+
BUGS
----
If somebody commits a conflicting changeset to SVN at a bad moment
--
1.2.4.ga2910
^ permalink raw reply related
* Re: [PATCH] Add git-imap-send.
From: Johannes Schindelin @ 2006-03-09 11:44 UTC (permalink / raw)
To: Andreas Ericsson; +Cc: Junio C Hamano, Mike McCormack, git
In-Reply-To: <4410140E.2000609@op5.se>
Hi,
On Thu, 9 Mar 2006, Andreas Ericsson wrote:
> Johannes Schindelin wrote:
> > Hi,
> >
> > On Thu, 9 Mar 2006, Junio C Hamano wrote:
> >
> >
> > > Mike McCormack <mike@codeweavers.com> writes:
> > >
> > >
> > > > + if (!memcmp( "imaps:", val, 6 )) {
> > > > + if (!memcmp( "imap:", val, 5 ))
> > >
> > > Is val always longer than 5 or 6 bytes here?
> >
> >
> > That does not matter, since they are strings, and the memcmp should not look
> > further if they are shorter (because the comparison to '\0' failed already).
> >
>
> That's what strcmp() does. memcmp() walks the lenghth even if it encounters
> nul bytes. Perhaps you confuse it with strncmp()?
Sorry, I was unclear. Of course, memcmp() does not stop on NUL. But it
stops when that NUL is different from what the other pointer has. Which is
the case here.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Andreas Ericsson @ 2006-03-09 11:39 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, Mike McCormack, git
In-Reply-To: <Pine.LNX.4.63.0603091227560.20277@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
> Hi,
>
> On Thu, 9 Mar 2006, Junio C Hamano wrote:
>
>
>>Mike McCormack <mike@codeweavers.com> writes:
>>
>>
>>>+ if (!memcmp( "imaps:", val, 6 )) {
>>>+ if (!memcmp( "imap:", val, 5 ))
>>
>>Is val always longer than 5 or 6 bytes here?
>
>
> That does not matter, since they are strings, and the memcmp should not
> look further if they are shorter (because the comparison to '\0' failed
> already).
>
That's what strcmp() does. memcmp() walks the lenghth even if it
encounters nul bytes. Perhaps you confuse it with strncmp()?
> However, if !memcmp("imaps:", val, 6), it means that val starts with
> the string "imaps:", right? Then !memcmp("imap:", val, 5) must always
> fail, no?
>
Yes. Recent gcc's will recognize it as dead code and remove it. It's
still ugly though.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply
* Re: [PATCH] Add git-imap-send.
From: Johannes Schindelin @ 2006-03-09 11:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Mike McCormack, git
In-Reply-To: <7vacbz7vod.fsf@assigned-by-dhcp.cox.net>
Hi,
On Thu, 9 Mar 2006, Junio C Hamano wrote:
> Mike McCormack <mike@codeweavers.com> writes:
>
> > + if (!memcmp( "imaps:", val, 6 )) {
> > + if (!memcmp( "imap:", val, 5 ))
>
> Is val always longer than 5 or 6 bytes here?
That does not matter, since they are strings, and the memcmp should not
look further if they are shorter (because the comparison to '\0' failed
already).
However, if !memcmp("imaps:", val, 6), it means that val starts with
the string "imaps:", right? Then !memcmp("imap:", val, 5) must always
fail, no?
Ciao,
Dscho
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox