* What's in git.git (Jul 2008, issue #08; Sat, 26)
From: Junio C Hamano @ 2008-07-26 7:36 UTC (permalink / raw)
To: git
There are quite a bunch of changes to 'master' but they are mostly fix-ups
to the new codepaths introduced recently; iow, exactly the kind of patches
we would want to see before and during the -rc period.
* The 'maint' branch has these fixes since the last announcement.
Björn Steinbrink (1):
index-pack.c: correctly initialize appended objects
Junio C Hamano (2):
tests: propagate $(TAR) down from the toplevel Makefile
Makefile: fix shell quoting
Peter Valdemar Mørch (1):
send-email: find body-encoding correctly
Pierre Habouzit (1):
git-checkout: fix command line parsing.
* The 'master' branch has these since the last announcement
in addition to the above.
Alex Riesen (1):
Allow pager of diff command be enabled/disabled
Brad King (1):
git-svn: teach dcommit about svn auto-props
Brandon Casey (7):
t/: Replace diff [-u|-U0] with test_cmp to allow compilation with old
diff
t4116-apply-reverse.sh: use $TAR rather than tar
t3200,t7201: replace '!' with test_must_fail
t7502-commit.sh: rearrange test to make more portable
t/t4202-log.sh: add newline at end of file
Teach fsck and prune about the new location of temporary objects
perl/Makefile: update NO_PERL_MAKEMAKER section
Daniel Barkalow (1):
In perforce, RCS keywords are case-sensitive
Johannes Schindelin (8):
Rename .git/rebase to .git/rebase-apply
Rename path_list to string_list
Fix two leftovers from path_list->string_list
Ignore dirty submodule states in "git pull --rebase"
Add test to show that show-branch misses out the 8th column
sort_in_topological_order(): avoid setting a commit flag
builtin-commit: Two trivial style-cleanups
git daemon: avoid waking up too often
Johannes Sixt (10):
rebase -i: When an 'edit' stops, mention the commit
Makefile: Do not install a copy of 'git' in $(gitexecdir)
Makefile: Normalize $(bindir) and $(gitexecdir) before comparing
Record the command invocation path early
Fix relative built-in paths to be relative to the command invocation
Allow the built-in exec path to be relative to the command invocation
path
Allow add_path() to add non-existent directories to the path
Windows: Make $(gitexecdir) relative
Windows: Make sure argv[0] has a path
Windows: Do not compile git-shell
Jonathan Nieder (2):
git-diff(1): "--c" -> "--cc" typo fix
document that git-tag can tag more than heads
Junio C Hamano (9):
Update my e-mail address
Revert "make git-status use a pager"
tests: do not rely on external "patch"
stash save: fix parameter handling
builtin-branch.c: remove unused code in append_ref() callback function
builtin-branch.c: optimize --merged and --no-merged
Documentation: clarify diff --cc
ignore non-existent refs in dwim_log()
Documentation: clarify how to disable elements in core.whitespace
Lee Marlow (1):
bash completion: Add long options for 'git rm'
Miklos Vajna (2):
builtin-merge: give a proper error message for invalid strategies in
config
t7601: extend the 'merge picks up the best result' test
Nikolaj Schumacher (1):
Don't cut off last character of commit descriptions.
Olivier Marin (4):
git-am: remove dash from help message
parse-options: fix segmentation fault when a required value is missing
git am --skip: clean the index while preserving local changes
update test case to protect am --skip behaviour
P. Christeas (1):
svnimport: newer libsvn wants us to ask for the root with "", not "/"
Petr Baudis (2):
git-filter-branch.sh: Allow running in bare repositories
Documentation/git-filter-branch: teach "rm" instead of "update-index
--remove"
Philippe Bruhat (1):
mailinfo: better parse email adresses containg parentheses
Pierre Habouzit (3):
builtin-merge: add missing structure initialization
git-submodule: move ill placed shift.
git-checkout: improve error messages, detect ambiguities.
René Scharfe (5):
archive: add write_archive()
archive: move parameter parsing code to archive.c
archive: define MAX_ARGS where it's needed
archive: declare struct archiver where it's needed
archive: allow --exec and --remote without equal sign
SZEDER Gábor (2):
checkout: mention '--' in the docs
bash: offer only paths after '--' for 'git checkout'
Stephan Beyer (7):
git-am: Add colon before the subject that is printed out as being applied
am --abort: Add to bash-completion and mention in git-rerere
documentation
Make non-static functions, that may be static, static
Move launch_editor() from builtin-tag.c to editor.c
editor.c: Libify launch_editor()
git-am: Mention --abort in usage string part of OPTIONS_SPEC
git-reset: Let -q hush "locally modified" messages
Steve Haslam (2):
Propagate -u/--upload-pack option of "git clone" to transport.
Remove references to git-fetch-pack from "git clone" documentation.
Thomas Rast (1):
git-completion.bash: provide completion for 'show-branch'
^ permalink raw reply
* Re: Official Git Homepage change? Re: git-scm.com
From: Sverre Rabbelier @ 2008-07-26 7:52 UTC (permalink / raw)
To: Scott Chacon; +Cc: Junio C Hamano, Petr Baudis, git
In-Reply-To: <d411cc4a0807260027t4b9c3b08x1f865ec75d976ef6@mail.gmail.com>
On Sat, Jul 26, 2008 at 09:27, Scott Chacon <schacon@gmail.com> wrote:
> Perhaps it would be useful to split the mailing list into core/contrib
> and support lists? I would be happy to help out answering questions -
> a lot of them come directly to me anyhow because of the gitcasts site
> and such.
>
> Scott "no_w_ top-posting" Chacon
There, fixed that for you.
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: git-scm.com
From: Jakub Narebski @ 2008-07-26 8:03 UTC (permalink / raw)
To: Scott Chacon; +Cc: git
In-Reply-To: <d411cc4a0807251035i7aed2ec9wef7e8f1b3ae4c585@mail.gmail.com>
"Scott Chacon" <schacon@gmail.com> writes:
> A followup on the post I did a few days ago about Git documentation.
> I forked Petr's git.or.cz site and put up a version that I think is a
> bit more accessible and newbie-friendly at git-scm.com. I had meant
> to discuss this with Petr before posting it to you all, but I
> published a blog post that got a bit more attention than I expected,
> and I didn't want you all to think I didn't care about your opinion,
> as some have already accused me of.
On thing I am curious about: how do you plan to have current version
of Git in the download / last version section? Petr Baudis uses
custom script, which search git mailing list for "[ANNOUNCE]" posts,
and automatically updates download / last version links.
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: git-scm.com
From: Junio C Hamano @ 2008-07-26 8:06 UTC (permalink / raw)
To: Patrick Aljord; +Cc: git list, Scott Chacon
In-Reply-To: <6b6419750807252249u3c244b3fo65d9e1ee6e8b0ced@mail.gmail.com>
"Patrick Aljord" <patcito@gmail.com> writes:
> How about linking to the project web page or the official blog where
> the move was announced when available? I think that's how it's done on
> the mercurial page. And it explains people why the switch was done
> rather then linking to a source repository they might not care about
> and the link to the project page might give a hint about the
> importance of the given project for those that might not know it (such
> as prototype, mootools or liftweb).
You have to work harder to do the real research to find such key
historical documents than just linking to the toplevel of the current
repository, but I think this is an excellent idea. And most likely many
projects that have migrated from elsewhere (not the ones from scratch that
did not migrate from any existing codebase) could volunteer relevant links
if asked politely enough ;-)
^ permalink raw reply
* Re: [PATCH 2/5] Add git-sequencer documentation
From: Jakub Narebski @ 2008-07-26 8:16 UTC (permalink / raw)
To: git
In-Reply-To: <1217049644-8874-3-git-send-email-s-beyer@gmx.net>
Stephan Beyer wrote:
> +All characters after a `#` character will be ignored until the end of a line.
Probably should be 'are comments and' somewhere...
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* fetch refspec foo/* matches foo*
From: Jeff King @ 2008-07-26 8:24 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Daniel Barkalow, git
In-Reply-To: <7v1w1hsmnc.fsf@gitster.siamese.dyndns.org>
On Fri, Jul 25, 2008 at 02:02:15PM -0700, Junio C Hamano wrote:
> BTW, has anybody taken a look at this one?
>
> Subject: BUG: fetch incorrect interpretation of globing patterns in refspecs
> Date: Thu, 24 Jul 2008 09:07:21 +0200
> Message-ID: <71295b5a0807240007k246973abj1897895d0d67bb6c@mail.gmail.com>
>
> If not, I think I probably need to take a look at this, reproducing and
> possibly fixing, before applying non-fix patches.
I have been meaning to look at it for days, so I finally took a peek. I
was able to reproduce the problem easily. I think it is (almost) as
simple as the patch below. In the refspec parsing, we already require
globs to come after '/', so this is the analagous check during match.
Unfortunately, this breaks t1020 (something about failing to clone HEAD
it looks like, so probably it is some boundary case for matching just
"*"). I don't have time to look further, and I will be out of touch
until probably Sunday evening, so hopefully somebody else can run with
it.
---
diff --git a/remote.c b/remote.c
index 0d6020b..3ae0431 100644
--- a/remote.c
+++ b/remote.c
@@ -1108,7 +1108,8 @@ static struct ref *get_expanded_map(const struct ref *remote_refs,
for (ref = remote_refs; ref; ref = ref->next) {
if (strchr(ref->name, '^'))
continue; /* a dereference item */
- if (!prefixcmp(ref->name, refspec->src)) {
+ if (!prefixcmp(ref->name, refspec->src)
+ && ref->name[remote_prefix_len] == '/') {
const char *match;
struct ref *cpy = copy_ref(ref);
match = ref->name + remote_prefix_len;
^ permalink raw reply related
* Re: [PATCH 2/5] Add git-sequencer documentation
From: Sverre Rabbelier @ 2008-07-26 8:26 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <g6emhb$p1a$1@ger.gmane.org>
On Sat, Jul 26, 2008 at 10:16, Jakub Narebski <jnareb@gmail.com> wrote:
> Stephan Beyer wrote:
>> +All characters after a `#` character will be ignored until the end of a line.
>
> Probably should be 'are comments and' somewhere...
s/ and$//
s/^/and /
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: fetch refspec foo/* matches foo*
From: Jeff King @ 2008-07-26 8:33 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <20080726082405.GA10104@sigill.intra.peff.net>
On Sat, Jul 26, 2008 at 04:24:05AM -0400, Jeff King wrote:
> > If not, I think I probably need to take a look at this, reproducing and
> > possibly fixing, before applying non-fix patches.
>
> I have been meaning to look at it for days, so I finally took a peek. I
> was able to reproduce the problem easily. I think it is (almost) as
> simple as the patch below. In the refspec parsing, we already require
> globs to come after '/', so this is the analagous check during match.
Also, while I have your attention, Junio, here is another bug fix
that should go into 1.6.0. I posted the patch as a "how about this" deep
in a thread and got no response (which means no complaints, right?).
-- >8 --
init: handle empty "template" parameter
If a user passes "--template=", then our template parameter
is blank. Unfortunately, copy_templates() assumes it has at
least one character, and does all sorts of bad things like
reading from template[-1] and then proceeding to link all of
'/' into the .git directory.
This patch just checks for that condition in copy_templates
and aborts. As a side effect, this means that --template=
now has the meaning "don't copy any templates."
---
I don't really care about the "side effect" behavior, but it seems
reasonable. The other obvious option is to simply die(). Certainly
either is better than the current bug.
builtin-init-db.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index 38b4fcb..baf0d09 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -117,6 +117,8 @@ static void copy_templates(const char *template_dir)
template_dir = getenv(TEMPLATE_DIR_ENVIRONMENT);
if (!template_dir)
template_dir = system_path(DEFAULT_GIT_TEMPLATE_DIR);
+ if (!template_dir[0])
+ return;
strcpy(template_path, template_dir);
template_len = strlen(template_path);
if (template_path[template_len-1] != '/') {
--
1.6.0.rc0.233.gb3fd2
^ permalink raw reply related
* [PATCH] Modify mingw_main() workaround to avoid link errors
From: Steffen Prohaska @ 2008-07-26 9:41 UTC (permalink / raw)
To: Johannes Sixt; +Cc: git, Junio C Hamano, Steffen Prohaska
With MinGW's
gcc.exe (GCC) 3.4.5 (mingw special)
GNU ld version 2.17.50 20060824
the old define caused link errors:
git.o: In function `main':
C:/msysgit/git/git.c:500: undefined reference to `mingw_main'
collect2: ld returned 1 exit status
The modified define works.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
compat/mingw.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/compat/mingw.h b/compat/mingw.h
index 290a9e6..a52e657 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -228,9 +228,10 @@ char **env_setenv(char **env, const char *name);
* A replacement of main() that ensures that argv[0] has a path
*/
-#define main(c,v) main(int argc, const char **argv) \
+#define main(c,v) dummy_decl_mingw_main(); \
+static int mingw_main(); \
+int main(int argc, const char **argv) \
{ \
- static int mingw_main(); \
argv[0] = xstrdup(_pgmptr); \
return mingw_main(argc, argv); \
} \
--
1.6.0.rc0.42.g186458
^ permalink raw reply related
* Re: [PATCH] bash completion: Add long options for 'git describe'
From: Thomas Rast @ 2008-07-26 10:25 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: SZEDER GGGbor, git, gitster
In-Reply-To: <20080725162028.GB21117@spearce.org>
[-- Attachment #1: Type: text/plain, Size: 653 bytes --]
Shawn O. Pearce wrote:
> SZEDER GGGbor <szeder@ira.uka.de> wrote:
> > > _git_describe ()
> > > {
> > > + __git_has_doubledash && return
> > This line is superfluous, because 'git describe' does not have any path
> > arguments.
>
> Yup. Aside from the two items described above (mising SOB line
> and the unnecessary double dash test) this patch looks fine.
I suppose you're right. It does (empirically) attempt to parse
anything following a -- as a revision argument, but similar commands
like cherry-pick don't handle the -- specially either.
I'll resend a fixed version.
- Thomas
--
Thomas Rast
trast@student.ethz.ch
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* [PATCH] bash completion: Add long options for 'git describe'
From: Thomas Rast @ 2008-07-26 10:26 UTC (permalink / raw)
To: git; +Cc: gitster, Shawn O. Pearce, SZEDER Gábor
In-Reply-To: <20080725162028.GB21117@spearce.org>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
contrib/completion/git-completion.bash | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3b04934..4ae8b36 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -665,6 +665,15 @@ _git_commit ()
_git_describe ()
{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "
+ --all --tags --contains --abbrev= --candidates=
+ --exact-match --debug --long --match --always
+ "
+ return
+ esac
__gitcomp "$(__git_refs)"
}
--
1.6.0.rc0.50.g6a66e
^ permalink raw reply related
* Re: Mailing lists, was Re: [RFC] Git User's Survey 2008
From: Jakub Narebski @ 2008-07-26 10:54 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Junio C Hamano, Johannes Schindelin, Marek Zawirski, git
In-Reply-To: <20080725221331.GE23202@spearce.org>
On Sat, 26 July 2008, Shawn O. Pearce wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
>>> Jakub Narebski <jnareb@gmail.com> wrote:
>>>
>>>> 27. Which of the following features do you use?
>>>> (zero or more: multiple choice)
>>>> - Integration with IDE/editor (Eclipse, Emacs, TextMate,...)
>>>> ...
>>>>
>>>> What question about egit/jgit would you like to have in the survey?
>>>
>>> I'm not certain what else I would want to ask that is egit/jgit
>>> specific.
>>
>> If you do not have any specific questions you would want to see answers
>> to, then my point was moot, which is fine.
>
> Actually I'd like the editor integration to be broken out (if
> it isn't already) so we can see which editors (and thus which
> integrations) are popular among users. I think it would help all
> of the integration authors, as well as make it clear to end-users
> where we have integration available/under development, in case they
> were not aware of it previously.
So you would like to see something like the following question in the
upcoming Git User's Survey?
xx. Which editors/IDEs/RADs do you use?
(zero or more; multiple choice with 'other')
- Emacs, Vim, Eclipse, KDevelop, Anjuta, TextMate, Notepad++,
Visual Studio, other
+ what choices should be in the list of editors and IDE;
or should perhaps this question be free-form?
--
Jakub Narebski
Poland
^ permalink raw reply
* [PATCH 2/3] builtin-branch: factor out merge_filter matching
From: Lars Hjemli @ 2008-07-26 10:27 UTC (permalink / raw)
To: git
In-Reply-To: <1217068045-3575-2-git-send-email-hjemli@gmail.com>
The logic for checking commits against merge_filter will be reused
when we recalculate the maxwidth of refnames.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
builtin-branch.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 675a9b1..bff74cf 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -294,6 +294,17 @@ static void fill_tracking_info(char *stat, const char *branch_name)
sprintf(stat, "[ahead %d, behind %d] ", ours, theirs);
}
+static int matches_merge_filter(struct commit *commit)
+{
+ int is_merged;
+
+ if (merge_filter == NO_FILTER)
+ return 1;
+
+ is_merged = !!(commit->object.flags & UNINTERESTING);
+ return (is_merged == (merge_filter == SHOW_MERGED));
+}
+
static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
int abbrev, int current)
{
@@ -301,11 +312,8 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
int color;
struct commit *commit = item->commit;
- if (merge_filter != NO_FILTER) {
- int is_merged = !!(item->commit->object.flags & UNINTERESTING);
- if (is_merged != (merge_filter == SHOW_MERGED))
- return;
- }
+ if (!matches_merge_filter(commit))
+ return;
switch (item->kind) {
case REF_LOCAL_BRANCH:
--
1.6.0.rc0.79.gb0320
^ permalink raw reply related
* [PATCH 0/3] builtin-branch --[no-]merged post-optimization fixes
From: Lars Hjemli @ 2008-07-26 10:27 UTC (permalink / raw)
To: git
The optimization of --[no-]merged added some code duplication and a
possible "bug" for -v output which this series tries to rectify.
Lars Hjemli (3):
builtin-branch: remove duplicated code
builtin-branch: factor out merge_filter matching
builtin-branch: fix -v for --[no-]merged
builtin-branch.c | 42 ++++++++++++++++++++++++++++++------------
1 files changed, 30 insertions(+), 12 deletions(-)
^ permalink raw reply
* [PATCH 3/3] builtin-branch: fix -v for --[no-]merged
From: Lars Hjemli @ 2008-07-26 10:27 UTC (permalink / raw)
To: git
In-Reply-To: <1217068045-3575-3-git-send-email-hjemli@gmail.com>
After the optimization to --[no-]merged logic, the calculation of the
width of the longest refname to be shown might become inaccurate (since
the matching against merge_filter is performed after adding refs to
ref_list). This patch forces a recalculation of maxwidth when it might
be needed.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
builtin-branch.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index bff74cf..fed6f5e 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -363,6 +363,19 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
}
}
+static int calc_maxwidth(struct ref_list *refs)
+{
+ int i, l, w = 0;
+ for (i = 0; i < refs->index; i++) {
+ if (!matches_merge_filter(refs->list[i].commit))
+ continue;
+ l = strlen(refs->list[i].name);
+ if (l > w)
+ w = l;
+ }
+ return w;
+}
+
static void print_ref_list(int kinds, int detached, int verbose, int abbrev, struct commit_list *with_commit)
{
int i;
@@ -383,6 +396,8 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev, str
(struct object *) filter, "");
ref_list.revs.limited = 1;
prepare_revision_walk(&ref_list.revs);
+ if (verbose)
+ ref_list.maxwidth = calc_maxwidth(&ref_list);
}
qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
--
1.6.0.rc0.79.gb0320
^ permalink raw reply related
* [PATCH 1/3] builtin-branch: remove duplicated code
From: Lars Hjemli @ 2008-07-26 10:27 UTC (permalink / raw)
To: git
In-Reply-To: <1217068045-3575-1-git-send-email-hjemli@gmail.com>
The previous optimization to --[no-]merged ended up with some duplicated
code which this patch removes.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
builtin-branch.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/builtin-branch.c b/builtin-branch.c
index 5db8ad8..675a9b1 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -214,7 +214,6 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
struct commit *commit;
int kind;
int len;
- static struct commit_list branch;
/* Detect kind */
if (!prefixcmp(refname, "refs/heads/")) {
@@ -238,13 +237,9 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
if ((kind & ref_list->kinds) == 0)
return 0;
- if (merge_filter != NO_FILTER) {
- branch.item = lookup_commit_reference_gently(sha1, 1);
- if (!branch.item)
- die("Unable to lookup tip of branch %s", refname);
+ if (merge_filter != NO_FILTER)
add_pending_object(&ref_list->revs,
- (struct object *)branch.item, refname);
- }
+ (struct object *)commit, refname);
/* Resize buffer */
if (ref_list->index >= ref_list->alloc) {
--
1.6.0.rc0.79.gb0320
^ permalink raw reply related
* [PATCH] t7601: extend the 'merge picks up the best result' test
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <7v7ibenx75.fsf@gitster.siamese.dyndns.org>
The test only checked if the best result picking code works if there are
multiple strategies set in the config. Add a similar one that tests if
the same true if the -s option of git merge was used multiple times.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Tue, Jul 22, 2008 at 01:24:14AM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Don't. pull.* has always been defined as "list of strategies", and -s
> has
> always been defined to take "a" strategy.
OK. Here is a testcase for the later. As far as I see the behaviour of
multiple -s was not checked till now.
t/t7601-merge-pull-config.sh | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh
index 6b9f638..55aa6b5 100755
--- a/t/t7601-merge-pull-config.sh
+++ b/t/t7601-merge-pull-config.sh
@@ -112,6 +112,21 @@ test_expect_success 'setup conflicted merge' '
# recusive is choosen.
test_expect_success 'merge picks up the best result' '
+ git config --unset-all pull.twohead &&
+ git reset --hard c5 &&
+ git merge -s resolve c6
+ resolve_count=$(conflict_count) &&
+ git reset --hard c5 &&
+ git merge -s recursive c6
+ recursive_count=$(conflict_count) &&
+ git reset --hard c5 &&
+ git merge -s recursive -s resolve c6
+ auto_count=$(conflict_count) &&
+ test $auto_count = $recursive_count &&
+ test $auto_count != $resolve_count
+'
+
+test_expect_success 'merge picks up the best result (from config)' '
git config pull.twohead "recursive resolve" &&
git reset --hard c5 &&
git merge -s resolve c6
--
1.5.6.4.433.g09651.dirty
^ permalink raw reply related
* [PATCH 2/7] builtin-help: change the current directory back in list_commands_in_dir()
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
That function used to do a chdir() without switching back to the
original directory. That was not a problem till this function was used
only inside builtin-help, but once other builtins use it as well, this
is a problem, for example when the object database path is relative.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
help.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/help.c b/help.c
index fb93df0..d71937e 100644
--- a/help.c
+++ b/help.c
@@ -425,7 +425,9 @@ static unsigned int list_commands_in_dir(struct cmdnames *cmds,
int prefix_len;
DIR *dir = opendir(path);
struct dirent *de;
+ static char old_path[PATH_MAX+1];
+ getcwd(old_path, sizeof(old_path));
if (!dir || chdir(path))
return 0;
@@ -452,6 +454,7 @@ static unsigned int list_commands_in_dir(struct cmdnames *cmds,
}
closedir(dir);
+ chdir(old_path);
return longest;
}
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 3/7] builtin-help: make list_commands() a bit more generic
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
That function now takes two paramters to control the prefix of the
listed commands, and a second parameter to specify the title of the
table. This can be useful for listing not only all git commands, but
specific ones, like merge strategies.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
help.c | 10 +++++-----
help.h | 1 +
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/help.c b/help.c
index d71937e..f71fff4 100644
--- a/help.c
+++ b/help.c
@@ -501,13 +501,13 @@ static unsigned int load_command_list(const char *prefix)
return longest;
}
-static void list_commands(void)
+void list_commands(const char *prefix, const char *title)
{
- unsigned int longest = load_command_list(NULL);
+ unsigned int longest = load_command_list(prefix);
const char *exec_path = git_exec_path();
if (main_cmds.cnt) {
- printf("available git commands in '%s'\n", exec_path);
+ printf("available %s in '%s'\n", title, exec_path);
printf("----------------------------");
mput_char('-', strlen(exec_path));
putchar('\n');
@@ -516,7 +516,7 @@ static void list_commands(void)
}
if (other_cmds.cnt) {
- printf("git commands available from elsewhere on your $PATH\n");
+ printf("%s available from elsewhere on your $PATH\n", title);
printf("---------------------------------------------------\n");
pretty_print_string_list(&other_cmds, longest);
putchar('\n');
@@ -697,7 +697,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
if (show_all) {
printf("usage: %s\n\n", git_usage_string);
- list_commands();
+ list_commands("git-", "git commands");
printf("%s\n", git_more_info_string);
return 0;
}
diff --git a/help.h b/help.h
index 73da8d6..0741662 100644
--- a/help.h
+++ b/help.h
@@ -2,5 +2,6 @@
#define HELP_H
int is_git_command(const char *s, const char *prefix);
+void list_commands(const char *prefix, const char *title);
#endif /* HELP_H */
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 0/7] Allow custom merge strategies
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
Hi,
This series adds support for custom merge strategies.
The first 3 patches modify builtin-help to allow using it from other
builtins. This is necessary because in the error message of 'git merge
-s foobar' we show something like 'git help -a', but we list only merge
strategies. A command is considered a merge strategy if it has a
git-merge- prefix and is listed in the all_strategy array or it is
somewhere in PATH, but outside `git --exec-path`, so that git-merge-ours
and other strategies are shown, git-merge-index and other
git-merge-named (but not strategy) commands are hidden.
The last two is about removing those problematic 'git-merge-index',
'git-merge-tree' and other bogus commands from the output of 'git merge
-s foobar'. I think the benefit of doing it that way is that we don't
have to maintain a list of commands which are named git-merge-foo but
not strategies _and_ the custom strategies can have a form of
git-merge-foo, without adding extra complexity (like forcing users to
name them git-merge-custom-foo).
NOTE: At the moment the custom strategies are named as git-merge-foo as
well, mainly because I think it's not that problematic to exclude the
already existing git-merge-fo non-strategy commands, but this can be
changed to git-merge-strategy-foo if we really want so.
Also, I'm aware that this is a feature and we are in rc freeze, I just
did not want to keep back this series till 1.6.0 is out.
Miklos Vajna (7):
Make is_git_command() usable outside builtin-help
builtin-help: change the current directory back in
list_commands_in_dir()
builtin-help: make list_commands() a bit more generic
builtin-merge: allow using a custom strategy
Add a new test for using a custom merge strategy
builtin-help: make it possible to exclude some commands in
list_commands()
builtin-merge: avoid non-strategy git-merge commands in error message
Makefile | 1 +
builtin-merge.c | 30 +++++++++++++++++++++------
help.c | 50 ++++++++++++++++++++++++----------------------
help.h | 19 +++++++++++++++++
t/t7606-merge-custom.sh | 45 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 114 insertions(+), 31 deletions(-)
create mode 100644 help.h
create mode 100755 t/t7606-merge-custom.sh
^ permalink raw reply
* [PATCH 1/7] Make is_git_command() usable outside builtin-help
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
Other builtins may want to check if a given command is a valid git
command or not as well. Additionally add a new parameter that specifies
a custom prefix, so that the "git-" prefix is no longer hardwired.
Useful for example to limit the search for "git-merge-*".
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
Makefile | 1 +
help.c | 25 ++++++++++++++-----------
help.h | 6 ++++++
3 files changed, 21 insertions(+), 11 deletions(-)
create mode 100644 help.h
diff --git a/Makefile b/Makefile
index b01cf1c..85e79f6 100644
--- a/Makefile
+++ b/Makefile
@@ -346,6 +346,7 @@ LIB_H += git-compat-util.h
LIB_H += graph.h
LIB_H += grep.h
LIB_H += hash.h
+LIB_H += help.h
LIB_H += list-objects.h
LIB_H += ll-merge.h
LIB_H += log-tree.h
diff --git a/help.c b/help.c
index bfc84ae..fb93df0 100644
--- a/help.c
+++ b/help.c
@@ -418,17 +418,20 @@ static int is_executable(const char *name)
}
static unsigned int list_commands_in_dir(struct cmdnames *cmds,
- const char *path)
+ const char *path,
+ const char *prefix)
{
unsigned int longest = 0;
- const char *prefix = "git-";
- int prefix_len = strlen(prefix);
+ int prefix_len;
DIR *dir = opendir(path);
struct dirent *de;
if (!dir || chdir(path))
return 0;
+ if (!prefix)
+ prefix = "git-";
+ prefix_len = strlen(prefix);
while ((de = readdir(dir)) != NULL) {
int entlen;
@@ -452,7 +455,7 @@ static unsigned int list_commands_in_dir(struct cmdnames *cmds,
return longest;
}
-static unsigned int load_command_list(void)
+static unsigned int load_command_list(const char *prefix)
{
unsigned int longest = 0;
unsigned int len;
@@ -461,7 +464,7 @@ static unsigned int load_command_list(void)
const char *exec_path = git_exec_path();
if (exec_path)
- longest = list_commands_in_dir(&main_cmds, exec_path);
+ longest = list_commands_in_dir(&main_cmds, exec_path, prefix);
if (!env_path) {
fprintf(stderr, "PATH not set\n");
@@ -473,7 +476,7 @@ static unsigned int load_command_list(void)
if ((colon = strchr(path, PATH_SEP)))
*colon = 0;
- len = list_commands_in_dir(&other_cmds, path);
+ len = list_commands_in_dir(&other_cmds, path, prefix);
if (len > longest)
longest = len;
@@ -497,7 +500,7 @@ static unsigned int load_command_list(void)
static void list_commands(void)
{
- unsigned int longest = load_command_list();
+ unsigned int longest = load_command_list(NULL);
const char *exec_path = git_exec_path();
if (main_cmds.cnt) {
@@ -543,9 +546,9 @@ static int is_in_cmdlist(struct cmdnames *c, const char *s)
return 0;
}
-static int is_git_command(const char *s)
+int is_git_command(const char *s, const char *prefix)
{
- load_command_list();
+ load_command_list(prefix);
return is_in_cmdlist(&main_cmds, s) ||
is_in_cmdlist(&other_cmds, s);
}
@@ -566,7 +569,7 @@ static const char *cmd_to_page(const char *git_cmd)
return "git";
else if (!prefixcmp(git_cmd, "git"))
return git_cmd;
- else if (is_git_command(git_cmd))
+ else if (is_git_command(git_cmd, NULL))
return prepend("git-", git_cmd);
else
return prepend("git", git_cmd);
@@ -704,7 +707,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
}
alias = alias_lookup(argv[0]);
- if (alias && !is_git_command(argv[0])) {
+ if (alias && !is_git_command(argv[0], NULL)) {
printf("`git %s' is aliased to `%s'\n", argv[0], alias);
return 0;
}
diff --git a/help.h b/help.h
new file mode 100644
index 0000000..73da8d6
--- /dev/null
+++ b/help.h
@@ -0,0 +1,6 @@
+#ifndef HELP_H
+#define HELP_H
+
+int is_git_command(const char *s, const char *prefix);
+
+#endif /* HELP_H */
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 6/7] builtin-help: make it possible to exclude some commands in list_commands()
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
The supposed method is to build a list of commands to be excluded using
add_cmdname(), then pass the list as the new exclude parameter. If no
exclude is needed, NULL should be used.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
help.c | 24 ++++++++++--------------
help.h | 14 +++++++++++++-
2 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/help.c b/help.c
index f71fff4..de1be6d 100644
--- a/help.c
+++ b/help.c
@@ -9,6 +9,7 @@
#include "common-cmds.h"
#include "parse-options.h"
#include "run-command.h"
+#include "help.h"
static struct man_viewer_list {
struct man_viewer_list *next;
@@ -300,16 +301,9 @@ static inline void mput_char(char c, unsigned int num)
putchar(c);
}
-static struct cmdnames {
- int alloc;
- int cnt;
- struct cmdname {
- size_t len;
- char name[1];
- } **names;
-} main_cmds, other_cmds;
+struct cmdnames main_cmds, other_cmds;
-static void add_cmdname(struct cmdnames *cmds, const char *name, int len)
+void add_cmdname(struct cmdnames *cmds, const char *name, int len)
{
struct cmdname *ent = xmalloc(sizeof(*ent) + len);
@@ -458,7 +452,7 @@ static unsigned int list_commands_in_dir(struct cmdnames *cmds,
return longest;
}
-static unsigned int load_command_list(const char *prefix)
+static unsigned int load_command_list(const char *prefix, struct cmdnames *exclude)
{
unsigned int longest = 0;
unsigned int len;
@@ -497,13 +491,15 @@ static unsigned int load_command_list(const char *prefix)
sizeof(*other_cmds.names), cmdname_compare);
uniq(&other_cmds);
exclude_cmds(&other_cmds, &main_cmds);
+ if (exclude)
+ exclude_cmds(&main_cmds, exclude);
return longest;
}
-void list_commands(const char *prefix, const char *title)
+void list_commands(const char *prefix, const char *title, struct cmdnames *exclude)
{
- unsigned int longest = load_command_list(prefix);
+ unsigned int longest = load_command_list(prefix, exclude);
const char *exec_path = git_exec_path();
if (main_cmds.cnt) {
@@ -551,7 +547,7 @@ static int is_in_cmdlist(struct cmdnames *c, const char *s)
int is_git_command(const char *s, const char *prefix)
{
- load_command_list(prefix);
+ load_command_list(prefix, NULL);
return is_in_cmdlist(&main_cmds, s) ||
is_in_cmdlist(&other_cmds, s);
}
@@ -697,7 +693,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
if (show_all) {
printf("usage: %s\n\n", git_usage_string);
- list_commands("git-", "git commands");
+ list_commands("git-", "git commands", NULL);
printf("%s\n", git_more_info_string);
return 0;
}
diff --git a/help.h b/help.h
index 0741662..85d3b74 100644
--- a/help.h
+++ b/help.h
@@ -1,7 +1,19 @@
#ifndef HELP_H
#define HELP_H
+struct cmdnames {
+ int alloc;
+ int cnt;
+ struct cmdname {
+ size_t len;
+ char name[1];
+ } **names;
+};
+
int is_git_command(const char *s, const char *prefix);
-void list_commands(const char *prefix, const char *title);
+void list_commands(const char *prefix, const char *title, struct cmdnames *exclude);
+void add_cmdname(struct cmdnames *cmds, const char *name, int len);
+
+extern struct cmdnames main_cmds, other_cmds;
#endif /* HELP_H */
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 7/7] builtin-merge: avoid non-strategy git-merge commands in error message
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
If an invalid strategy is supplied, like -s foobar, then git-merge
listed all git-merge-* commands. This is not perfect, since for example
git-merge-index is not a valid strategy.
These are now removed from the output by scanning the list of main
commands; if the git-merge-foo command is listed in the all_strategy
list, then it's shown, otherwise excluded. This does not exclude
commands somewhere else in the PATH, where custom strategies are
expected.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
builtin-merge.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index cdbc692..4084e07 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -88,8 +88,19 @@ static struct strategy *get_strategy(const char *name)
return &all_strategy[i];
if (!is_git_command(name, "git-merge-")) {
+ struct cmdnames not_strategies;
+
+ memset(¬_strategies, 0, sizeof(struct cmdnames));
+ for (i = 0; i < main_cmds.cnt; i++) {
+ int j, found = 0;
+ for (j = 0; j < ARRAY_SIZE(all_strategy); j++)
+ if (!strcmp(main_cmds.names[i]->name, all_strategy[j].name))
+ found = 1;
+ if (!found)
+ add_cmdname(¬_strategies, main_cmds.names[i]->name, strlen(main_cmds.names[i]->name));
+ }
fprintf(stderr, "Could not find merge strategy '%s'.\n\n", name);
- list_commands("git-merge-", "strategies");
+ list_commands("git-merge-", "strategies", ¬_strategies);
exit(1);
}
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 5/7] Add a new test for using a custom merge strategy
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
Testing is done by creating a simple git-merge-theirs strategy which is
the opposite of ours. Using this in real merges is not recommended but
it's perfect for our testing needs.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
t/t7606-merge-custom.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
create mode 100755 t/t7606-merge-custom.sh
diff --git a/t/t7606-merge-custom.sh b/t/t7606-merge-custom.sh
new file mode 100755
index 0000000..f295e56
--- /dev/null
+++ b/t/t7606-merge-custom.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+test_description='git-merge
+
+Testing a custom strategy.'
+
+. ./test-lib.sh
+
+cat > git-merge-theirs << EOF
+#!/bin/sh
+eval git read-tree --reset -u \\\$\$#
+EOF
+chmod +x git-merge-theirs
+PATH=.:$PATH
+export PATH
+
+test_expect_success 'setup' '
+ echo c0 > c0.c &&
+ git add c0.c &&
+ git commit -m c0 &&
+ git tag c0 &&
+ echo c1 > c1.c &&
+ git add c1.c &&
+ git commit -m c1 &&
+ git tag c1 &&
+ git reset --hard c0 &&
+ echo c2 > c2.c &&
+ git add c2.c &&
+ git commit -m c2 &&
+ git tag c2
+'
+
+test_expect_success 'merge c2 with a custom strategy' '
+ git reset --hard c1 &&
+ git merge -s theirs c2 &&
+ test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
+ test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
+ test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
+ git diff --exit-code &&
+ test -f c0.c &&
+ test ! -f c1.c &&
+ test -f c2.c
+'
+
+test_done
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
* [PATCH 4/7] builtin-merge: allow using a custom strategy
From: Miklos Vajna @ 2008-07-26 11:54 UTC (permalink / raw)
To: git
In-Reply-To: <cover.1217037178.git.vmiklos@frugalware.org>
Allow using a custom strategy, as long as it's named git-merge-foo. The
error handling is now done using is_git_command(). The list of available
strategies is now shown by list_commands().
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
builtin-merge.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/builtin-merge.c b/builtin-merge.c
index e78fa18..cdbc692 100644
--- a/builtin-merge.c
+++ b/builtin-merge.c
@@ -22,6 +22,7 @@
#include "log-tree.h"
#include "color.h"
#include "rerere.h"
+#include "help.h"
#define DEFAULT_TWOHEAD (1<<0)
#define DEFAULT_OCTOPUS (1<<1)
@@ -77,7 +78,7 @@ static int option_parse_message(const struct option *opt,
static struct strategy *get_strategy(const char *name)
{
int i;
- struct strbuf err;
+ struct strategy *ret;
if (!name)
return NULL;
@@ -86,12 +87,16 @@ static struct strategy *get_strategy(const char *name)
if (!strcmp(name, all_strategy[i].name))
return &all_strategy[i];
- strbuf_init(&err, 0);
- for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
- strbuf_addf(&err, " %s", all_strategy[i].name);
- fprintf(stderr, "Could not find merge strategy '%s'.\n", name);
- fprintf(stderr, "Available strategies are:%s.\n", err.buf);
- exit(1);
+ if (!is_git_command(name, "git-merge-")) {
+ fprintf(stderr, "Could not find merge strategy '%s'.\n\n", name);
+ list_commands("git-merge-", "strategies");
+ exit(1);
+ }
+
+ ret = xmalloc(sizeof(struct strategy));
+ memset(ret, 0, sizeof(struct strategy));
+ ret->name = xstrdup(name);
+ return ret;
}
static void append_strategy(struct strategy *s)
--
1.6.0.rc0.14.g95f8.dirty
^ permalink raw reply related
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