* Re: git-svn dcommit fail
From: Steven Grimm @ 2007-07-05 7:11 UTC (permalink / raw)
To: Dongsheng Song; +Cc: Git Mailing List
In-Reply-To: <4b3406f0707040256x31f0909cie126d950c60374f1@mail.gmail.com>
Dongsheng Song wrote:
> After some merge operation,
git-svn doesn't support nonlinear history in any of the official
releases, though there will be some support in the next release (you can
try it out by grabbing the latest version from git.git's master branch).
If you don't want to run a prerelease version of git, you need to avoid
doing non-squash merges into branches that you are going to check into
an svn repository.
Squash merges (git merge --squash) work fine, though. They will be
recorded in your history as a regular commit, not a merge, so git-svn
won't be confused by them.
-Steve
^ permalink raw reply
* Re: Embedded Linux development with GIT
From: Johannes Sixt @ 2007-07-05 7:10 UTC (permalink / raw)
To: git
In-Reply-To: <a2e879e50707042250w22fe570cp4dda316e6b0f4cea@mail.gmail.com>
Sean Kelley wrote:
>
> Hi,
>
> I have a situation where we have a local GIT repository that is based
> on v2.6.17. We initially added the source tarball to an empty
> repository and then started applying changes to it. Looking back,
> that might not have been the best idea 400 commits later.
>
> My goal is to eventually bring our repository closer to mainline
> revisions so as to make it easier to actually contribute back to the
> community. So how can I fix my repository so as to give it visibility
> to Linus' kernel?
>
> Here is my initial thoughts:
>
> 1) Clone kernel.org kernel and it is Master
> 2) Create a local Head based on 2.6.17 and call it Local
> 3) Pull my existing heavily patched repository into the Local branch and merge
>
> Is it possible then to see our 400 odd commits then in the Local
> branch on top of 2.6.17 so that we can see not only our history but
> also the history that came before? Then as Master advances we can see
> about backporting and bringing our code close enough to mainline
> kernel to actually be able to contribute back to the community and
> submit patches. Is this realistic approach. I am unsure of the GIT
> commands that I need to do this?
That is possible using a graft:
$ echo "$x $(git rev-parse v2.6.17^0)" >> .git/info/grafts
where $x is the SHA1 of the first commit you made on top of the imported
tarball. This way you have spliced your history with Linus's history.
(This is a strictly _local_ matter! Every clone of your history must
repeat the game!)
Now, Linus will not be able to pull from your faked history because he
doesn't know about the graft. In order to fix that, you can run
git-filter-branch from current git's master branch to rewrite your
history:
$ git filter-branch new-master v2.6.17..master
Read the man page of git-filter-branch, and understand the implications
before you publish the result.
-- Hannes
^ permalink raw reply
* Re: Embedded Linux development with GIT
From: Alex Riesen @ 2007-07-05 6:53 UTC (permalink / raw)
To: Sean Kelley; +Cc: git
In-Reply-To: <a2e879e50707042250w22fe570cp4dda316e6b0f4cea@mail.gmail.com>
On 7/5/07, Sean Kelley <svk.sweng@gmail.com> wrote:
> 1) Clone kernel.org kernel and it is Master
> 2) Create a local Head based on 2.6.17 and call it Local
> 3) Pull my existing heavily patched repository into the Local branch and merge
Better:
$ (cd $OLDREPO && git format-patch --stdout -k first..) | git am -k
or, if it is in the same repo, assuming it starts with sha1 "old-beginning"
$ git format-patch --stdout -k old-beginning.. | git am -k
Merging of unrelated histories is slow (but works).
> Is it possible then to see our 400 odd commits then in the Local
> branch on top of 2.6.17 so that we can see not only our history but
> also the history that came before? Then as Master advances we can see
> about backporting and bringing our code close enough to mainline
> kernel to actually be able to contribute back to the community and
> submit patches. Is this realistic approach.
Yes. Look at how OLPC (www.laptop.org) does this with their kernel.
> I am unsure of the GIT
> commands that I need to do this?
aside from the already mentioned git format-patch and git am:
git apply, git log, git show, gitk, and come to think of it - all of the
rest too, except maybe for importing programs.
^ permalink raw reply
* Re: Embedded Linux development with GIT
From: Dan Chokola @ 2007-07-05 6:06 UTC (permalink / raw)
To: Sean Kelley; +Cc: git
In-Reply-To: <a2e879e50707042250w22fe570cp4dda316e6b0f4cea@mail.gmail.com>
On 7/5/07, Sean Kelley <svk.sweng@gmail.com> wrote:
> Hi,
>
> I have a situation where we have a local GIT repository that is based
> on v2.6.17. We initially added the source tarball to an empty
> repository and then started applying changes to it. Looking back,
> that might not have been the best idea 400 commits later.
>
> My goal is to eventually bring our repository closer to mainline
> revisions so as to make it easier to actually contribute back to the
> community. So how can I fix my repository so as to give it visibility
> to Linus' kernel?
>
> Here is my initial thoughts:
>
> 1) Clone kernel.org kernel and it is Master
> 2) Create a local Head based on 2.6.17 and call it Local
> 3) Pull my existing heavily patched repository into the Local branch and merge
>
> Is it possible then to see our 400 odd commits then in the Local
> branch on top of 2.6.17 so that we can see not only our history but
> also the history that came before? Then as Master advances we can see
> about backporting and bringing our code close enough to mainline
> kernel to actually be able to contribute back to the community and
> submit patches. Is this realistic approach. I am unsure of the GIT
> commands that I need to do this?
>
> Thanks,
>
> Sean
If I understand correctly, what you might want to do is keep your
current master branch, pull in the mainline kernel to a separate
branch, and rebase your master on the mainline branch.
git checkout master
git rebase mainline
will find the last common commit between two branches, then plop all
the mainline commits on top, then proceed to merge in your changes on
the master branch, one-by-one, stopping if there are any conflicts and
allowing you to resolve as they happen. Then your 400 commits will be
on top and you can rebase whenever and still see them on top.
-Dan "Puzzles" Chokola
^ permalink raw reply
* Embedded Linux development with GIT
From: Sean Kelley @ 2007-07-05 5:50 UTC (permalink / raw)
To: git
Hi,
I have a situation where we have a local GIT repository that is based
on v2.6.17. We initially added the source tarball to an empty
repository and then started applying changes to it. Looking back,
that might not have been the best idea 400 commits later.
My goal is to eventually bring our repository closer to mainline
revisions so as to make it easier to actually contribute back to the
community. So how can I fix my repository so as to give it visibility
to Linus' kernel?
Here is my initial thoughts:
1) Clone kernel.org kernel and it is Master
2) Create a local Head based on 2.6.17 and call it Local
3) Pull my existing heavily patched repository into the Local branch and merge
Is it possible then to see our 400 odd commits then in the Local
branch on top of 2.6.17 so that we can see not only our history but
also the history that came before? Then as Master advances we can see
about backporting and bringing our code close enough to mainline
kernel to actually be able to contribute back to the community and
submit patches. Is this realistic approach. I am unsure of the GIT
commands that I need to do this?
Thanks,
Sean
^ permalink raw reply
* Re: [PATCH] stash: end commit log with a newline
From: Junio C Hamano @ 2007-07-05 5:46 UTC (permalink / raw)
To: しらいしななこ
Cc: Uwe Kleine-König, Git Mailing List
In-Reply-To: <200707042324.l64NOp8I019289@mi0.bluebottle.com>
しらいしななこ <nanako3@bluebottle.com> writes:
> I am sorry to join the discussion late, but I think it is much better to let
> the user give a short reminder message from the command line. For example,
>
> $ git stash add customized message to stash
>
> When I say "git stash list", I want to see which branch I was on when I was
> in the middle of doing something, and what that something was. It is not
> interesting which commit on that branch I started that change from. After
> creating a stash without a message, and then another stash with a message, I
> want to see:
>
> $ git stash list
> stash@{0}: On master: add customized message to stash
> stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command"
Hmph. I only recently got interested in "stash", so have not
enough real-life experience to base my judgement on, but I think
I'd agree with your reasoning.
Perhaps something like this?
-- >8 --
[PATCH] git-stash: allow more descriptive reminder message when saving
This allows you to say:
$ git stash starting to implement X
while creating a stash, and the resulting "stash list entry
would read as:
$ git stash list
stash@{0}: On master: starting to implement X
instead of the default message which talks about the commit the
stash happens to be based on (hence does not have much to do
with what the stashed change is trying to do).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
git-stash.sh | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 9deda44..3d7db4a 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -23,6 +23,8 @@ clear_stash () {
}
save_stash () {
+ stash_msg="$1"
+
if no_changes
then
echo >&2 'No local changes to save'
@@ -67,13 +69,19 @@ save_stash () {
die "Cannot save the current worktree state"
# create the stash
- w_commit=$(printf 'WIP on %s\n' "$msg" |
+ if test -z "$stash_msg"
+ then
+ stash_msg=$(printf 'WIP on %s' "$msg")
+ else
+ stash_msg=$(printf 'On %s: %s' "$branch" "$stash_msg")
+ fi
+ w_commit=$(printf '%s\n' "$stash_msg" |
git commit-tree $w_tree -p $b_commit -p $i_commit) ||
die "Cannot record working tree state"
- git update-ref -m "$msg" $ref_stash $w_commit ||
+ git update-ref -m "$stash_msg" $ref_stash $w_commit ||
die "Cannot save the current status"
- printf >&2 'Saved WIP on %s\n' "$msg"
+ printf >&2 'Saved "%s"\n' "$stash_msg"
}
have_stash () {
@@ -157,9 +165,14 @@ apply)
clear)
clear_stash
;;
-save | '')
- save_stash && git-reset --hard
+help)
+ usage
;;
*)
- usage
+ if test $# -gt 0 && test "$1" = save
+ then
+ shift
+ fi
+ save_stash "$*" && git-reset --hard
+ ;;
esac
--
Junio C Hamano
http://gitster.livejournal.com/
----------------------------------------------------------------------
No advertising message here ;-)
http://www.ohloh.net/projects/278
^ permalink raw reply related
* [PATCH 2/2] WIP per-path attribute based hunk header selection.
From: Junio C Hamano @ 2007-07-05 5:02 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git
In-Reply-To: <7vwsxfe96i.fsf@assigned-by-dhcp.cox.net>
This makes"diff -p" hunk headers customizable via gitattributes mechanism.
It is based on Johannes's earlier patch that allowed to define a single
regexp to be used for everything.
The mechanism to arrive at the regexp that is used to define hunk header
is the same as other use of gitattributes. You assign an attribute, funcname
(because "diff -p" typically uses the name of the function the patch is about
as the hunk header), a simple string value. This can be one of the names of
built-in pattern (currently, "java" is defined) or a custom pattern name, to
be looked up from the configuration file.
(in .gitattributes)
*.java funcname=java
*.perl funcname=perl
(in .git/config)
[funcname]
java = ... # ugly and complicated regexp to override the built-in one.
perl = ... # another ugly and complicated regexp to define a new one.
This is still a WIP in that the code to look-up the configuration is not there
yet.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
diff.c | 121 +++++++++++++++++++++++++++++++++-------------
diffcore-delta.c | 2 +-
diffcore.h | 3 +
t/t4018-diff-funcname.sh | 63 ++++++++++++++++++++++++
xdiff-interface.c | 71 +++++++++++++++++++++++++++
xdiff-interface.h | 2 +
xdiff/xdiff.h | 4 ++
xdiff/xemit.c | 37 +++++++++-----
8 files changed, 254 insertions(+), 49 deletions(-)
create mode 100644 t/t4018-diff-funcname.sh
diff --git a/diff.c b/diff.c
index 552f7c0..0c7d2c6 100644
--- a/diff.c
+++ b/diff.c
@@ -1101,31 +1101,91 @@ static void emit_binary_diff(mmfile_t *one, mmfile_t *two)
static void setup_diff_attr_check(struct git_attr_check *check)
{
static struct git_attr *attr_diff;
+ static struct git_attr *attr_diff_func_name;
- if (!attr_diff)
+ if (!attr_diff) {
attr_diff = git_attr("diff", 4);
- check->attr = attr_diff;
+ attr_diff_func_name = git_attr("funcname", 8);
+ }
+ check[0].attr = attr_diff;
+ check[1].attr = attr_diff_func_name;
}
-static int file_is_binary(struct diff_filespec *one)
+static void diff_filespec_check_attr(struct diff_filespec *one)
{
- struct git_attr_check attr_diff_check;
+ struct git_attr_check attr_diff_check[2];
- setup_diff_attr_check(&attr_diff_check);
- if (!git_checkattr(one->path, 1, &attr_diff_check)) {
- const char *value = attr_diff_check.value;
+ if (one->checked_attr)
+ return;
+
+ setup_diff_attr_check(attr_diff_check);
+ one->is_binary = 0;
+ one->hunk_header_ident = NULL;
+
+ if (!git_checkattr(one->path, ARRAY_SIZE(attr_diff_check), attr_diff_check)) {
+ const char *value;
+
+ /* binaryness */
+ value = attr_diff_check[0].value;
if (ATTR_TRUE(value))
- return 0;
+ ;
else if (ATTR_FALSE(value))
- return 1;
+ one->is_binary = 1;
+
+ /* hunk header ident */
+ value = attr_diff_check[1].value;
+ if (ATTR_TRUE(value) || ATTR_FALSE(value) || ATTR_UNSET(value))
+ ;
+ else
+ one->hunk_header_ident = value;
}
- if (!one->data) {
- if (!DIFF_FILE_VALID(one))
- return 0;
+ if (!one->data && DIFF_FILE_VALID(one))
diff_populate_filespec(one, 0);
+
+ if (one->data)
+ one->is_binary = buffer_is_binary(one->data, one->size);
+
+}
+
+int diff_filespec_is_binary(struct diff_filespec *one)
+{
+ diff_filespec_check_attr(one);
+ return one->is_binary;
+}
+
+static const char *diff_hunk_header_regexp(struct diff_filespec *one)
+{
+ const char *ident;
+
+ diff_filespec_check_attr(one);
+ ident = one->hunk_header_ident;
+
+ if (!ident) {
+ /*
+ * If the config file has "funcname.default" defined, return
+ * that regexp here, instead of NULL.
+ */
+ return NULL;
}
- return buffer_is_binary(one->data, one->size);
+
+ /*
+ * FIXME: look up custom "funcname.$ident" regexp from config,
+ * and return it here.
+ */
+
+
+ /*
+ * And define built-in fallback patterns here...
+ */
+ if (!strcmp(ident, "java"))
+ return "!^[ ]*\\(catch\\|do\\|for\\|if\\|instanceof\\|"
+ "new\\|return\\|switch\\|throw\\|while\\)\n"
+ "^[ ]*\\(\\([ ]*"
+ "[A-Za-z_][A-Za-z_0-9]*\\)\\{2,\\}"
+ "[ ]*([^;]*$\\)";
+
+ return NULL;
}
static void builtin_diff(const char *name_a,
@@ -1182,7 +1242,8 @@ static void builtin_diff(const char *name_a,
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
- if (!o->text && (file_is_binary(one) || file_is_binary(two))) {
+ if (!o->text &&
+ (diff_filespec_is_binary(one) || diff_filespec_is_binary(two))) {
/* Quite common confusing case */
if (mf1.size == mf2.size &&
!memcmp(mf1.ptr, mf2.ptr, mf1.size))
@@ -1201,6 +1262,11 @@ static void builtin_diff(const char *name_a,
xdemitconf_t xecfg;
xdemitcb_t ecb;
struct emit_callback ecbdata;
+ const char *hunk_header_regexp;
+
+ hunk_header_regexp = diff_hunk_header_regexp(one);
+ if (!hunk_header_regexp)
+ hunk_header_regexp = diff_hunk_header_regexp(two);
memset(&xecfg, 0, sizeof(xecfg));
memset(&ecbdata, 0, sizeof(ecbdata));
@@ -1210,6 +1276,8 @@ static void builtin_diff(const char *name_a,
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
xecfg.ctxlen = o->context;
xecfg.flags = XDL_EMIT_FUNCNAMES;
+ if (hunk_header_regexp)
+ xdiff_set_find_func(&xecfg, hunk_header_regexp);
if (!diffopts)
;
else if (!prefixcmp(diffopts, "--unified="))
@@ -1261,7 +1329,7 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
- if (file_is_binary(one) || file_is_binary(two)) {
+ if (diff_filespec_is_binary(one) || diff_filespec_is_binary(two)) {
data->is_binary = 1;
data->added = mf2.size;
data->deleted = mf1.size;
@@ -1302,7 +1370,7 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
if (fill_mmfile(&mf1, one) < 0 || fill_mmfile(&mf2, two) < 0)
die("unable to read files to diff");
- if (file_is_binary(two))
+ if (diff_filespec_is_binary(two))
goto free_and_return;
else {
/* Crazy xdl interfaces.. */
@@ -1879,8 +1947,8 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o)
if (o->binary) {
mmfile_t mf;
- if ((!fill_mmfile(&mf, one) && file_is_binary(one)) ||
- (!fill_mmfile(&mf, two) && file_is_binary(two)))
+ if ((!fill_mmfile(&mf, one) && diff_filespec_is_binary(one)) ||
+ (!fill_mmfile(&mf, two) && diff_filespec_is_binary(two)))
abbrev = 40;
}
len += snprintf(msg + len, sizeof(msg) - len,
@@ -2783,7 +2851,7 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
return error("unable to read files to diff");
/* Maybe hash p->two? into the patch id? */
- if (file_is_binary(p->two))
+ if (diff_filespec_is_binary(p->two))
continue;
len1 = remove_space(p->one->path, strlen(p->one->path));
@@ -3011,21 +3079,6 @@ void diffcore_std(struct diff_options *options)
if (options->quiet)
return;
- /*
- * break/rename count similarity differently depending on
- * the binary-ness.
- */
- if ((options->break_opt != -1) || (options->detect_rename)) {
- struct diff_queue_struct *q = &diff_queued_diff;
- int i;
-
- for (i = 0; i < q->nr; i++) {
- struct diff_filepair *p = q->queue[i];
- p->one->is_binary = file_is_binary(p->one);
- p->two->is_binary = file_is_binary(p->two);
- }
- }
-
if (options->break_opt != -1)
diffcore_break(options->break_opt);
if (options->detect_rename)
diff --git a/diffcore-delta.c b/diffcore-delta.c
index a038b16..d9729e5 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -129,7 +129,7 @@ static struct spanhash_top *hash_chars(struct diff_filespec *one)
struct spanhash_top *hash;
unsigned char *buf = one->data;
unsigned int sz = one->size;
- int is_text = !one->is_binary;
+ int is_text = !diff_filespec_is_binary(one);
i = INITIAL_HASH_SIZE;
hash = xmalloc(sizeof(*hash) + sizeof(struct spanhash) * (1<<i));
diff --git a/diffcore.h b/diffcore.h
index 0c8abb5..0598514 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -27,6 +27,7 @@ struct diff_filespec {
char *path;
void *data;
void *cnt_data;
+ const void *hunk_header_ident;
unsigned long size;
int xfrm_flags; /* for use by the xfrm */
unsigned short mode; /* file mode */
@@ -37,6 +38,7 @@ struct diff_filespec {
#define DIFF_FILE_VALID(spec) (((spec)->mode) != 0)
unsigned should_free : 1; /* data should be free()'ed */
unsigned should_munmap : 1; /* data should be munmap()'ed */
+ unsigned checked_attr : 1;
unsigned is_binary : 1; /* data should be considered "binary" */
};
@@ -46,6 +48,7 @@ extern void fill_filespec(struct diff_filespec *, const unsigned char *,
extern int diff_populate_filespec(struct diff_filespec *, int);
extern void diff_free_filespec_data(struct diff_filespec *);
+extern int diff_filespec_is_binary(struct diff_filespec *);
struct diff_filepair {
struct diff_filespec *one;
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
new file mode 100644
index 0000000..0689b2f
--- /dev/null
+++ b/t/t4018-diff-funcname.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Johannes E. Schindelin
+#
+
+test_description='Test custom diff function name patterns'
+
+. ./test-lib.sh
+
+LF='
+'
+
+cat > Beer.java << EOF
+public class Beer
+{
+ int special;
+ public static void main(String args[])
+ {
+ String s=" ";
+ for(int x = 99; x > 0; x--)
+ {
+ System.out.print(x + " bottles of beer on the wall "
+ + x + " bottles of beer\n"
+ + "Take one down, pass it around, " + (x - 1)
+ + " bottles of beer on the wall.\n");
+ }
+ System.out.print("Go to the store, buy some more,\n"
+ + "99 bottles of beer on the wall.\n");
+ }
+}
+EOF
+
+sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
+
+test_expect_success 'default behaviour' '
+ git diff Beer.java Beer-correct.java |
+ grep "^@@.*@@ public class Beer"
+'
+
+test_expect_success 'preset java pattern' '
+ echo "*.java funcname=java" >.gitattributes &&
+ git diff Beer.java Beer-correct.java |
+ grep "^@@.*@@ public static void main("
+'
+
+test_done
+
+
+git config diff.functionnameregexp '!static
+!String
+[^ ].*s.*'
+
+test_expect_success 'custom pattern' '
+ git diff Beer.java Beer-correct.java |
+ grep "^@@.*@@ int special;$"
+'
+
+test_expect_success 'last regexp must not be negated' '
+ git config diff.functionnameregexp "!static" &&
+ ! git diff Beer.java Beer-correct.java
+'
+
+test_done
diff --git a/xdiff-interface.c b/xdiff-interface.c
index e407cf1..be866d1 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -129,3 +129,74 @@ int buffer_is_binary(const char *ptr, unsigned long size)
size = FIRST_FEW_BYTES;
return !!memchr(ptr, 0, size);
}
+
+struct ff_regs {
+ int nr;
+ struct ff_reg {
+ regex_t re;
+ int negate;
+ } *array;
+};
+
+static long ff_regexp(const char *line, long len,
+ char *buffer, long buffer_size, void *priv)
+{
+ char *line_buffer = xstrndup(line, len); /* make NUL terminated */
+ struct ff_regs *regs = priv;
+ regmatch_t pmatch[2];
+ int result = 0, i;
+
+ for (i = 0; i < regs->nr; i++) {
+ struct ff_reg *reg = regs->array + i;
+ if (reg->negate ^ !!regexec(®->re,
+ line_buffer, 2, pmatch, 0)) {
+ free(line_buffer);
+ return -1;
+ }
+ }
+ i = pmatch[1].rm_so >= 0 ? 1 : 0;
+ line += pmatch[i].rm_so;
+ result = pmatch[i].rm_eo - pmatch[i].rm_so;
+ if (result > buffer_size)
+ result = buffer_size;
+ else
+ while (result > 0 && (isspace(line[result - 1]) ||
+ line[result - 1] == '\n'))
+ result--;
+ memcpy(buffer, line, result);
+ free(line_buffer);
+ return result;
+}
+
+void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value)
+{
+ int i;
+ struct ff_regs *regs;
+
+ xecfg->find_func = ff_regexp;
+ regs = xecfg->find_func_priv = xmalloc(sizeof(struct ff_regs));
+ for (i = 0, regs->nr = 1; value[i]; i++)
+ if (value[i] == '\n')
+ regs->nr++;
+ regs->array = xmalloc(regs->nr * sizeof(struct ff_reg));
+ for (i = 0; i < regs->nr; i++) {
+ struct ff_reg *reg = regs->array + i;
+ const char *ep = strchr(value, '\n'), *expression;
+ char *buffer = NULL;
+
+ reg->negate = (*value == '!');
+ if (reg->negate && i == regs->nr - 1)
+ die("Last expression must not be negated: %s", value);
+ if (*value == '!')
+ value++;
+ if (ep)
+ expression = buffer = xstrndup(value, ep - value);
+ else
+ expression = value;
+ if (regcomp(®->re, expression, 0))
+ die("Invalid regexp to look for hunk header: %s", expression);
+ if (buffer)
+ free(buffer);
+ value = ep + 1;
+ }
+}
diff --git a/xdiff-interface.h b/xdiff-interface.h
index 536f4e4..fb742db 100644
--- a/xdiff-interface.h
+++ b/xdiff-interface.h
@@ -20,4 +20,6 @@ int parse_hunk_header(char *line, int len,
int read_mmfile(mmfile_t *ptr, const char *filename);
int buffer_is_binary(const char *ptr, unsigned long size);
+extern void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line);
+
#endif
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 9402bb0..c00ddaa 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -73,9 +73,13 @@ typedef struct s_xdemitcb {
int (*outf)(void *, mmbuffer_t *, int);
} xdemitcb_t;
+typedef long (*find_func_t)(const char *line, long line_len, char *buffer, long buffer_size, void *priv);
+
typedef struct s_xdemitconf {
long ctxlen;
unsigned long flags;
+ find_func_t find_func;
+ void *find_func_priv;
} xdemitconf_t;
typedef struct s_bdiffparam {
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 4b6e639..d3d9c84 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -69,7 +69,24 @@ static xdchange_t *xdl_get_hunk(xdchange_t *xscr, xdemitconf_t const *xecfg) {
}
-static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll) {
+static long def_ff(const char *rec, long len, char *buf, long sz, void *priv)
+{
+ if (len > 0 &&
+ (isalpha((unsigned char)*rec) || /* identifier? */
+ *rec == '_' || /* also identifier? */
+ *rec == '$')) { /* identifiers from VMS and other esoterico */
+ if (len > sz)
+ len = sz;
+ while (0 < len && isspace((unsigned char)rec[len - 1]))
+ len--;
+ memcpy(buf, rec, len);
+ return len;
+ }
+ return -1;
+}
+
+static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll,
+ find_func_t ff, void *ff_priv) {
/*
* Be quite stupid about this for now. Find a line in the old file
@@ -80,22 +97,12 @@ static void xdl_find_func(xdfile_t *xf, long i, char *buf, long sz, long *ll) {
const char *rec;
long len;
- *ll = 0;
while (i-- > 0) {
len = xdl_get_rec(xf, i, &rec);
- if (len > 0 &&
- (isalpha((unsigned char)*rec) || /* identifier? */
- *rec == '_' || /* also identifier? */
- *rec == '$')) { /* mysterious GNU diff's invention */
- if (len > sz)
- len = sz;
- while (0 < len && isspace((unsigned char)rec[len - 1]))
- len--;
- memcpy(buf, rec, len);
- *ll = len;
+ if ((*ll = ff(rec, len, buf, sz, ff_priv)) >= 0)
return;
- }
}
+ *ll = 0;
}
@@ -120,6 +127,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
xdchange_t *xch, *xche;
char funcbuf[80];
long funclen = 0;
+ find_func_t ff = xecfg->find_func ? xecfg->find_func : def_ff;
if (xecfg->flags & XDL_EMIT_COMMON)
return xdl_emit_common(xe, xscr, ecb, xecfg);
@@ -143,7 +151,8 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
if (xecfg->flags & XDL_EMIT_FUNCNAMES) {
xdl_find_func(&xe->xdf1, s1, funcbuf,
- sizeof(funcbuf), &funclen);
+ sizeof(funcbuf), &funclen,
+ ff, xecfg->find_func_priv);
}
if (xdl_emit_hunk_hdr(s1 + 1, e1 - s1, s2 + 1, e2 - s2,
funcbuf, funclen, ecb) < 0)
--
1.5.3.rc0.818.ga2b52
^ permalink raw reply related
* [PATCH 1/2] Future-proof source for changes in xdemitconf_t
From: Junio C Hamano @ 2007-07-05 5:02 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git
In-Reply-To: <7vwsxfe96i.fsf@assigned-by-dhcp.cox.net>
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: Wed, 4 Jul 2007 19:05:46 +0100
The instances of xdemitconf_t were initialized member by member.
Instead, initialize them to all zero, so we do not have
to update those places each time we introduce a new member.
[jc: minimally fixed by getting rid of a new global]
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-blame.c | 2 +-
builtin-rerere.c | 2 +-
combine-diff.c | 3 +--
diff.c | 10 +++++-----
merge-file.c | 1 +
merge-tree.c | 2 +-
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index da23a6f..0519339 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -518,8 +518,8 @@ static struct patch *compare_buffer(mmfile_t *file_p, mmfile_t *file_o,
xdemitcb_t ecb;
xpp.flags = xdl_opts;
+ memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = context;
- xecfg.flags = 0;
ecb.outf = xdiff_outf;
ecb.priv = &state;
memset(&state, 0, sizeof(state));
diff --git a/builtin-rerere.c b/builtin-rerere.c
index 29fb075..01f3848 100644
--- a/builtin-rerere.c
+++ b/builtin-rerere.c
@@ -282,8 +282,8 @@ static int diff_two(const char *file1, const char *label1,
printf("--- a/%s\n+++ b/%s\n", label1, label2);
fflush(stdout);
xpp.flags = XDF_NEED_MINIMAL;
+ memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
- xecfg.flags = 0;
ecb.outf = outf;
xdl_diff(&minus, &plus, &xpp, &xecfg, &ecb);
diff --git a/combine-diff.c b/combine-diff.c
index ea3ca5f..ef62234 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -215,8 +215,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
parent_file.ptr = grab_blob(parent, &sz);
parent_file.size = sz;
xpp.flags = XDF_NEED_MINIMAL;
- xecfg.ctxlen = 0;
- xecfg.flags = 0;
+ memset(&xecfg, 0, sizeof(xecfg));
ecb.outf = xdiff_outf;
ecb.priv = &state;
memset(&state, 0, sizeof(state));
diff --git a/diff.c b/diff.c
index 1958970..552f7c0 100644
--- a/diff.c
+++ b/diff.c
@@ -390,6 +390,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
mmfile_t minus, plus;
int i;
+ memset(&xecfg, 0, sizeof(xecfg));
minus.size = diff_words->minus.text.size;
minus.ptr = xmalloc(minus.size);
memcpy(minus.ptr, diff_words->minus.text.ptr, minus.size);
@@ -408,7 +409,6 @@ static void diff_words_show(struct diff_words_data *diff_words)
xpp.flags = XDF_NEED_MINIMAL;
xecfg.ctxlen = diff_words->minus.alloc + diff_words->plus.alloc;
- xecfg.flags = 0;
ecb.outf = xdiff_outf;
ecb.priv = diff_words;
diff_words->xm.consume = fn_out_diff_words_aux;
@@ -1202,6 +1202,7 @@ static void builtin_diff(const char *name_a,
xdemitcb_t ecb;
struct emit_callback ecbdata;
+ memset(&xecfg, 0, sizeof(xecfg));
memset(&ecbdata, 0, sizeof(ecbdata));
ecbdata.label_path = lbl;
ecbdata.color_diff = o->color_diff;
@@ -1270,9 +1271,8 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
xdemitconf_t xecfg;
xdemitcb_t ecb;
+ memset(&xecfg, 0, sizeof(xecfg));
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
- xecfg.ctxlen = 0;
- xecfg.flags = 0;
ecb.outf = xdiff_outf;
ecb.priv = diffstat;
xdl_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
@@ -1310,9 +1310,8 @@ static void builtin_checkdiff(const char *name_a, const char *name_b,
xdemitconf_t xecfg;
xdemitcb_t ecb;
+ memset(&xecfg, 0, sizeof(xecfg));
xpp.flags = XDF_NEED_MINIMAL;
- xecfg.ctxlen = 0;
- xecfg.flags = 0;
ecb.outf = xdiff_outf;
ecb.priv = &data;
xdl_diff(&mf1, &mf2, &xpp, &xecfg, &ecb);
@@ -2764,6 +2763,7 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1)
struct diff_filepair *p = q->queue[i];
int len1, len2;
+ memset(&xecfg, 0, sizeof(xecfg));
if (p->status == 0)
return error("internal diff status error");
if (p->status == DIFF_STATUS_UNKNOWN)
diff --git a/merge-file.c b/merge-file.c
index 748d15c..1e031ea 100644
--- a/merge-file.c
+++ b/merge-file.c
@@ -62,6 +62,7 @@ static int generate_common_file(mmfile_t *res, mmfile_t *f1, mmfile_t *f2)
xdemitcb_t ecb;
xpp.flags = XDF_NEED_MINIMAL;
+ memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
xecfg.flags = XDL_EMIT_COMMON;
ecb.outf = common_outf;
diff --git a/merge-tree.c b/merge-tree.c
index 3b8d9e6..7d4f628 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -106,8 +106,8 @@ static void show_diff(struct merge_list *entry)
xdemitcb_t ecb;
xpp.flags = XDF_NEED_MINIMAL;
+ memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
- xecfg.flags = 0;
ecb.outf = show_outf;
ecb.priv = NULL;
--
1.5.3.rc0.818.ga2b52
^ permalink raw reply related
* Re: [PATCH 2/2] diff: add custom regular expressions for function names
From: Junio C Hamano @ 2007-07-05 5:00 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git
In-Reply-To: <7vejjnhpap.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <gitster@pobox.com> writes:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
>> On Wed, 4 Jul 2007, Johannes Schindelin wrote:
>>>
>>> This patch introduces a config variable diff.functionNameRegexp
>>> which replaces the default heuristics. If the pattern contains
>>> a group, the match of this group is used for the hunk header
>>> instead of the whole match.
>>
>> Umm. Shouldn't it be a path-name based attribute instead?
>>
>> That way you can set it to be different things for different source files
>> in the same repository.. IOW, think mixed Java/C codebases.
>
> Absolutely. I'll take it from there.
I'll follow-up this message with two patches.
The first one is almost the same as Johannes's, but I got rid of
the new global variable. The second one discards Johannes's use
of a single config variable and replaces it with gitattribute
access.
The second one is still a WIP; currently you can mark the path
to use java convention to find hunk header with:
$ echo '*.java funcname=java' >.gitattributes
If there are useful "hunk header regexp" to make built-in, you
can add them to diff_hunk_header_regexp().
We also should allow user override or define custom regexp with
a configuration section, perhaps like:
[funcname]
java = ...
perl = ...
default = ...
There are enough existing code in diff and convert area that use
(path -> attribute -> config) mapping in a very similar way and
any git hacker wannabe should be able to mimick them to
implement such a support, but tonight's WIP does not have it.
*NOTE IN BIG RED LETTERS*
I do not particularly like the way multiple regexps are used in
Johannes's patch, but I left it as-is, as that part of the
change is orthogonal from the support to use the gitattribute
mechanism, and the primary reason I got involved in this topic
is to give help around the latter area.
I think using multiple regexp is cute, but if we do that, it
should allow people to pick from:
public class Beer
{
int special;
public static void main(String args[])
{
... modified part is here ...
with two regexp matches, say:
/^(public|private|protectd) class (.*)/ then
/^ +.* (\w*\(.*)$/
and define the hunk_header format as something like:
"\[1,2]::\[2,1]"
meaning, "pick the second capture group from the match data of
the first regexp, followed by double-colon, and pick the first
capture group from the match data of the second regexp", to
result in "Beer::main(String args[])". You should be able
to pick "/package (\w+);/ then /^sub (\w+)/" in Perl code using
the same idea.
I am not married to the syntax I used in the above examples,
though.
^ permalink raw reply
* [BUG] Documentation/git-stash.txt slight typo
From: Randal L. Schwartz @ 2007-07-05 4:09 UTC (permalink / raw)
To: git
But I don't know how to fix, since I don't know asciidoc.
For the diagram:
.----W
/ /
...--H----I
the last line disappears in the manpage. Must be something to do with
the leading dots.
--
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
* Re: gitk - error in git repo on cygwin
From: Mark Levedahl @ 2007-07-05 1:58 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Git Mailing List
In-Reply-To: <18060.12148.313090.53861@cargo.ozlabs.ibm.com>
Paul Mackerras wrote:
> I don't think anything like that has changed. I think it is probably
> due to the commits being batched up differently in getcommitlines.
> I'll look into it.
>
> Paul.
>
>
Indeed, it does seem to be something order dependent. I added some debug
printouts, and looking in proc "rowranges" when the error occurs (for
gitk f77a29e), I get:
$commitrow($curview,$id) = 8571
[lindex $rowrangelist $commitrow($curview,$id)] =
29504118f8528f658fd0bfc02d8d78d4c01dc2cc 8571
In all previous cases, the lindex expression evalutates to two sha1's.
So clearly, the order of processing is different. I did check that the
input (from git-rev-list) is identical across the linux and Cygwin
invocations. Shrug.
Mark
^ permalink raw reply
* [PATCH] git-send-email: allow an email alias for --from
From: Michael Hendricks @ 2007-07-05 1:11 UTC (permalink / raw)
To: git; +Cc: Michael Hendricks
Signed-off-by: Michael Hendricks <michael@ndrix.org>
---
I don't like seeing all the output and confirming the From address
when I don't specify --from. Since I have aliases for my own email
addresses, this is easier than always typing out the full address.
It also does what I would expect since every other email address can
be specified as an alias. Why not From also?
git-send-email.perl | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 87f59fa..89f7c36 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -254,6 +254,8 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
}
}
+($from) = expand_aliases($from) if defined $from;
+
my $prompting = 0;
if (!defined $from) {
$from = $author || $committer;
--
1.5.3.rc0.14.gebe8f
^ permalink raw reply related
* [PATCH] gitweb: configurable width for the projects list Description column
From: Michael Hendricks @ 2007-07-05 0:36 UTC (permalink / raw)
To: git; +Cc: Michael Hendricks
This allows gitweb users to set $projects_list_description_width
in their gitweb.conf to determine how many characters of a project
description are displayed before being truncated with an ellipsis.
Signed-off-by: Michael Hendricks <michael@ndrix.org>
---
gitweb/gitweb.perl | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index dbfb044..29d058c 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -71,6 +71,9 @@ our $logo_label = "git homepage";
# source of projects list
our $projects_list = "++GITWEB_LIST++";
+# the width (in characters) of the projects list "Description" column
+our $projects_list_description_width = 25;
+
# default order of projects list
# valid values are none, project, descr, owner, and age
our $default_projects_order = "project";
@@ -3163,7 +3166,7 @@ sub git_project_list_body {
if (!defined $pr->{'descr'}) {
my $descr = git_get_project_description($pr->{'path'}) || "";
$pr->{'descr_long'} = to_utf8($descr);
- $pr->{'descr'} = chop_str($descr, 25, 5);
+ $pr->{'descr'} = chop_str($descr, $projects_list_description_width, 5);
}
if (!defined $pr->{'owner'}) {
$pr->{'owner'} = get_file_owner("$projectroot/$pr->{'path'}") || "";
--
1.5.3.rc0.14.gebe8f
^ permalink raw reply related
* Re: gitk - error in git repo on cygwin
From: Paul Mackerras @ 2007-07-04 23:38 UTC (permalink / raw)
To: Mark Levedahl; +Cc: Git Mailing List
In-Reply-To: <468BA1B8.4010406@gmail.com>
Mark Levedahl writes:
> This doesn't happen on my Linux box, so this is most likely due to a tcl
> feature introduced more recently than the tcl used in Cygwin (8.4.1). My
> guess would be that the more recent tcl is more forgiving of an
> attempted access to a non-existent element.
I don't think anything like that has changed. I think it is probably
due to the commits being batched up differently in getcommitlines.
I'll look into it.
Paul.
^ permalink raw reply
* Re: [PATCH] stash: end commit log with a newline
From: しらいしななこ @ 2007-07-04 23:18 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Git Mailing List, Junio C Hamano
In-Reply-To: <20070704074444.GA5687@informatik.uni-freiburg.de>
Quoting Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>:
> Junio C Hamano wrote:
>> I noticed another thing. The entries shown in "git stash list"
>> look like this:
>>
>> stash@{0}: js/stash: e1d32c1... Teach git-stash to "apply --index"
>> stash@{1}: master: 5be6007... Rewrite "git-frotz" to "git frotz"
>> stash@{2}: master: 36e5e70... Start deprecating "git-command" in favor of "git command"
>> stash@{3}: master: 3b0d999... Merge branch 'jo/init'
>>
>> But each of the stash is _not_ about these commits, but is about
>> some change that happens to be on top of them.
>>
>> So risking to make it a tad longer, how about doing this on top?
>>
>> - git update-ref -m "$msg" $ref_stash $w_commit ||
>> + git update-ref -m "WIP on $msg" $ref_stash $w_commit ||
>
> I like that. I already wondered about that, too. But not as much as
> thinking about an alternative.
>
> So:
>
> Acked-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
I am sorry to join the discussion late, but I think it is much better to let
the user give a short reminder message from the command line. For example,
$ git stash add customized message to stash
When I say "git stash list", I want to see which branch I was on when I was
in the middle of doing something, and what that something was. It is not
interesting which commit on that branch I started that change from. After
creating a stash without a message, and then another stash with a message, I
want to see:
$ git stash list
stash@{0}: On master: add customized message to stash
stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command"
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
----------------------------------------------------------------------
Free pop3 email with a spam filter.
http://www.bluebottle.com/tag/5
^ permalink raw reply
* Re: $ git checkout and symlinks
From: Pierre Habouzit @ 2007-07-04 22:23 UTC (permalink / raw)
To: Junio C Hamano, git
In-Reply-To: <20070704210559.GB13286@artemis.corp>
[-- Attachment #1: Type: text/plain, Size: 1813 bytes --]
On Wed, Jul 04, 2007 at 11:05:59PM +0200, Pierre Habouzit wrote:
> On Wed, Jul 04, 2007 at 01:52:32PM -0700, Junio C Hamano wrote:
> > Pierre Habouzit <madcoder@debian.org> writes:
> >
> > > if in a branch $ you track the file: dir1/file1.c
> > > and in the branch $ you track elsewhere/file1.c and dir1 be
> > > symlink on elsewhere, then it's not possible to checkout the branch
> > > $. You have to manually
> > > remove the symlink `dir1` else git complains that checkouting branch1
> > > would overwrite dir1/file1.c.
> > >
> > > I'm not sure how to fix this, and it's quite painful actually :)
> >
> > Yeah, I think our handling of symlinks in both read-tree and
> > merge-recursive codepath are Ok for symlinks at the leaf level
> > but not for intermediate levels. I think we have some patches
> > in the recent git (post 1.5.1) to fix (perhaps some of) the
> > issues, though.
>
> that was with the git in debian unstable, 1.5.2.3 actually. I'll try
> again with HEAD to see if that's fixed.
HEADS does not fixes it either.
Here is how to reproduce the problem step by step:
$ git init-db # init a repo
$ mkdir dir
$ echo wibble > dir/a
$ git add a
$ git commit -a -m'add a' # have dir/a live in master
$ git checkout -b break
$ git mv dir new # rename dir into new
$ ln -s new dir # symlink dir to new
$ git add dir # add the symlink
$ git commit -a -m 'break things' # commit
$ git checkout master
fatal: Untracked working tree file 'dir/a' would be overwritten by merge.
The same is true for current git.git HEAD, or git 1.5.2.x
Cheers,
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH] Remove USE_PAGER from git-pickaxe and git-annotate
From: Andrew Ruder @ 2007-07-04 22:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
git-blame (and friends) specifically leave the pager turned off
in the case that --incremental is specified as this isn't for
human consumption. git-pickaxe and git-annotate will turn it on
themselves otherwise.
Signed-off-by: Andrew Ruder <andy@aeruder.net>
---
git.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/git.c b/git.c
index 727aabc..a647f9c 100644
--- a/git.c
+++ b/git.c
@@ -303,7 +303,7 @@ static void handle_internal_command(int argc, const char **argv)
const char *cmd = argv[0];
static struct cmd_struct commands[] = {
{ "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
- { "annotate", cmd_annotate, RUN_SETUP | USE_PAGER },
+ { "annotate", cmd_annotate, RUN_SETUP },
{ "apply", cmd_apply },
{ "archive", cmd_archive },
{ "blame", cmd_blame, RUN_SETUP },
@@ -345,7 +345,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "mv", cmd_mv, RUN_SETUP | NEED_WORK_TREE },
{ "name-rev", cmd_name_rev, RUN_SETUP },
{ "pack-objects", cmd_pack_objects, RUN_SETUP },
- { "pickaxe", cmd_blame, RUN_SETUP | USE_PAGER },
+ { "pickaxe", cmd_blame, RUN_SETUP },
{ "prune", cmd_prune, RUN_SETUP },
{ "prune-packed", cmd_prune_packed, RUN_SETUP },
{ "push", cmd_push, RUN_SETUP },
--
1.5.3.rc0.13.gc37c
^ permalink raw reply related
* [PATCH] Add urls.txt to git-clone man page
From: Andrew Ruder @ 2007-07-04 22:21 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
Since git-clone is one of the many commands taking
URLs to remote repositories as an argument, it should include
the URL-types list from urls.txt.
Split up urls.txt into urls.txt and urls-remotes.txt. The latter
should be used by anything besides git-clone where a discussion of
using .git/config and .git/remotes/ to name URLs just doesn't make
as much sense.
Signed-off-by: Andrew Ruder <andy@aeruder.net>
---
Documentation/git-clone.txt | 7 +++-
Documentation/git-fetch.txt | 2 +-
Documentation/git-pull.txt | 2 +-
Documentation/git-push.txt | 2 +-
Documentation/urls-remotes.txt | 55 ++++++++++++++++++++++++++++++++++++++++
Documentation/urls.txt | 54 ---------------------------------------
6 files changed, 63 insertions(+), 59 deletions(-)
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index 4a5bab5..2f39864 100644
--- a/Documentation/git-clone.txt
+++ b/Documentation/git-clone.txt
@@ -106,8 +106,9 @@ OPTIONS
as patches.
<repository>::
- The (possibly remote) repository to clone from. It can
- be any URL git-fetch supports.
+ The (possibly remote) repository to clone from. See the
+ <<URLS,URLS>> section below for more information on specifying
+ repositories.
<directory>::
The name of a new directory to clone into. The "humanish"
@@ -116,6 +117,8 @@ OPTIONS
for "host.xz:foo/.git"). Cloning into an existing directory
is not allowed.
+include::urls.txt[]
+
Examples
--------
diff --git a/Documentation/git-fetch.txt b/Documentation/git-fetch.txt
index 5fbeab7..9003473 100644
--- a/Documentation/git-fetch.txt
+++ b/Documentation/git-fetch.txt
@@ -35,7 +35,7 @@ include::fetch-options.txt[]
include::pull-fetch-param.txt[]
-include::urls.txt[]
+include::urls-remotes.txt[]
SEE ALSO
--------
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt
index 84693f8..e1eb2c1 100644
--- a/Documentation/git-pull.txt
+++ b/Documentation/git-pull.txt
@@ -29,7 +29,7 @@ include::fetch-options.txt[]
include::pull-fetch-param.txt[]
-include::urls.txt[]
+include::urls-remotes.txt[]
include::merge-strategies.txt[]
diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 665f6dc..74a0da1 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -95,7 +95,7 @@ the remote repository.
-v::
Run verbosely.
-include::urls.txt[]
+include::urls-remotes.txt[]
Examples
diff --git a/Documentation/urls-remotes.txt b/Documentation/urls-remotes.txt
new file mode 100644
index 0000000..5dd1f83
--- /dev/null
+++ b/Documentation/urls-remotes.txt
@@ -0,0 +1,55 @@
+include::urls.txt[]
+
+REMOTES
+-------
+
+In addition to the above, as a short-hand, the name of a
+file in `$GIT_DIR/remotes` directory can be given; the
+named file should be in the following format:
+
+------------
+ URL: one of the above URL format
+ Push: <refspec>
+ Pull: <refspec>
+
+------------
+
+Then such a short-hand is specified in place of
+<repository> without <refspec> parameters on the command
+line, <refspec> specified on `Push:` lines or `Pull:`
+lines are used for `git-push` and `git-fetch`/`git-pull`,
+respectively. Multiple `Push:` and `Pull:` lines may
+be specified for additional branch mappings.
+
+Or, equivalently, in the `$GIT_DIR/config` (note the use
+of `fetch` instead of `Pull:`):
+
+------------
+ [remote "<remote>"]
+ url = <url>
+ push = <refspec>
+ fetch = <refspec>
+
+------------
+
+The name of a file in `$GIT_DIR/branches` directory can be
+specified as an older notation short-hand; the named
+file should contain a single line, a URL in one of the
+above formats, optionally followed by a hash `#` and the
+name of remote head (URL fragment notation).
+`$GIT_DIR/branches/<remote>` file that stores a <url>
+without the fragment is equivalent to have this in the
+corresponding file in the `$GIT_DIR/remotes/` directory.
+
+------------
+ URL: <url>
+ Pull: refs/heads/master:<remote>
+
+------------
+
+while having `<url>#<head>` is equivalent to
+
+------------
+ URL: <url>
+ Pull: refs/heads/<head>:<remote>
+------------
diff --git a/Documentation/urls.txt b/Documentation/urls.txt
index 745f967..781df41 100644
--- a/Documentation/urls.txt
+++ b/Documentation/urls.txt
@@ -32,57 +32,3 @@ To sync with a local directory, use:
===============================================================
- /path/to/repo.git/
===============================================================
-
-REMOTES
--------
-
-In addition to the above, as a short-hand, the name of a
-file in `$GIT_DIR/remotes` directory can be given; the
-named file should be in the following format:
-
-------------
- URL: one of the above URL format
- Push: <refspec>
- Pull: <refspec>
-
-------------
-
-Then such a short-hand is specified in place of
-<repository> without <refspec> parameters on the command
-line, <refspec> specified on `Push:` lines or `Pull:`
-lines are used for `git-push` and `git-fetch`/`git-pull`,
-respectively. Multiple `Push:` and `Pull:` lines may
-be specified for additional branch mappings.
-
-Or, equivalently, in the `$GIT_DIR/config` (note the use
-of `fetch` instead of `Pull:`):
-
-------------
- [remote "<remote>"]
- url = <url>
- push = <refspec>
- fetch = <refspec>
-
-------------
-
-The name of a file in `$GIT_DIR/branches` directory can be
-specified as an older notation short-hand; the named
-file should contain a single line, a URL in one of the
-above formats, optionally followed by a hash `#` and the
-name of remote head (URL fragment notation).
-`$GIT_DIR/branches/<remote>` file that stores a <url>
-without the fragment is equivalent to have this in the
-corresponding file in the `$GIT_DIR/remotes/` directory.
-
-------------
- URL: <url>
- Pull: refs/heads/master:<remote>
-
-------------
-
-while having `<url>#<head>` is equivalent to
-
-------------
- URL: <url>
- Pull: refs/heads/<head>:<remote>
-------------
--
1.5.3.rc0.13.gc37c
^ permalink raw reply related
* [PATCH] gitk: Fix for tree view ending in nested directories
From: Brian Downing @ 2007-07-04 21:26 UTC (permalink / raw)
To: git
Unroll the prefix stack when assigning treeheights when leaving
proc treeview. Previously, when the ls-tree output ended in
multiple nested directories (for instance in a repository with a
single file "foo/bar/baz"), $treeheight("foo/bar/") was assigned
twice, and $treeheight("foo/") was never assigned. This led to
an error when expanding the "foo" directory in the gitk treeview.
Signed-off-by: Brian Downing <bdowning@lavos.net>
---
gitk | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 2d6a6ef..d94c512 100755
--- a/gitk
+++ b/gitk
@@ -1216,6 +1216,9 @@ proc treeview {w l openlevs} {
set treeheight($prefix) $ht
incr ht [lindex $htstack end]
set htstack [lreplace $htstack end end]
+ set prefixend [lindex $prefendstack end]
+ set prefendstack [lreplace $prefendstack end end]
+ set prefix [string range $prefix 0 $prefixend]
}
$w conf -state disabled
}
--
1.5.2.GIT
^ permalink raw reply related
* Re: [PATCH 2/2] diff: add custom regular expressions for function names
From: Johannes Schindelin @ 2007-07-04 21:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vejjnhpap.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 4 Jul 2007, Junio C Hamano wrote:
> I'll take it from there.
Thanks,
Dscho
^ permalink raw reply
* [PATCH] git-svn: fix blocking with svn:// servers after do_switch
From: Eric Wong @ 2007-07-04 21:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, 430091
In-Reply-To: <20070626133704.24521.qmail@a4f750d1ddce1f.315fe32.mid.smarden.org>
We now explicitly disconnect before starting new SVN::Ra
connections. SVN::Ra objects will automatically be disconnected
from the server on DESTROY.
SVN servers seem to have problems accepting multiple connections
from one client, and the SVN library has trouble being connected
to multiple servers at once. This appears to cause opening the
second connection to block, and cause git-svn to be unusable
after using the do_switch() function.
git-svn opens another connection because a workaround is
necesary for the buggy reparent function handling on certain
versions of svn:// and svn+ssh:// servers. Instead of using the
reparent function (analogous to chdir), it will reopen a new
connection to a different URL on the SVN server.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
Gerrit Pape <pape@smarden.org> wrote:
> Hi, on Debian unstable the current version of libsvn-perl is 1.4.4dfsg1.
> With this version git-svn uses do_switch instead of do_update, which
> seems to not work properly, please see
>
> http://bugs.debian.org/430091
>
> on how to reproduce the problem. The following also is showing a
> problem, as it blocks in read() after do_switch
>
> git svn clone -T trunk -b branches -t tags \
> svn://bruce-guenter.dyndns.org/bglibs
>
> I'm not sure whether this is a git-svn or a subversion problem, thanks
> for your input.
Thanks for the bug report. Sorry for the latency these days, I've
been quite busy with other things.
Although this fixes blocking reads, this does *not* fix the
"Malformed network data" issue, which has been around for a
while...
I'll try to find time to fix the "Malformed network data" bug
in a few days time, but it's not fatal (just restart git-svn,
this error happens at a point where it's not possible to have
a corrupted import).
git-svn.perl | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 51979f9..b3dffcc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3002,6 +3002,7 @@ sub new {
\&Git::SVN::Prompt::username, 2),
]);
my $config = SVN::Core::config_get_config($config_dir);
+ $RA = undef;
my $self = SVN::Ra->new(url => $url, auth => $baton,
config => $config,
pool => SVN::Pool->new,
--
Eric Wong
^ permalink raw reply related
* Re: [BUG (or misfeature?)] git checkout and symlinks
From: Pierre Habouzit @ 2007-07-04 21:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vabubhoxb.fsf@assigned-by-dhcp.cox.net>
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
On Wed, Jul 04, 2007 at 01:52:32PM -0700, Junio C Hamano wrote:
> Pierre Habouzit <madcoder@debian.org> writes:
>
> > if in a branch [branch1] you track the file: dir1/file1.c
> > and in the branch [branch2] you track elsewhere/file1.c and dir1 be
> > symlink on elsewhere, then it's not possible to checkout the branch
> > [branch1] if your previous checkout was [branch2]. You have to manually
> > remove the symlink `dir1` else git complains that checkouting branch1
> > would overwrite dir1/file1.c.
> >
> > I'm not sure how to fix this, and it's quite painful actually :)
>
> Yeah, I think our handling of symlinks in both read-tree and
> merge-recursive codepath are Ok for symlinks at the leaf level
> but not for intermediate levels. I think we have some patches
> in the recent git (post 1.5.1) to fix (perhaps some of) the
> issues, though.
that was with the git in debian unstable, 1.5.2.3 actually. I'll try
again with HEAD to see if that's fixed.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [BUG (or misfeature?)] git checkout and symlinks
From: Junio C Hamano @ 2007-07-04 20:52 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: git
In-Reply-To: <20070704203541.GA13286@artemis.corp>
Pierre Habouzit <madcoder@debian.org> writes:
> if in a branch [branch1] you track the file: dir1/file1.c
> and in the branch [branch2] you track elsewhere/file1.c and dir1 be
> symlink on elsewhere, then it's not possible to checkout the branch
> [branch1] if your previous checkout was [branch2]. You have to manually
> remove the symlink `dir1` else git complains that checkouting branch1
> would overwrite dir1/file1.c.
>
> I'm not sure how to fix this, and it's quite painful actually :)
Yeah, I think our handling of symlinks in both read-tree and
merge-recursive codepath are Ok for symlinks at the leaf level
but not for intermediate levels. I think we have some patches
in the recent git (post 1.5.1) to fix (perhaps some of) the
issues, though.
^ permalink raw reply
* Re: [PATCH 2/2] diff: add custom regular expressions for function names
From: Junio C Hamano @ 2007-07-04 20:44 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Johannes Schindelin, git, gitster
In-Reply-To: <alpine.LFD.0.98.0707041140230.9434@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Wed, 4 Jul 2007, Johannes Schindelin wrote:
>>
>> This patch introduces a config variable diff.functionNameRegexp
>> which replaces the default heuristics. If the pattern contains
>> a group, the match of this group is used for the hunk header
>> instead of the whole match.
>
> Umm. Shouldn't it be a path-name based attribute instead?
>
> That way you can set it to be different things for different source files
> in the same repository.. IOW, think mixed Java/C codebases.
Absolutely. I'll take it from there.
^ permalink raw reply
* [BUG (or misfeature?)] git checkout and symlinks
From: Pierre Habouzit @ 2007-07-04 20:35 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
if in a branch [branch1] you track the file: dir1/file1.c
and in the branch [branch2] you track elsewhere/file1.c and dir1 be
symlink on elsewhere, then it's not possible to checkout the branch
[branch1] if your previous checkout was [branch2]. You have to manually
remove the symlink `dir1` else git complains that checkouting branch1
would overwrite dir1/file1.c.
I'm not sure how to fix this, and it's quite painful actually :)
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ 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