* Re: [PATCH] Fix empty line processing in git-shortlog.perl
From: Petr Baudis @ 2005-11-06 22:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <20051106224218.22797.97260.stgit@machine.or.cz>
Dear diary, on Sun, Nov 06, 2005 at 11:42:18PM CET, I got a letter
where Petr Baudis <pasky@suse.cz> told me that...
> diff --git a/git-shortlog.perl b/git-shortlog.perl
> index 0b14f83..7283159 100755
> --- a/git-shortlog.perl
> +++ b/git-shortlog.perl
> @@ -94,7 +94,7 @@ sub changelog_input {
>
> # skip to non-blank line
> elsif ($pstate == 3) {
> - next unless /^\s*?(.*)/;
> + next unless /^\s*?(\S.*)$/;
>
> # skip lines that are obviously not
> # a 1-line cset description
>
Whoops, the ? was not part of the original regexp and is obviously
useless. Well, I don't think it really matters, so it is up to you...
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
^ permalink raw reply
* Re: [RFC] Applying a graft to a tree and "rippling" the changes through the history
From: Randal L. Schwartz @ 2005-11-06 22:43 UTC (permalink / raw)
To: Ryan Anderson; +Cc: git
In-Reply-To: <436E85DA.1080904@michonline.com>
>>>>> "Ryan" == Ryan Anderson <ryan@michonline.com> writes:
Ryan> chdir($ARGV[0]);
That's dangerous without an "or-die". Being in the wrong directory
before you do a lot of edits is a good way to bust your disk. :)
Ryan> my ($commit,@parents) = split /\s+/;
split with no args splits $_ on whitespace, tossing leading whitespace,
just in case they ever put whitespace indentation ahead.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
^ permalink raw reply
* [PATCH] Fix empty line processing in git-shortlog.perl
From: Petr Baudis @ 2005-11-06 22:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Faced with a commit such as
commit f1b2646c7f2713c3ea4bce120e1d0d8091808be4
Author: Adrian Bunk <bunk@r063144.stusta.swh.mhn.de>
Date: Sun Nov 6 20:30:38 2005 +0100
From: Michal Wronski <wrona@mat.uni.torun.pl>
I've jchanged my email. Please apply this patch so as to everybody
could send me a remarks about mqueuefs.
Signed-off-by: Michal Wronski <Michal.Wronski@motorola.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
git-shortlog.perl would produce a line with an empty commit title.
This patch fixes that. I believe that just changing the last * to + in the
original regexp would work, but Adrian says it doesn't fix it for him, and
I believe this regexp is way clearer anyway. This is also the original
regexp used before a24e658649170c99fdcb4aaa41545679ad02f755.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
git-shortlog.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-shortlog.perl b/git-shortlog.perl
index 0b14f83..7283159 100755
--- a/git-shortlog.perl
+++ b/git-shortlog.perl
@@ -94,7 +94,7 @@ sub changelog_input {
# skip to non-blank line
elsif ($pstate == 3) {
- next unless /^\s*?(.*)/;
+ next unless /^\s*?(\S.*)$/;
# skip lines that are obviously not
# a 1-line cset description
^ permalink raw reply related
* [RFC] Applying a graft to a tree and "rippling" the changes through the history
From: Ryan Anderson @ 2005-11-06 22:38 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 3257 bytes --]
I've written a tool that will take a single commit, add it as a parent
of another commit, and recreate the history above that second commit in
a fully compatible manner.
This is mostly useful for creating a fully merged-up repository of the
Linux Historical tree, and the current working tree.
I run this with /graft-ripple.pl linux-history.tmp/ linus origin
Where "origin" is the branch the historical repository is on, and
"linus" is the branch the current repository is on.
Note: This does not end up fixing up HEAD or any branches, it just pulls
all the objects together and recreates the full history.
GPLv2, but I'll redo with a proper patch, signed-off-by, command line
options and help and docs if anyone else feels this is useful as a
general tool.
========= cut here =============
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use IPC::Open2;
sub git_commit_tree {
my ($tree,$comments,@parents) = @_;
my @cparents;
foreach my $p (@parents) {
push @cparents,"-p",$p;
}
my $pid = open2(*Reader, *Writer,
"git-commit-tree",$tree,@cparents);
print Writer $comments;
close(Writer);
my $commit = <Reader>;
waitpid $pid, 0;
close(Reader);
chomp $commit;
return $commit;
}
chdir($ARGV[0]);
open(GRL,"-|","git-rev-list","--parents",$ARGV[1])
or die "Failed to run git-rev-list: " . $!;
my %csets;
my @revs;
while(<GRL>) {
chomp;
my ($commit,@parents) = split /\s+/;
$csets{$commit}{parents} = \@parents;
push @revs, $commit;
open(GCF,"-|","git-cat-file","commit",$commit)
or die "Failed to open git-cat-file: " . $!;
my $in_comments = 0;
while(<GCF>) {
chomp;
if ($in_comments) {
$csets{$commit}{comments} .= $_ . "\n";
} elsif (m/^tree (.+)$/) {
$csets{$commit}{tree} = $1;
#printf("tree = %s\n",$1);
} elsif (m/^parent (.+)$/) {
# Do nothing, we already got
# the parents from rev-list.
} elsif (m/^(author|committer) (.*) <(.*)> (.*)$/) {
#printf("%s = %s <%s> at %s\n",$1, $2,$3,$4);
@{$csets{$commit}{$1}}{qw(name email datetime)}
= ($2,$3,$4);
} elsif (length == 0) {
$in_comments = 1;
$csets{$commit}{comments} = "";
next;
}
}
close(GCF);
}
close(GRL);
@revs = reverse @revs;
push @{$csets{$revs[0]}{parents}},$ARGV[2];
my %newcsets;
foreach my $old (@revs) {
printf("Processing commit %s\n",$old);
$ENV{GIT_AUTHOR_EMAIL} = $csets{$old}{author}{email};
$ENV{GIT_AUTHOR_NAME} = $csets{$old}{author}{name};
$ENV{GIT_AUTHOR_DATE} = $csets{$old}{author}{datetime};
$ENV{GIT_COMMITTER_DATE} = $csets{$old}{committer}{datetime};
$ENV{GIT_COMMITTER_EMAIL} = $csets{$old}{committer}{email};
$ENV{GIT_COMMITTER_NAME} = $csets{$old}{committer}{name};
my @parents = @{$csets{$old}{parents}};
foreach my $p (@{$csets{$old}{parents}}) {
if (exists $newcsets{$p}) {
push @parents, $newcsets{$p}
if exists $newcsets{$p};
printf("Found new csetid %s for %s\n",
$newcsets{$p},$p);
}
}
my $commit = git_commit_tree($csets{$old}{tree},
$csets{$old}{comments},@parents);
$newcsets{$old} = $commit;
printf("Commit for version %s is %s\n",$old,$newcsets{$old});
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]
^ permalink raw reply
* Re: git binary directory?
From: Petr Baudis @ 2005-11-06 22:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, git
In-Reply-To: <7v7jbly1lh.fsf@assigned-by-dhcp.cox.net>
Dear diary, on Sun, Nov 06, 2005 at 09:15:38PM CET, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> Linus Torvalds <torvalds@osdl.org> writes:
>
> > Right now, for a 1.0 release, I suspect that the "put the git binaries
> > somewhere else" just isn't worth it. It will break existing scripts that
> > use the binaries directly (we've already broken the kernel.org snapshot
> > scripts about a million times with just _renaming_ the binaries ;)
>
> Although I _really_ wanted a 1.0 soonish, I personally feel that
> this change is better done now than later, if we are eventually
> going to do it anyway. "Never" _might_ be better than "now",
> but I suspect "later" or "post 1.0" is worse.
You are also going to break the porcelains (w/o manual user
intervention), so I'm not happy about it but if you are doing it, do it
now, please. :-)
BTW, can I easily get the patch from the 'git' tool, so that I can
extend $PATH appropriately during Cogito initialization?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.
^ permalink raw reply
* Expected Behavior?
From: Jon Loeliger @ 2005-11-06 22:16 UTC (permalink / raw)
To: git
I was working through some examples and found some
rather curious behavior. I'm wondering if it is
expected or not. This isn't quite minimal, but
it is still small and shows the weirdness:
git-init-db
echo "Stuff for file1" > file1
echo "Stuff for file2" > file2
git add file1 file2
git commit -m "Initial file1 and file2"
git checkout -b dev
echo "More for file1" >> file1
rm -f file2
echo "Another file!" > file3
git update-index file1
git update-index --force-remove file2
git add file3
git commit -m "Updated some stuff."
git checkout master
echo "Stuff for a conflict." >> file3
git add file3
git commit -m "Master update of file3"
git merge "Grab dev stuff" master dev
Then, the part that I think is odd is demonstrated by "git status":
$ git status
#
# Updated but not checked in:
# (will commit)
#
# modified: file1
# deleted: file2
# unmerged: file3
#
#
# Changed but not updated:
# (use git-update-index to mark for commit)
#
# unmerged: file3
#
#
# Untracked files:
# (use "git add" to add to commit)
#
# file3
Why is file3 considered untracked and needing to be added?
It was present in both "dev" and "master" branches before
the merge. It doesn't end up with "<<< one === other >>>"
style diffs either.
My guess is that the file is small, one line, in each branch.
When the diff happens, it sees the file as empty in the other
branch and considers that "new" directly, rather than asking
the index if it knows about it to determine "newness" status.
Or perhaps it is that the file became new in each branch
independently and never really had a true common ancestor.
Thanks,
jdl
^ permalink raw reply
* Re: Documentation Directions
From: Nikolai Weibull @ 2005-11-06 22:03 UTC (permalink / raw)
To: git
In-Reply-To: <E1EYoQE-0002QX-VM@jdl.com>
Jon Loeliger wrote:
> - Is the plan to update all docs to use $GIT_DIR instead of .git?
Well, shouldn't we go all the way and use ${GIT_DIR:-.git} then? :-)
nikolai
--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply
* Errors cloning over http -- git-clone and cg-clone fail to fetch a reachable object...
From: Martin Langhoff @ 2005-11-06 21:54 UTC (permalink / raw)
To: Git Mailing List
Strange!
I'm getting errors when cloning over http
git-clone http://locke.catalyst.net.nz/git/moodle.git mdlfoo
(...)
error: (curl_result = 3601440, http_code = 200, sha1 =
f04241b142edfbf28fff2babb426cbab5b44e26b)
Getting pack list
error:
Getting alternates list
error: Unable to find f04241b142edfbf28fff2babb426cbab5b44e26b under
http://locke.catalyst.net.nz/git/moodle.git/
Cannot obtain needed commit f04241b142edfbf28fff2babb426cbab5b44e26b
while processing commit 0965f28d4d75f324b86c8f7490830fea471c65c5.
This commit object is easily reachable at
http://mirrors.catalyst.net.nz/git/moodle.git/objects/f0/4241b142edfbf28fff2babb426cbab5b44e26b
If I use cg-clone, I get a similar error
cg-clone http://locke.catalyst.net.nz/git/moodle.git#mdl-artena-tairawhiti
mdlfooo
(...)
Cannot obtain needed object 214e6374d49e6d014f0ba6f159d585a3fe468909
while processing commit 0000000000000000000000000000000000000000.
cg-fetch: objects fetch failed
cg-clone: fetch failed
This commit object seems to be in a pack:
http://mirrors.catalyst.net.nz/git/moodle.git/objects/pack/pack-094560c0177ad659a6e172739c4be53da749e5f0.pack
git-cat-file on the server works correctly, and cloning/working over
git+ssh works too.
cheers,
martin
^ permalink raw reply
* Re: What's in git.git tonight
From: Paul Collins @ 2005-11-06 21:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vmzkhy5on.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> merlyn@stonehenge.com (Randal L. Schwartz) writes:
>
>> And, I've confirmed that this patch does the trick, and will probably
>> defer any other issues with "optional" packages in the future:
>
> Thanks. Next time around could you sign-off your patch?
A tiny nit:
---
Consistency is the hobgoblin of small minds, and mine is tiny indeed.
Do not search the current directory when including expat.h, since it
is not supplied by git.
Signed-off-by: Paul Collins <paul@briny.ondioline.org>
diff --git a/http-push.c b/http-push.c
index c10067c..89fda42 100644
--- a/http-push.c
+++ b/http-push.c
@@ -7,7 +7,7 @@
#include <curl/curl.h>
#include <curl/easy.h>
-#include "expat.h"
+#include <expat.h>
static const char http_push_usage[] =
"git-http-push [--complete] [--force] [--verbose] <url> <ref> [<ref>...]\n";
--
Dag vijandelijk luchtschip de huismeester is dood
^ permalink raw reply related
* Re: Now What?
From: Junio C Hamano @ 2005-11-06 20:33 UTC (permalink / raw)
To: Jon Loeliger; +Cc: git
In-Reply-To: <1131043869.10979.17.camel@cashmere.sps.mot.com>
Jon Loeliger <jdl@freescale.com> writes:
> On Wed, 2005-11-02 at 19:43, Chris Shoemaker wrote:
>
> .... Also,
> I was annoyed that "git revert -n commit-name" created
> conflicts and the reversal and merges didn't happen
> for me cleanly even though they did for Junio.
>
> So either I don't get it, or it isn't working quite
> right these days. Not sure. Advice sought.
It's been a while since I used git-revert the last time. I
should find time to run the examples myself.
> Reversing Commits
> -----------------
> While a goal of a revision control system is to record
> ...
The flow-chart based recipe is wonderful.
^ permalink raw reply
* Re: git binary directory?
From: Junio C Hamano @ 2005-11-06 20:15 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0511060816390.3316@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> Right now, for a 1.0 release, I suspect that the "put the git binaries
> somewhere else" just isn't worth it. It will break existing scripts that
> use the binaries directly (we've already broken the kernel.org snapshot
> scripts about a million times with just _renaming_ the binaries ;)
Although I _really_ wanted a 1.0 soonish, I personally feel that
this change is better done now than later, if we are eventually
going to do it anyway. "Never" _might_ be better than "now",
but I suspect "later" or "post 1.0" is worse.
^ permalink raw reply
* Re: Documentation Directions
From: Junio C Hamano @ 2005-11-06 20:11 UTC (permalink / raw)
To: Jon Loeliger; +Cc: git
In-Reply-To: <E1EYoQE-0002QX-VM@jdl.com>
Jon Loeliger <jdl@freescale.com> writes:
> Couple of questions regarding documentation direction:
>
> - Is the plan to update all docs to use $GIT_DIR instead of .git?
I personally feel we should use less (not more) $GIT_DIR in the
documentation and casual mention of things under .git/ directory
should say .git/ instead, with the understanding that the reader
have already learned that there is a way to override it if the
user chooses to do so.
> - Do we intend on adding explicit support for '--help' on most,
> if not all, of the git commands?
I think that would be very helpful.
> - Do you want to standardize on using a '$' prompt
> for all the example command executions samples?
Ah, I see you recently added a couple of Csh style '%' prompt.
Also I suspect that some examples in earlier tutorial do not
even have any prompt.
You are right -- being consistent would be nice.
^ permalink raw reply
* expat.h missing
From: alxneit @ 2005-11-06 20:39 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
Nick Hengevelds patch to add support for pushing to a remote repository using
HTTP/DAV (58e60dd203362ecb9fdea765dcc2eb573892dbaf)
introduces "#include expat.h" in http-push.c. this file seems to be missing.
--
Dr. Ivo Alxneit
Laboratory for Solar Technology phone: +41 56 310 4092
Paul Scherrer Institute fax: +41 56 310 2688
CH-5232 Villigen http://solar.web.psi.ch
Switzerland gnupg key: 0x515E30C7
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Documentation Directions
From: Jon Loeliger @ 2005-11-06 19:28 UTC (permalink / raw)
To: git
Also:
- Do you want to standardize on using a '$' prompt
for all the example command executions samples?
Like so:
Do do the thing, run the command:
$ git-frobnicate --weirdly
Do you/we care? Consistency uber alles?
Thanks,
jdl
^ permalink raw reply
* Re: Check for differents trees
From: Marco Costalba @ 2005-11-06 19:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Junio C Hamano wrote:
>>The problem is that if sha1 and sha2 correspond to very
>>"distant" revision the output of git-diff-tree can be very
>>long and also usless as long as I stop searching at first
>>match.
>
>
>Perhaps
>
> $ git-diff-tree -r --name-status --diff-filter=AD sha1 sha2
>
>would help you somewhat? This would not make the diff
>generation part quicker, but at least you do not have to parse
>other types of changes.
>
Thanks Junio,
as you said, the speed is almost the same but your way is clearly better.
I have pushed the change.
P.S.: Could be interesting something like?:
git-diff-tree -r --name-status --diff-filter=^M sha1 sha2
-------------------
>Dscho says:
>
>if you want to know if tree1 and tree2 have *exactly* the same files, you
>only have to compare the sha1 of the two trees. If they are equal you are
>virtually guaranteed that the two trees contain the same files.
I have impemented a tree viewer inside qgit. Tree view is updated when user browses through
revisions.
Loading the file names of a given tree, altough only for the open directories, is an expensive
operation. So I added a little "same files" test to skip tree reloading.
With "same files" I mean that the file list is the same bewteen tree1 and tree1, _not_ that the
files content are the same. As example, if tree1 is parent of tree2 (and tree2 is not a merge) and
the revision between the two only modified files (git-diff-tree status is M), in my test tree1 and
tree2 have the same files, also if sha's are, of course, different.
Put in other way, two trees have the "same files" if I don't have to repaint the tree view window.
Marco
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
^ permalink raw reply
* Re: What's in git.git tonight
From: Junio C Hamano @ 2005-11-06 18:47 UTC (permalink / raw)
To: Randal L. Schwartz; +Cc: git
In-Reply-To: <86u0eqrm64.fsf@blue.stonehenge.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
> And, I've confirmed that this patch does the trick, and will probably
> defer any other issues with "optional" packages in the future:
Thanks. Next time around could you sign-off your patch?
^ permalink raw reply
* Re: Check for differents trees
From: Johannes Schindelin @ 2005-11-06 18:24 UTC (permalink / raw)
To: Marco Costalba; +Cc: git
In-Reply-To: <20051106153830.18963.qmail@web26312.mail.ukl.yahoo.com>
Hi,
if you want to know if tree1 and tree2 have *exactly* the same files, you
only have to compare the sha1 of the two trees. If they are equal you are
virtually guaranteed that the two trees contain the same files.
Hth,
Dscho
^ permalink raw reply
* Re: Check for differents trees
From: Junio C Hamano @ 2005-11-06 18:09 UTC (permalink / raw)
To: Marco Costalba; +Cc: git
In-Reply-To: <20051106153830.18963.qmail@web26312.mail.ukl.yahoo.com>
Marco Costalba <mcostalba@yahoo.it> writes:
> What I use now is:
>
> git-diff-tree -r --name-status sha1 sha2
>
> An then I parse the output for 'A' or 'D' as first char of
> each line. When I found one of that two chars I kwnow trees
> have different files set.
>
> The problem is that if sha1 and sha2 correspond to very
> "distant" revision the output of git-diff-tree can be very
> long and also usless as long as I stop searching at first
> match.
Perhaps
$ git-diff-tree -r --name-status --diff-filter=AD sha1 sha2
would help you somewhat? This would not make the diff
generation part quicker, but at least you do not have to parse
other types of changes.
^ permalink raw reply
* Documentation Directions
From: Jon Loeliger @ 2005-11-06 17:35 UTC (permalink / raw)
To: git
Couple of questions regarding documentation direction:
- Is the plan to update all docs to use $GIT_DIR instead of .git?
- Do we intend on adding explicit support for '--help' on most,
if not all, of the git commands? In some cases (git-branch)
a -*) case tacitly catches --help and usage()'s it. In other
cases (git-pull) this can't be done as -*) passes options
on to git-fetch. I think that we should catch --help directly
so that it doesn't emit git-fetch's *) catch-all usage:
% git pull --help
usage: git-fetch-pack [-q] [-v] [--exec=upload-pack] [host:]directory <refs>...
Fetch failure: --help
- Do you want to head in the per-man-page-"Now What?" direction
as suggested by Junio?
Thanks,
jdl
^ permalink raw reply
* [PATCH] Refactor merge strategies into separate includable file.
From: Jon Loeliger @ 2005-11-06 16:26 UTC (permalink / raw)
To: git
Signed-off-by: Jon Loeliger <jdl@freescale.com>
---
Documentation/git-merge.txt | 2 ++
Documentation/git-pull.txt | 36 +-----------------------------------
Documentation/merge-strategies.txt | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 35 deletions(-)
create mode 100644 Documentation/merge-strategies.txt
applies-to: 2a5577073c7747c11ad79f414603e68c5d95cf6b
ceda5bc3b5cb502edb3c0596aeede1a0ab9d4295
diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index 3e058db..b3ef19b 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -34,6 +34,8 @@ include::merge-pull-opts.txt[]
least one <remote>. Specifying more than one <remote>
obviously means you are trying an Octopus.
+include::merge-strategies.txt[]
+
SEE ALSO
--------
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index ec10a2f..7ebb08d 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -31,42 +31,8 @@ include::pull-fetch-param.txt[]
include::merge-pull-opts.txt[]
+include::merge-strategies.txt[]
-MERGE STRATEGIES
-----------------
-
-resolve::
- This can only resolve two heads (i.e. the current branch
- and another branch you pulled from) using 3-way merge
- algorithm. It tries to carefully detect criss-cross
- merge ambiguities and is considered generally safe and
- fast. This is the default merge strategy when pulling
- one branch.
-
-recursive::
- This can only resolve two heads using 3-way merge
- algorithm. When there are more than one common
- ancestors that can be used for 3-way merge, it creates a
- merged tree of the common ancestores and uses that as
- the reference tree for the 3-way merge. This has been
- reported to result in fewer merge conflicts without
- causing mis-merges by tests done on actual merge commits
- taken from Linux 2.6 kernel development history.
- Additionally this can detect and handle merges involving
- renames.
-
-octopus::
- This resolves more than two-head case, but refuses to do
- complex merge that needs manual resolution. It is
- primarily meant to be used for bundling topic branch
- heads together. This is the default merge strategy when
- pulling more than one branch.
-
-ours::
- This resolves any number of heads, but the result of the
- merge is always the current branch head. It is meant to
- be used to supersede old development history of side
- branches.
EXAMPLES
diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt
new file mode 100644
index 0000000..3ec56d2
--- /dev/null
+++ b/Documentation/merge-strategies.txt
@@ -0,0 +1,35 @@
+MERGE STRATEGIES
+----------------
+
+resolve::
+ This can only resolve two heads (i.e. the current branch
+ and another branch you pulled from) using 3-way merge
+ algorithm. It tries to carefully detect criss-cross
+ merge ambiguities and is considered generally safe and
+ fast. This is the default merge strategy when pulling
+ one branch.
+
+recursive::
+ This can only resolve two heads using 3-way merge
+ algorithm. When there are more than one common
+ ancestors that can be used for 3-way merge, it creates a
+ merged tree of the common ancestores and uses that as
+ the reference tree for the 3-way merge. This has been
+ reported to result in fewer merge conflicts without
+ causing mis-merges by tests done on actual merge commits
+ taken from Linux 2.6 kernel development history.
+ Additionally this can detect and handle merges involving
+ renames.
+
+octopus::
+ This resolves more than two-head case, but refuses to do
+ complex merge that needs manual resolution. It is
+ primarily meant to be used for bundling topic branch
+ heads together. This is the default merge strategy when
+ pulling more than one branch.
+
+ours::
+ This resolves any number of heads, but the result of the
+ merge is always the current branch head. It is meant to
+ be used to supersede old development history of side
+ branches.
---
0.99.9.GIT
^ permalink raw reply related
* Re: git binary directory?
From: Linus Torvalds @ 2005-11-06 16:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vy84249re.fsf@assigned-by-dhcp.cox.net>
On Sat, 5 Nov 2005, Junio C Hamano wrote:
>
> My point (actually, my purist half's point) is that /usr/bin is
> that nice structure that keeps related things together --- the
> relatedness of them being "the end user would want to run them".
Yes. I wish there was some way around that.
Right now, for a 1.0 release, I suspect that the "put the git binaries
somewhere else" just isn't worth it. It will break existing scripts that
use the binaries directly (we've already broken the kernel.org snapshot
scripts about a million times with just _renaming_ the binaries ;)
It would still be nice to not screw up peoples /usr/bin too badly. At
least we have the nice property that our git programs sort together and
can pretty much be wild-carded (not everybody uses package installers, and
on one machine I had just done "make prefix=/usr install" and was happy to
be able to basically remove it with "rm /usr/bin/git-*")
Linus
^ permalink raw reply
* Check for differents trees
From: Marco Costalba @ 2005-11-06 15:38 UTC (permalink / raw)
To: git
Hi all,
I need to check as fast as possible if two given trees (sha1 and sha2) have the same files.
What I use now is:
git-diff-tree -r --name-status sha1 sha2
An then I parse the output for 'A' or 'D' as first char of each line. When I found one of that two
chars I kwnow trees have different files set.
The problem is that if sha1 and sha2 correspond to very "distant" revision the output of
git-diff-tree can be very long and also usless as long as I stop searching at first match.
My question is if there is a better way, with the constrain of _not_ use a pipe of commands
like git-diff-tree....| grep something.
The constrain belong from Qt process class that is not very friendly with shells.
Thanks for any help
Marco
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
^ permalink raw reply
* Re: git binary directory?
From: Nikolai Weibull @ 2005-11-06 15:03 UTC (permalink / raw)
To: git
In-Reply-To: <Pine.LNX.4.63.0511061504080.3953@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin wrote:
> Wouldn't it be lovely if the auto-completion files, as well as the
> list of available programs in git.sh (or git-help.sh), would be
> autogenerated?
Yes.
nikolai (oblivious to irony and rhetorical questions)
--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply
* Re: git binary directory?
From: Johannes Schindelin @ 2005-11-06 14:05 UTC (permalink / raw)
To: Nikolai Weibull; +Cc: git
In-Reply-To: <20051106131359.GA9055@puritan.petwork>
Hi,
Wouldn't it be lovely if the auto-completion files, as well as the list of
available programs in git.sh (or git-help.sh), would be autogenerated?
Ciao,
Dscho
^ permalink raw reply
* Re: git binary directory?
From: Nikolai Weibull @ 2005-11-06 13:13 UTC (permalink / raw)
To: git
In-Reply-To: <EC1099E0-0854-4361-9B61-E7728264985A@hawaga.org.uk>
[-- Attachment #1: Type: text/plain, Size: 897 bytes --]
Ben Clifford wrote:
> On 6 Nov 2005, at 08:43, Yaacov Akiba Slama wrote:
> > In addition custom tab completion can be quite easily added to bash
> > and zsh.
> Anyone done this already for git? I've been slowly adding bits to
> Paolo Giarrusso's bash/stg tab completion code to provide some
> completion for cogito, but haven't got round to git yet.
Here’s something I’m planning on sending to the Zsh list. It’s still
incomplete, and I don’t know all the commands well enough yet to write
the more generic completion parts (like completing repositories,
branches, commit ids, remotes, and such). Perhaps someone can help out
with that? All comments welcome.
nikolai
--
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
[-- Attachment #2: _git --]
[-- Type: text/plain, Size: 29048 bytes --]
#compdef git-apply git-checkout-index git-commit-tree git-hash-object git-init-db git-merge-index git-mktag git-pack-objects git-prune-packed git-read-tree git-unpack-objects git-update-index git-write-tree git-cat-file git-diff-index git-diff-files git-diff-stages git-diff-tree git-fsck-objects git-ls-files git-ls-tree git-merge-base git-rev-list git-show-index git-tar-tree git-unpack-file git-var git-verify-pack git-clone-pack git-fetch-pack git-http-fetch git-local-fetch git-peek-remote git-receive-pack git-send-pack git-ssh-fetch git-ssh-upload git-update-server-info git-upload-pack git-add git-applymbox git-bisect git-branch git-checkout git-cherry-pick git-clone git-commit git-diff git-fetch git-format-patch git-grep git-log git-ls-remote git-merge git-octopus git-pull git-push git-rebase git-rename git-repack git-reset git-resolve git-revert git-shortlog git-show-branch git-status git-verify-tag git-whatchanged git-applypatch git-archimport git-convert-objects git-cvsimport git-merge-one-file git-prune git-relink git-sh-setup git-tag git-cherry git-count-objects git-daemon git-get-tar-commit-id git-mailinfo git-mailsplit git-patch-id git-parse-remote git-request-pull git-rev-parse git-send-email git-stripspace
# TODO: most commands need a valid git repository to run, so add a check for it
# so that we can make our handling a little bit cleaner (need to deal with
# GIT_DIR=... stuff as pre-command modifier)
# TODO: tree-ish should probably be using __git_comimit_ids2
local ret=1
_call_function ret _$words[1]
# TODO: perhaps only allow *.patch for files
_git-apply () {
_arguments \
'*--exclude=-[skip files matching specified pattern]:file pattern' \
'*--no-merge[do not use merge behavior]' \
'*--stat[output diffstat for the input]' \
'*--summary[output summary of git-diff extended headers]' \
'*--check[check if patches are applicable]' \
'*--index[make sure that the patch is applicable to the index]' \
'*--show-files[show summary of files that are affected by the patches]' \
'*--apply[apply patches that would otherwise not be applied]' \
'*:file:_files' && ret=0
}
_git-checkout-index () {
_arguments -S \
'(-u --index)'{-u,--index}'[update stat information in index]' \
'(-q --quiet)'{-q,--quiet}'[do not complain about existing files or missing files]' \
'(-f --force)'{-f,--force}'[force overwrite of existing files]' \
'(-a --all)'{-a,--all}'[check out all files in the index]' \
'(-n --no-create)'{-n,--no-create}'[do not checkout new files]' \
'*--prefix=-[prefix to use when creating files]:directory:_directories' \
'*:file:_files' && ret=0
}
_git-commit-tree () {
if (( CURRENT == 2 )); then
_guard "[[:xdigit:]]#" "tree object" && ret=0
else
local context state line
typeset -A opt_args
_arguments \
'*-p: :_guard "[[\:xdigit\:]]#" "commit object that should act as a parent to the tree"' \
'*: :->nothing'
ret=0
fi
}
_git-hash-object () {
_arguments \
'-t[the type of object to create]:object type:((blob\:"a blob of data"
commit\:"a tree with parent commits"
tag\:"a symbolic name for another object"
tree\:"a recursive tree of blobs"))' \
'-w[write the object to the object database]' \
'*:file:_files' && ret=0
}
_git-init-db () {
_arguments \
'--template=-[directory to use as a template for the object database]:directory:_directories' && ret=0
}
_git-merge-index () {
if (( CURRENT > 2 )) && [[ $words[CURRENT-1] != -[oq] ]]; then
_arguments -S \
'-a[run merge against all files in the index that need merging]' \
'*:file:_files' && ret=0
else
typeset -a arguments
(( CURRENT == 2 )) && arguments+='-o[skip failed merges]'
(( CURRENT == 2 || CURRENT == 3 )) && arguments+='(-o)-q[do not complain about failed merges]'
(( 2 <= CURRENT && CURRENT <= 4 )) && arguments+='*:merge program:_files -g "*(*)"'
_arguments $arguments && ret=0
fi
}
_git-mktag () {
_message 'no arguments allowed; only accepts tags on standard input'
}
_git-pack-objects () {
_arguments \
'--incremental[ignore objects that have already been packed]' \
'--window=-[number of objects to use per delta compression]' \
'--depth=-[maximum delta depth]' \
'(:)--stdout[write the pack to standard output]' \
':base-name:_files' && ret=0
}
_git-prune-packed () {
_arguments \
'-n[only list the objects that would be removed]' && ret=0
}
# TODO: --trivial and --reset (undocumented)
_git-read-tree () {
if (( CURRENT == 2 )); then
_arguments \
': :_guard "[[\:xdigit\:]]#" "tree-ish to be read into the index"' && ret=0
elif [[ $words[2] == -m ]]; then
_arguments \
'-u[update the work tree after successful merge]' \
'-i[update only the index; ignore changes in work tree]' \
'2: :_guard "[[\:xdigit\:]]#" "first tree-ish to be read/merged"' \
'3: :_guard "[[\:xdigit\:]]#" "second tree-ish to be read/merged"' \
'4: :_guard "[[\:xdigit\:]]#" "third tree-ish to be read/merged"' && ret=0
else
_message 'no more arguments'
fi
}
_git-unpack-objects () {
_arguments \
'-n[only list the objects that would be unpacked]' \
'-q[run quietly]' && ret=0
}
_git-update-index () {
_arguments -S \
'-q[run quietly]' \
'--add[add files not already in the index]' \
'--remove[remove files that are in the index but are missing from the work tree]' \
'--refresh[refresh the index]' \
'--ignore-missing[ignore missing files when refreshing the index]' \
'--cacheinfo[insert information directly into the cache]: :_guard "[0-7]#" "octal file mode": :_guard "[[\:xdigit\:]]#" "object id":file:_files' \
'--info-only[only insert files object-IDs into index]' \
'--force-remove[remove files from both work tree and the index]' \
'--replace[replace files already in the index if necessary]' \
'--stdin[read list of paths from standard input]' \
'-z[paths are separated with NUL instead of LF for --stdin]' \
'*:file:_files' && ret=0
}
_git-write-tree () {
_arguments \
'--missing-ok[ignore objects in the index that are missing in the object database]' && ret=0
}
_git-cat-file () {
if (( CURRENT == 2 )); then
_arguments \
'-t[show the type of the given object]' \
'-s[show the size of the given object]' \
'*: :_values "object type" blob commit tag tree' && ret=0
elif (( CURRENT == 3 )); then
_guard "[[:xdigit:]]#" "object id" && ret=0
else
_message 'no more arguments'
fi
}
typeset -ga diff_args
# TODO: -s and --diff-filter are undocumented
diff_args=(
'-p[generate diff in patch format]'
'-u[synonym for -p]'
'-z[use NUL termination on output]'
'-l-[number of rename/copy targets to run]: :_guard "[[\:digit\:]]#" number'
'--name-only[show only names of changed files]'
'--name-status[show only names and status of changed files]'
'-R[do a reverse diff]'
'-S-[look for differences that contain the given string]:string'
'-s[do not produce any output]'
'-O-[output patch in the order of glob-pattern lines in given file]:file:_files'
'--diff-filter=-[filter to apply to diff]'
'--pickaxe-all[when -S finds a change, show all changes in that changeset]'
'-B-[break complete rewrite changes into pairs of given size]: :_guard "[[\:digit\:]]#" size'
'-M-[detect renames with given score]: :_guard "[[\:digit\:]]#" size'
'-C-[detect copies as well as renames with given score]: :_guard "[[\:digit\:]]#" size'
'--find-copies-harder[try harder to find copies]'
)
typeset -g pretty_arg=
pretty_arg='--pretty=-[pretty print commit messages]::pretty print:((raw\:"the raw commits"
medium\:"most parts of the messages"
short\:"few headers and only subject of messages"
full\:"all parts of the commit messages"
oneline\:"commit-ids and subject of messages"))'
_git-diff-index () {
_arguments -S \
$diff_args \
'-r[recurse into subdirectories]' \
'-m[flag non-checked-out files as up-to-date]' \
'--cached[do not consider the work tree at all]' \
': :_guard "[[\:xdigit\:]]#" "tree-ish"' \
'*:file:_files' && ret=0
}
_git-diff-files () {
_arguments \
$diff_args \
'-q[do not complain about nonexisting files]' \
'*:file:_files' && ret=0
}
_git-diff-stages () {
_arguments \
$diff_args \
': :_guard "[[\:digit\:]]#" "stage 1 number"' \
': :_guard "[[\:digit\:]]#" "stage 2 number"' \
'*:file:_files' && ret=0
}
_git-diff-tree () {
_arguments -S \
$diff_args \
$pretty_arg \
'-r[recurse into subdirectories]' \
'-t[show tree entry itself as well as subtrees (implies -r)]' \
'-m[show merge commits]' \
'-v[show verbose headers]' \
'--stdin[read commit and tree information from standard input]' \
'--root[show diff against the empty tree]' \
': :_guard "[[\:xdigit\:]]#" "tree-ish"' \
':: :_guard "[[\:xdigit\:]]#" "tree-ish"' \
'*:file:_files' && ret=0
}
_git-fsck-objects () {
_arguments -S \
'--cache[consider objects recorded in the index as head nodes for reachability traces]' \
'--full[check all object directories]'
'--root[show root nodes]' \
'--standalone[check only the current object directory]' \
'--strict[do strict checking]' \
'--tags[show tags]' \
'--unreachable[show objects that are unreferenced in the object database]' \
'*: :_guard "[[\:xdigit\:]]#" "object id"' && ret=0
}
# TODO: need to handle names with whitespace
# TODO: do we actually need _wanted?
__git_files () {
local expl
# TODO: deal with GIT_DIR
if [[ $_git_file_cache_pwd != $PWD ]]; then
_git_file_cache=("${(@f)$(git-ls-files 2>/dev/null)}")
_git_file_cache_pwd=$PWD
fi
_wanted files expl 'index file' _multi_parts / _git_file_cache
}
__git_tree_files () {
local expl
typeset -a tree_file_cache
tree_file_cache=("${(@f)$(git-ls-tree -r $1 | awk '{print $4}')}")
_wanted files expl 'tree file' _multi_parts / tree_file_cache
}
# TODO: am I using _wanted correctly? Need to learn _wanted and _describe
__git_commit_ids () {
local commits
commits=("${(@f)$(git-rev-list HEAD 2>/dev/null)}")
if (( $? == 0 )); then
_wanted commits expl 'commit ids' compadd - $commits
else
_message 'not a git repository'
fi
}
__git_commit_ids2 () {
compset -P '\\\^'
__git_commit_ids
}
__git_heads () {
local expl heads
heads=("${(@f)$(ls "$(git-rev-parse 2>/dev/null)/refs/heads" 2>/dev/null)}")
if (( $? == 0 )); then
_wanted heads expl 'heads' compadd - HEAD $heads
else
_message 'not a git repository'
fi
}
_git-ls-files () {
_arguments -S \
'(-c --cached)'{-c,--cached}'[show cached files in the output]' \
'(-d --deleted)'{-d,--deleted}'[show deleted files in the output]' \
'(-i --ignored)'{-i,--ignored}'[show ignored files in the output]' \
'(-k --killed)'{-k,--killed}'[show killed files in the output]' \
'(-m --modified)'{-m,--modified}'[show modified files in the output]' \
'(-o --others)'{-o,--others}'[show other files in the output]' \
'(-s --stage)'{-s,--stage}'[show stage files in the output]' \
'-t[identify each files status]' \
'(-u --unmerged)'{-u,--unmerged}'[show unmerged files in the output]' \
'*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \
'*'{-X,--exclude-from=-}'[skip files matching patterns in given file]:file:_files' \
'*--exclude-per-directory=-[skip directories matching patterns in given file]:file:_files' \
'-z[use NUL termination on output]' \
'*:index file:__git_files' && ret=0
}
_git-ls-tree () {
local tree
for word in $words[2,-1]; do
if [[ $word != -* ]]; then
tree=$word
break
fi
done
_arguments \
'-d[do not show children of given tree]' \
'-r[recurse into subdirectories]' \
'-z[use NUL termination on output]' \
': :_guard "[[\:xdigit\:]]#" "tree-ish"' \
'*:tree file:{[[ -n $tree ]] && __git_tree_files $tree}' && ret=0
}
_git-merge-base () {
_arguments \
'(-a --all)'{-a,--all}'[show all common ancestors]' \
':commit id 1:__git_commit_ids' \
':commit id 2:__git_commit_ids' && ret=0
}
# TODO: --show-breaks only valid if --merge-order specified
# TODO --all undocumented
_git-rev-list () {
_arguments \
$pretty_arg \
'--all[show all commits]' \
'--bisect[show only the middlemost commit object]' \
'--objects[show object ids of objects referenced by the listed commits]' \
'--max-age[maximum age of commits to output]: :_guard "[[\:digit\:]]#" number' \
'--max-count[maximum number of commits to output]: :_guard "[[\:digit\:]]#" timestamp' \
'--merge-order[decompose into minimal and maximal epochs]' \
'--min-age[minimum age of commits to output]: :_guard "[[\:digit\:]]#" timestamp' \
'--objects[show all objects]' \
'--parents[show parent commits]' \
'--show-breaks[show commit prefixes]' \
'--unpacked[show only unpacked commits]' \
'--header[show commit headers]' \
'*:commit id:__git_commit_ids2' && ret=0
}
_git-show-index () {
_message 'no arguments allowed; accepts index file on standard input'
}
_git-tar-tree () {
_arguments \
': :_guard "[[\:xdigit\:]]#" "tree-ish"' \
':base-name:_files' && ret=0
}
_git-unpack-file () {
_arguments \
': :_guard "[[\:xdigit\:]]#" "blob id"' && ret=0
}
_git-var () {
_arguments \
- variables \
'-l[show logical variables]' \
':variable' && ret=0
}
_git-verify-pack () {
_arguments -S \
'-v[show objects contained in pack]' \
'*:index file:_files -g "*.idx"' && ret=0
}
# FIXME: these should be imported from _ssh
# TODO: this should take -/ to only get directories
_remote_files () {
# There should be coloring based on all the different ls -F classifiers.
local expl rempat remfiles remdispf remdispd args suf ret=1
if zstyle -T ":completion:${curcontext}:files" remote-access; then
zparseopts -D -E -a args p: 1 2 4 6 F:
if [[ -z $QIPREFIX ]]
then rempat="${PREFIX%%[^./][^/]#}\*"
else rempat="${(q)PREFIX%%[^./][^/]#}\*"
fi
remfiles=(${(M)${(f)"$(_call_program files ssh $args -a -x ${IPREFIX%:} ls -d1FL "$rempat" 2>/dev/null)"}%%[^/]#(|/)})
compset -P '*/'
compset -S '/*' || suf='remote file'
# remdispf=(${remfiles:#*/})
remdispd=(${(M)remfiles:#*/})
_tags files
while _tags; do
while _next_label files expl ${suf:-remote directory}; do
# [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \
# ${(q)remdispf%[*=@|]} && ret=0
compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \
${(q)remdispd%/} && ret=0
done
(( ret )) || return 0
done
return ret
else
_message -e remote-files 'remote file'
fi
}
typeset -g exec_arg=
exec_arg='--exec=-[specify path to git-upload-pack on remote side]:remote path'
__git-remote-repository () {
local service
service= _ssh
if compset -P '*:'; then
_remote_files && ret=0
else
_alternative \
'directories::_directories' \
'hosts:host:_ssh_hosts -S:' && ret=0
fi
}
__git-any-repositories () {
_alternative \
'files::_files' \
'remote repositories::__git-remote-repository' && ret=0
}
__git_ref_spec () {
}
# TODO: how about curcontext? (-C)
__git-clone_or_fetch-pack () {
_arguments \
$exec_arg \
'-q[run quietly]' \
':remote repository:__git-remote-repository' \
'*:head:__git_heads' && ret=0
}
_git-clone-pack () {
__git-clone_or_fetch-pack
}
_git-fetch-pack () {
__git-clone_or_fetch-pack
}
typeset -ga fetch_args
fetch_args=(
'-a[fetch all objects]'
'-c[fetch commit objects]'
'--recover[recover from a failed fetch]'
'-t[fetch trees associated with commit objects]'
'-v[show what is downloaded]'
'-w[write out the given commit-id to the given file]:new file'
)
__git-http_or_ssh-fetch () {
_arguments \
$fetch_args \
':commit id:__git_commit_ids' \
':URL:_urls' && ret=0
}
# TODO: __git_commit_ids appropriate here?
_git-http-fetch () {
__git-http_or_ssh-fetch
}
_git-local-fetch () {
_arguments \
$fetch_args \
'-l[hard-link objects]' \
'-n[do not copy objects]' \
'-s[sym-link objects]' \
':commit id:__git_commit_ids' \
':directory:_directories' && ret=0
}
_git-peek-remote () {
_arguments \
$exec_arg \
':remote repository:__git-remote-repository' && ret=0
}
_git-receive-pack () {
_arguments \
':directory:_directories' && ret=0
}
_git-send-pack () {
_arguments \
$exec_arg \
'--all[update all refs that exist locally]' \
'--force[update remote orphaned refs]' \
':remote repository:__git-remote-repository' \
'*:remote refs' && ret=0
}
_git-ssh-fetch () {
__git-http_or_ssh-fetch
}
_git-ssh-upload () {
__git-http_or_ssh-fetch
}
_git-update-server-info () {
_arguments \
'(-f --force)'{-f,--force}'[update the info files from scratch]'
}
_git-upload-pack () {
_arguments \
':directory:_directories' && ret=0
}
_git-add () {
_arguments \
'-n[do not actually add files; only show which ones would be added]' \
'-v[show files as they are added]' \
'*:file:_files' && ret=0
}
__git_signoff_file () {
_alternative \
'signoffs:signoff:(yes true me please)' \
'files::_files' && ret=0
}
# TODO: for -c: add support for .dotest/ prefix
_git-applymbox () {
_arguments \
'-k[do not modify Subject: header]' \
'-q[apply patches interactively]' \
'-u[encode commit information in UTF-8]' \
'(1)-c[restart command after fixing an unclean patch]:patch:_files' \
':mbox file:_files' \
'::signoff file:__git_signoff_file' && ret=0
}
_git-bisect () {
local bisect_cmds
bisect_cmds=(
bad:"mark current or given revision as bad"
good:"mark current or given revision as good"
log:"show the log of the current bisection"
next:"find next bisection to test and check it out"
replay:"replay a bisection log"
reset:"finish bisection search and return to the given branch (or master)"
start:"reset bisection state and start a new bisection"
visualize:"show the remaining revisions in gitk"
)
if (( CURRENT == 2 )); then
_describe -t command "git-bisect commands" bisect_cmds && ret=0
else
case $words[2] in
(bad)
_arguments \
'2:revision:__git_commit_ids' && ret=0
;;
(good)
_arguments \
'*:revision:__git_commit_ids' && ret=0
;;
(replay)
_arguments \
'2:file:_files' && ret=0
;;
(reset)
_arguments \
'2:branch:__git_heads' && ret=0
;;
(*)
_message 'no arguments allowed' && ret=0
;;
esac
fi
}
_git-branch () {
_arguments \
':branch-name'
':base branch:__git_heads' && ret=0
}
# TODO: here, branch can be any object ID that resolves to a commit. How do we
# deal with that? _alternative on __git_heads, __git_tags, and __git_commit_ids?
# git-rev-parse?
_git-checkout () {
_arguments \
'-f[force a complete re-read]' \
'-b[create a new branch based at given branch]:branch-name' \
':branch:__git_heads' && ret=0
}
_git-cherry-pick () {
_arguments \
'(-n --no-commit)'{-n,--no-commit}'[do not make the actually commit]' \
'(-r --replay)'{-r,--replay}'[use the original commit message intact]' \
':commit id:__git_commit_ids' && ret=0
}
# TODO: should support rsync completion here as well
_git-clone () {
_arguments \
'(-l --local)'{-l,--local}'[perform a local cloning of a repository]' \
'(-s --shared)'{-s,--shared}'[share the objects with the source repository]' \
'(-q --quiet)'{-q,--quiet}'[operate quietly]' \
'-n[do not checkout HEAD after clone is complete]' \
'(-u --upload-pack)'{-u,--uploadpack}'[specify path to git-upload-pack on remote side]:remote path' \
':repository:__git-any-repositories' \
':directory:_directories' && ret=0
}
_git-commit () {
_arguments -S \
'(-a --all)'{-a,--all}'[update all paths in the index file]' \
'(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \
'(-v --verify)'{-v,--verify}'[look for suspicious lines the commit introduces]' \
'(-n --no-verify)'{-n,--no-verify}'[do not look for suspicious lines the commit introduces]' \
'(-e --edit)'{-e,--edit}'[edit the commit message before committing]' \
'*:file:_files' \
- '(message)' \
'(-c -C --reedit-message --reuse-message)'{-c,--reedit-message=}'[use existing commit object and edit log message]::commit id:__git_commit_ids' \
'(-c -C --reedit-message --reuse-message)'{-c,--reuse-message=}'[use existing commit object with same log message]::commit id:__git_commit_ids' \
'(-F --file)'{-F,--file=}'[read commit message from given file]:file:_files' \
'(-m --message)'{-m,--message=}'[use the given message as the commit message]:message' && ret=0
}
_git-diff () {
_arguments \
$diff_args \
'::commit id 1:__git_commit_ids2' \
'::commit id 2:__git_commit_ids2' \
'*:file:_files' && ret=0
}
# TODO: --tags undocumented
_git-fetch () {
_arguments \
'(-a --append)'{-a,--append}'[append fetched refs instead of overwriting]' \
'(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \
'(-t --tags)'{-t,--tags}'[use tags]' \
'(-u --update-head-ok)'{-u,--update-head-ok}'[allow updates of current branch head]' \
':repository:__git-any-repositories' \
'*:refspec:__git_ref_spec' && ret=0
}
_git-format-patch () {
_arguments \
'(-a --author)'{-a,--author}'[output From: header for your own commits as well]' \
'--date[output Date: header for your own commits as well]' \
'-o[store resulting files in given directory]:directory:_directories' \
'-k[do not strip/add \[PATCH\] from the first line of the commit message]' \
'--mbox[use true mbox formatted output]' \
'-n[name output in \[PATCH n/m\] format]' \
':their commit id:__git_commit_ids2' \
'::my commit id:__git_commit_ids2' && ret=0
}
# TODO: repository needs fixing
# TODO: reference needs fixing
# TODO: references can be extracted with this command: $(ls-remote ./.)
# TODO: tags can be extracted with this command: $(ls-remote --tags ./.)
_git-ls-remote () {
_arguments \
'--heads[show only refs under refs/heads]' \
'--tags[show only refs under refs/tags]' \
':repository:__git-any-repositories' \
'*:reference' && ret=0
}
# TODO: document merge strategies
# TODO: <head> argument right?
# TODO: <remote> argument right?
_git-merge () {
_arguments \
'(-n --no-summary)'{-n,--no-summary}'[do not show diffstat at end of merge]' \
{-s,--strategy}'[use given merge strategy]:strategy:(octopus recursive resolve stupid)' \
':merge message' \
':head:__git_commit_ids2' \
':remote:__git_commit_ids2' && ret=0
}
_git-mv () {
_arguments \
'-f[force renaming/moving even if targets exist]' \
'-k[skip move/renames that would lead to errors]' \
'-n[only show what would happen]' \
'*:file:_files' && ret=0
}
_git-octupus () {
_message 'no arguments allowed' && ret=0
}
_git-rebase () {
_arguments \
':upstream branch:__git_commit_ids2' \
'::working branch:__git_commit_ids2' && ret=0
}
_git-rename () {
_arguments \
':source index file:__git_files' \
':destination file:_files' && ret=0
}
# TODO: -l option (--local)
_git-repack () {
_arguments \
'-a[pack all objects into a single pack]' \
'-d[remove redundant packs after packing]' \
'-n[do not update server information]' && ret=0
}
_git-reset () {
_arguments \
- (levels) \
'--mixed[like --soft but report what has not been updated (default)]' \
'--soft[do not touch the index file nor the working tree]' \
'--hard[match the working tree and index to the given tree]' \
':commit-ish:__git_commit_ids2' && ret=0
}
_git-resolve () {
_arguments \
':current commit:__git_commit_ids2' \
':merged commit:__git_commit_ids2' \
':commit message'
}
_git-revert () {
_arguments \
'(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]'
':commit:__git_commit_ids2' && ret=0
}
_git-shortlog () {
_message 'no arguments allowed' && ret=0
}
# TODO: reference ($GIT_DIR/refs)
_git-show-branch () {
_arguments \
'--all[show all refs under $GIT_DIR/refs]' \
'--heads[show all refs under $GIT_DIR/refs/heads]' \
'--independent[show only the reference that can not be reached from any of the other]' \
'--list[do not display any commit ancestry]' \
'--merge-base[act like "git-merge-base -a" but with two heads]' \
'--more=-[go given number of commit beyond common ancestor (no ancestry if negative)]:number' \
'--no-name[do not show naming strings for each commit]' \
'--sha1-name[name commits with unique prefix of object names]' \
'--tags[show all refs under $GIT_DIR/refs/tags]' \
'*:reference' && ret=0
}
_git-status () {
_message 'no arguments allowed' && ret=0
}
# TODO: tag
_git-verify-tag () {
_arguments \
':tag'
}
# ---
_git-applypatch () {
_arguments \
':message file:_files' \
':patch file:_files' \
':info file:_files' \
'::signoff file:_files' && ret=0
}
_git-convert-objects () {
_arguments \
': :_guard "[[:xdigit:]]#" "object id"' && ret=0
}
# TODO: right to use __git_commit_ids2? Should be branches
_git-cherry () {
_arguments \
'-v[be verbose]' \
':upstream:__git_commit_ids2' \
'::head:__git_commit_ids2' && ret=0
}
_git-count-objects () {
_message 'no arguments allowed' && ret=0
}
# TODO: do better than _directory?
_git-daemon () {
_arguments -S \
'--export-all[allow pulling from all repositories without verification]' \
'(--port)--inetd[run server as an inetd service]' \
'--init-timeout=-[specify timeout between connection and request]' \
'--port=-[specify port to listen to]' \
'--syslog[log to syslog instead of stderr]' \
'--timeout=-[specify timeout for sub-requests]' \
'--verbose[log details about incoming connections and requested files]' \
'*:repository:_directory' && ret=0
}
_git-get-tar-commit-id () {
_message 'no arguments allowed; accepts tar-file on standard input' && ret=0
}
_git-mailinfo () {
_arguments \
'-k[do not strip/add \[PATCH\] from the first line of the commit message]' \
'-u[encode commit information in UTF-8]' \
':message file:_files' \
':patch file:_files' && ret=0
}
_git-mailsplit () {
_arguments \
'-d-[specify number of leading zeros]: :_guard "[[\:digit\:]]#" "precision' \
':mbox file/directory:_files' \
'::directory:_directories' && ret=0
}
_git-patch-id () {
_message 'no arguments allowed; accepts patch on standard input' && ret=0
}
_git-request-pull () {
_arguments \
':start commit:__git_commit_ids2' \
':url:_urls' \
':end commit:__git_commit_ids2'
}
_git-send-email () {
_arguments \
'--compose[use $EDITOR to edit an introductory message for the patch series]' \
'--from[specify the sender of the emails]' \
'--in-reply-to[specify the contents of the first In-Reply-To header]' \
'--smtp-server[specify the outgoing smtp server]:smtp server:_hosts' \
'--subject[specify the initial subject of the email thread]' \
'--to[specify the primary recipient of the emails]' \
- (chain) \
'--chain-reply-to[each email will be sent as a reply to the previous one sent]' \
'--no-chain-reply-to[all emails after the first will be sent as replies to the first one]' && ret=0
}
# TODO: still undocumented
_git-symref () {
}
_git-stripspace () {
_message 'no arguments allowed; accepts input file on standard input' && ret=0
}
^ 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