* Re: [PATCH] fix potential infinite loop given large unsigned integer
From: Tony Finch @ 2009-08-10 18:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Ryan Flynn, git
In-Reply-To: <7v3a81a13z.fsf@alter.siamese.dyndns.org>
On Sun, 9 Aug 2009, Junio C Hamano wrote:
> + if (numbered) {
> + static char num_buf[64];
> rev.total = total + start_number - 1;
> + sprintf(num_buf, "%d", rev.total);
> + rev.num_width = strlen(num_buf);
> + }
why not
if (numbered) {
rev.total = total + start_number - 1;
rev.num_width = snprintf(NULL, 0, "%d", rev.total);
}
?
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.
^ permalink raw reply
* Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
From: Alex Blewitt @ 2009-08-10 18:19 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: robin.rosenberg@dewire.com, git@vger.kernel.org
In-Reply-To: <20090810155207.GW1033@spearce.org>
That patch was originally mailed on the 11th May. Has it taken until
now to notice the problem, or was the other method added in the last
month or so? If I'm to blame, I apologise but didn't note any compile
time issues at the time.
Alex
Sent from my (new) iPhone
On 10 Aug 2009, at 16:52, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
>> ---
>> .../src/org/spearce/jgit/lib/AnyObjectId.java | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/
>> AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/
>> AnyObjectId.java
>> index acb3cb5..015042a 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> @@ -448,6 +448,12 @@ public final String name() {
>> }
>>
>> /**
>> + * @return string form of the SHA-1, in lower case hexadecimal.
>> + */
>> + public final String getName() {
>> + return name();
>> + }
>
> Obviously you didn't compile test this in JGit:
>
> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
> org.spearce.jgit.revwalk.RevTag cannot override getName() in
> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>
> :-(
>
> --
> Shawn.
^ permalink raw reply
* Re: [EGIT PATCH] Provide a more JavaBeans-style 'getName' accessor for the id Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
From: Alex Blewitt @ 2009-08-10 18:11 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: robin.rosenberg@dewire.com, git@vger.kernel.org
In-Reply-To: <20090810155207.GW1033@spearce.org>
That was ages ago that I submitted that patch. I'm pretty sure that it
compiled at the time for the version of JGit that I had back then.
Sent from my (new) iPhone
On 10 Aug 2009, at 16:52, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> Alex Blewitt <alex.blewitt@gmail.com> wrote:
>> ---
>> .../src/org/spearce/jgit/lib/AnyObjectId.java | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/
>> AnyObjectId.java b/org.spearce.jgit/src/org/spearce/jgit/lib/
>> AnyObjectId.java
>> index acb3cb5..015042a 100644
>> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/AnyObjectId.java
>> @@ -448,6 +448,12 @@ public final String name() {
>> }
>>
>> /**
>> + * @return string form of the SHA-1, in lower case hexadecimal.
>> + */
>> + public final String getName() {
>> + return name();
>> + }
>
> Obviously you didn't compile test this in JGit:
>
> ./org/spearce/jgit/revwalk/RevTag.java:206: getName() in
> org.spearce.jgit.revwalk.RevTag cannot override getName() in
> org.spearce.jgit.lib.AnyObjectId; overridden method is final
>
> :-(
>
> --
> Shawn.
^ permalink raw reply
* Re: [PATCH] Limited git-gui to displaying 5000 new files
From: Dan Zwell @ 2009-08-10 15:15 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Alex Riesen, Git Mailing List
In-Reply-To: <20090810170842.GX1033@spearce.org>
Shawn O. Pearce wrote:
> Alex Riesen <raa.lkml@gmail.com> wrote:
>> On Mon, Aug 10, 2009 at 17:38, Shawn O. Pearce<spearce@spearce.org> wrote:
>>>> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? set warning "Displaying only $display_limit of "
>>>> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? append warning "[llength $to_display] files."
>>>> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? info_popup [mc $warning]
>>> This needs to be in the translated strings.
>> Will do, as soon as this hits git://repo.or.cz/git-gui.git.
>> Or should I have looked at the internationalization repo
>> git://repo.or.cz/git-gui/git-gui-i18n.git?
>
> No, I meant that the patch needs to use [mc] or whatever it is
> to enable the string to be localized. After its marked with the
> necessary code change, I can apply the patch, regenerate the .pot,
> and let translators update their .po when they have time.
>
I will change it to use [mc] (and make the other changes that Shawn
mentioned) and resubmit the patch.
-Dan
^ permalink raw reply
* Re: [PATCH] Limited git-gui to displaying 5000 new files
From: Shawn O. Pearce @ 2009-08-10 17:08 UTC (permalink / raw)
To: Alex Riesen; +Cc: Dan Zwell, Git Mailing List
In-Reply-To: <81b0412b0908101006n66672cabi865a980d978c2865@mail.gmail.com>
Alex Riesen <raa.lkml@gmail.com> wrote:
> On Mon, Aug 10, 2009 at 17:38, Shawn O. Pearce<spearce@spearce.org> wrote:
> >> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? set warning "Displaying only $display_limit of "
> >> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? append warning "[llength $to_display] files."
> >> + ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? info_popup [mc $warning]
> >
> > This needs to be in the translated strings.
>
> Will do, as soon as this hits git://repo.or.cz/git-gui.git.
> Or should I have looked at the internationalization repo
> git://repo.or.cz/git-gui/git-gui-i18n.git?
No, I meant that the patch needs to use [mc] or whatever it is
to enable the string to be localized. After its marked with the
necessary code change, I can apply the patch, regenerate the .pot,
and let translators update their .po when they have time.
--
Shawn.
^ permalink raw reply
* Re: [PATCH] Limited git-gui to displaying 5000 new files
From: Alex Riesen @ 2009-08-10 17:06 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Dan Zwell, Git Mailing List
In-Reply-To: <20090810153859.GT1033@spearce.org>
On Mon, Aug 10, 2009 at 17:38, Shawn O. Pearce<spearce@spearce.org> wrote:
>> + set warning "Displaying only $display_limit of "
>> + append warning "[llength $to_display] files."
>> + info_popup [mc $warning]
>
> This needs to be in the translated strings.
>
Will do, as soon as this hits git://repo.or.cz/git-gui.git.
Or should I have looked at the internationalization repo
git://repo.or.cz/git-gui/git-gui-i18n.git?
^ permalink raw reply
* Re: [Feature Request] git export
From: Johannes Schindelin @ 2009-08-10 16:56 UTC (permalink / raw)
To: Thomas Koch; +Cc: git
In-Reply-To: <200908101822.59940.thomas@koch.ro>
Hi,
On Mon, 10 Aug 2009, Thomas Koch wrote:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
>
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require
> that much GIT FU to do such a simple thing.
You can check out Documentation/install-doc-quick.sh and find that
something like
GIT_INDEX_FILE=.git/tmp
export GIT_INDEX_FILE
git read-tree $TREE
git checkout-index -a -f --prefix=/the/path
unset GIT_INDEX_FILE
should work.
Hth,
Dscho
^ permalink raw reply
* Re: [Feature Request] git export
From: Junio C Hamano @ 2009-08-10 16:54 UTC (permalink / raw)
To: thomas; +Cc: git
In-Reply-To: <200908101822.59940.thomas@koch.ro>
Thomas Koch <thomas@koch.ro> writes:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require that much
If you are talking about a tree object, then git-archive is what you want.
It was invented almost for this exact purpose, but unlike "export" that
would only copy to a directory, you can get a tarball out of it when you
do not want to expand the result into a directory; it is more versatile
form. The manual page for the command has an example (look for
"/var/tmp") so I won't repeat the cut-and-paste recipe here.
If you are not talking about a tree object but is talking about the
contents recorded in your index, checkout-index with the --prefix option
may be what you want. The manual page for the command has an example
(look for "--prefix=git-export-dir/") so I won't repeat it here.
^ permalink raw reply
* Re: [PATCH] fix potential infinite loop given large unsigned integer
From: Johannes Schindelin @ 2009-08-10 16:53 UTC (permalink / raw)
To: Ryan Flynn; +Cc: Erik Faye-Lund, Christian Couder, Junio C Hamano, git
In-Reply-To: <a3f15ee60908100917k2a2d6de7ndd5e4ddd1d926cc3@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 845 bytes --]
Hi,
[please cull the quoted text to what you are actually replying to.
Thanks]
On Mon, 10 Aug 2009, Ryan Flynn wrote:
> On Mon, Aug 10, 2009 at 8:24 AM, Johannes
> Schindelin<Johannes.Schindelin@gmx.de> wrote:
> >
> > static unsigned int digits_of_number(unsigned int number) {
> > unsigned int result;
> > for (result = 1; number; number /= 10, result++)
> > ; /* do nothing */
> > return result;
> > }
>
> whoops, actually yours: digits_of_number(1) -> 2
static unsigned int digits(unsigned int number)
{
unsigned int result;
for (result = 1; (number /= 10); result++)
; /* do nothing */
return result;
}
I'm sorry, I forgot the "something like this" in my mail.
This version is actually tested.
It has non-optimal runtime, but then, it does not really matter.
Ciao,
Dscho
^ permalink raw reply
* Re: [RFC PATCH v2 4/4] read-tree: add --no-sparse to turn off sparse hook
From: Johannes Schindelin @ 2009-08-10 16:46 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1249917562-5931-5-git-send-email-pclouds@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1238 bytes --]
Hi,
On Mon, 10 Aug 2009, Nguyễn Thái Ngọc Duy wrote:
> diff --git a/unpack-trees.c b/unpack-trees.c
> index f407bf5..d087112 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -530,8 +530,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
> if (o->trivial_merges_only && o->nontrivial_merge)
> return unpack_failed(o, "Merge requires file-level merging");
>
> - if (run_sparse_hook(o))
> - return unpack_failed(o, NULL);
> + if (!o->no_sparse_hook) {
> + if (run_sparse_hook(o))
> + return unpack_failed(o, NULL);
> + }
>
IMHO this would read nicelier as
if (!o->no_sparse_hook && run_sparse_hook(o))
return unpack_failed(o, NULL);
> diff --git a/unpack-trees.h b/unpack-trees.h
> index ad21823..81eb2ef 100644
> --- a/unpack-trees.h
> +++ b/unpack-trees.h
> @@ -30,6 +30,7 @@ struct unpack_trees_options {
> skip_unmerged,
> initial_checkout,
> diff_index_cached,
> + no_sparse_hook,
> gently;
Hmm. I understand that the assumption is that memset(&opts, 0,
sizeof(opts)); should give you a sensible default, but I cannot avoid
noticing that "no_sparse_hook = 0" is a double negation, something to be
avoided...
Thanks,
Dscho
^ permalink raw reply
* Re: [RFC PATCH v2 3/4] unpack_trees(): add support for sparse checkout
From: Johannes Schindelin @ 2009-08-10 16:41 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1249917562-5931-4-git-send-email-pclouds@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1057 bytes --]
Hi,
On Mon, 10 Aug 2009, Nguyễn Thái Ngọc Duy wrote:
> This patch teaches unpack_trees() to checkout/remove entries on working
> directories appropriately when sparse checkout area is changed. Hook
> "sparse" is needed to help determine which entry will be checked out,
> which will not be.
>
> When the hook is run, it is prepared with a pseudo index. The hook then
> can use "git update-index --[no-]assume-unchanged" to manipulate the
> index. It should not do anything else on the index. Assume unchanged
> information from the index will be used to shape working directory.
If I understand correctly, the purpose of the hook is to allow the user to
mark something as unwanted preemptively, right?
If that is the sole reason for the hook, would it not be better to add
support for a file .git/info/sparse which has the same syntax as
.git/info/exclude, and which is used to determine if an
added/modified/deleted file is supposed to be in the "sparse" area or not?
Something like
*
!/Documentation/
comes to mind.
Thanks,
Dscho
^ permalink raw reply
* Re: [Feature Request] git export
From: Thomas Koch @ 2009-08-10 16:41 UTC (permalink / raw)
To: Tim Visher; +Cc: git
In-Reply-To: <c115fd3c0908100927v4d9e4a87we4502e91d3789138@mail.gmail.com>
Hi Tim,
thanks for your explanation. Still I don't get how to do it with git checkout-
index. The man page says "Just read the desired tree into the index", but I
don't know what is meant by this.
> Hey Thomas,
>
> On Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:
> > could you please provide a simple solution to save a tree object into an
> > arbitrary location?
>
> This has been requested a few times and I have no idea what the
> development status of it is. Most people seem to recommend just
> making an alias around git checkout-index.
>
> > I found some hints, that it would be possible by missusing either git
> > checkout-index or git-archive, but I think that it shouldn't require that
> > much GIT FU to do such a simple thing.
>
> It's not really a misuse, as the [man page
> itself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.
>html) recommends using checkout-index as a way to export an entire tree.
> Until someone decides that it's worth making the porcelain command (like
> you perhaps) then I think you can just stick with checkout-index knowing
> you're not abusing anything.
Thomas Koch, http://www.koch.ro
^ permalink raw reply
* Re: [RFC PATCH v2 2/4] gitignore: read from index if .gitignore is assume-unchanged
From: Johannes Schindelin @ 2009-08-10 16:33 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1249917562-5931-3-git-send-email-pclouds@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2887 bytes --]
Hi,
On Mon, 10 Aug 2009, Nguyễn Thái Ngọc Duy wrote:
> diff --git a/dir.c b/dir.c
> index e05b850..e55344f 100644
> --- a/dir.c
> +++ b/dir.c
> @@ -200,11 +200,36 @@ void add_exclude(const char *string, const char *base,
> which->excludes[which->nr++] = x;
> }
>
> +static void *read_index_data(const char *path, size_t *size)
How about calling it "read_assume_unchanged_from_index()" instead? I
suggest this because it does not read the index from the data if the path
is not marked assume unchanged...
> @@ -212,27 +237,31 @@ static int add_excludes_from_file_1(const char *fname,
>
> [...]
>
> if (buf_p)
> *buf_p = buf;
> - buf[size++] = '\n';
> entry = buf;
> - for (i = 0; i < size; i++) {
> - if (buf[i] == '\n') {
> + for (i = 0; i <= size; i++) {
> + if (i == size || buf[i] == '\n') {
> if (entry != buf + i && entry[0] != '#') {
> buf[i - (i && buf[i-1] == '\r')] = 0;
> add_exclude(entry, base, baselen, which);
Should this change not rather be a separate one?
> @@ -241,17 +270,12 @@ static int add_excludes_from_file_1(const char *fname,
> }
> }
> return 0;
> -
> - err:
> - if (0 <= fd)
> - close(fd);
> - return -1;
> }
>
> void add_excludes_from_file(struct dir_struct *dir, const char *fname)
> {
> if (add_excludes_from_file_1(fname, "", 0, NULL,
> - &dir->exclude_list[EXC_FILE]) < 0)
> + &dir->exclude_list[EXC_FILE], 0) < 0)
Could you mention in the commit message why this function does not want to
check the index (I _guess_ it is because this code path only tries to read
.git/info/exclude, but it would be better to be sure).
> die("cannot use %s as an exclude file", fname);
> }
>
> @@ -302,7 +326,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
> strcpy(dir->basebuf + stk->baselen, dir->exclude_per_dir);
> add_excludes_from_file_1(dir->basebuf,
> dir->basebuf, stk->baselen,
> - &stk->filebuf, el);
> + &stk->filebuf, el, 1);
> dir->exclude_stack = stk;
> current = stk->baselen;
> }
> diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh
> index c65bca8..88b69bc 100755
> --- a/t/t3001-ls-files-others-exclude.sh
> +++ b/t/t3001-ls-files-others-exclude.sh
> @@ -85,6 +85,26 @@ test_expect_success \
> >output &&
> test_cmp expect output'
>
> +test_expect_success 'setup sparse gitignore' '
> + git add .gitignore one/.gitignore one/two/.gitignore &&
> + git update-index --assume-unchanged .gitignore one/.gitignore one/two/.gitignore &&
> + rm .gitignore one/.gitignore one/two/.gitignore
> +'
You're probably less sloppy than me; I'd have defined a variable like
this:
ignores=".gitignore one/.gitignore one/two/.gitignore"
and used it for the three calls, just to make sure that I do not fsck
anything up there due to fat fingers.
Thanks,
Dscho
^ permalink raw reply
* Re: [Feature Request] git export
From: Tim Visher @ 2009-08-10 16:27 UTC (permalink / raw)
To: thomas; +Cc: git
In-Reply-To: <200908101822.59940.thomas@koch.ro>
Hey Thomas,
On Mon, Aug 10, 2009 at 12:22 PM, Thomas Koch<thomas@koch.ro> wrote:
> could you please provide a simple solution to save a tree object into an
> arbitrary location?
This has been requested a few times and I have no idea what the
development status of it is. Most people seem to recommend just
making an alias around git checkout-index.
> I found some hints, that it would be possible by missusing either git
> checkout-index or git-archive, but I think that it shouldn't require that much
> GIT FU to do such a simple thing.
It's not really a misuse, as the [man page
itself](http://www.kernel.org/pub/software/scm/git/docs/git-checkout-index.html)
recommends using checkout-index as a way to export an entire tree.
Until someone decides that it's worth making the porcelain command
(like you perhaps) then I think you can just stick with checkout-index
knowing you're not abusing anything.
--
In Christ,
Timmy V.
http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail
^ permalink raw reply
* [Feature Request] git export
From: Thomas Koch @ 2009-08-10 16:22 UTC (permalink / raw)
To: git
could you please provide a simple solution to save a tree object into an
arbitrary location?
I found some hints, that it would be possible by missusing either git
checkout-index or git-archive, but I think that it shouldn't require that much
GIT FU to do such a simple thing.
Thanks,
Thomas Koch, http://www.koch.ro
^ permalink raw reply
* [PATCH 2/2] Correctly mark cover letters' encodings if they are not pure ASCII
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
In-Reply-To: <cover.1249921206u.git.johannes.schindelin@gmx.de>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 792 bytes --]
If your name is, say, Üwë, you want your cover letters to appear
correctly. Convince format-patch to mark it as 8-bit.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin-log.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 3600215..d4a6a7d 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -678,6 +678,10 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
log_write_email_headers(rev, head, &subject_start, &extra_headers,
&need_8bit_cte);
+ for (i = 0; !need_8bit_cte && i < nr; i++)
+ if (has_non_ascii(list[i]->buffer))
+ need_8bit_cte = 1;
+
msg = body;
pp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822,
encoding);
--
1.6.3.2.734.g770e
^ permalink raw reply related
* [PATCH 1/2] Expose the has_non_ascii() function
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
In-Reply-To: <cover.1249921206u.git.johannes.schindelin@gmx.de>
This function is useful outside of log-tree.c, too.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
commit.h | 1 +
log-tree.c | 12 ------------
pretty.c | 12 ++++++++++++
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/commit.h b/commit.h
index 8bfdf0e..d1674d7 100644
--- a/commit.h
+++ b/commit.h
@@ -64,6 +64,7 @@ enum cmit_fmt {
};
extern int non_ascii(int);
+extern int has_non_ascii(const char *text);
struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */
extern char *reencode_commit_message(const struct commit *commit,
const char **encoding_p);
diff --git a/log-tree.c b/log-tree.c
index 6f73c17..a3b4c06 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -168,18 +168,6 @@ static unsigned int digits_in_number(unsigned int number)
return result;
}
-static int has_non_ascii(const char *s)
-{
- int ch;
- if (!s)
- return 0;
- while ((ch = *s++) != '\0') {
- if (non_ascii(ch))
- return 1;
- }
- return 0;
-}
-
void get_patch_filename(struct commit *commit, int nr, const char *suffix,
struct strbuf *buf)
{
diff --git a/pretty.c b/pretty.c
index 1aa9c3f..ec0affe 100644
--- a/pretty.c
+++ b/pretty.c
@@ -86,6 +86,18 @@ int non_ascii(int ch)
return !isascii(ch) || ch == '\033';
}
+int has_non_ascii(const char *s)
+{
+ int ch;
+ if (!s)
+ return 0;
+ while ((ch = *s++) != '\0') {
+ if (non_ascii(ch))
+ return 1;
+ }
+ return 0;
+}
+
static int is_rfc2047_special(char ch)
{
return (non_ascii(ch) || (ch == '=') || (ch == '?') || (ch == '_'));
--
1.6.3.2.734.g770e
^ permalink raw reply related
* [PATCH 0/2] Fix cover letters when they contain non-ASCII
From: Johannes Schindelin @ 2009-08-10 16:22 UTC (permalink / raw)
To: git, gitster
[-- Attachment #1: Type: TEXT/PLAIN, Size: 368 bytes --]
Hi,
I saw this issue with Santi's and Nguyễn's patch series.
Johannes Schindelin (2):
Expose the has_non_ascii() function
Correctly mark cover letters' encodings if they are not pure ASCII
builtin-log.c | 4 ++++
commit.h | 1 +
log-tree.c | 12 ------------
pretty.c | 12 ++++++++++++
4 files changed, 17 insertions(+), 12 deletions(-)
^ permalink raw reply
* Re: [RFC PATCH v2 1/4] Prevent diff machinery from examining assume-unchanged entries on worktree
From: Johannes Schindelin @ 2009-08-10 16:20 UTC (permalink / raw)
To: Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <1249917562-5931-2-git-send-email-pclouds@gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2072 bytes --]
Hi,
On Mon, 10 Aug 2009, Nguyễn Thái Ngọc Duy wrote:
> diff --git a/diff-lib.c b/diff-lib.c
> index b7813af..f5787f6 100644
> --- a/diff-lib.c
> +++ b/diff-lib.c
> @@ -337,6 +337,8 @@ static void do_oneway_diff(struct unpack_trees_options *o,
> struct rev_info *revs = o->unpack_data;
> int match_missing, cached;
>
> + /* if the entry is not checked out, don't examine work tree */
> + cached = o->index_only || (idx && (idx->ce_flags & CE_VALID));
> /*
> * Backward compatibility wart - "diff-index -m" does
> * not mean "do not ignore merges", but "match_missing".
> @@ -344,7 +346,6 @@ static void do_oneway_diff(struct unpack_trees_options *o,
> * But with the revision flag parsing, that's found in
> * "!revs->ignore_merges".
> */
> - cached = o->index_only;
> match_missing = !revs->ignore_merges;
>
> if (cached && idx && ce_stage(idx)) {
Out of curiosity: why did that line have to move up?
Ciao,
Dscho
> diff --git a/t/t4039-diff-assume-unchanged.sh b/t/t4039-diff-assume-unchanged.sh
> new file mode 100755
> index 0000000..d0e46a7
> --- /dev/null
> +++ b/t/t4039-diff-assume-unchanged.sh
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +
> +test_description='diff with assume-unchanged entries'
> +
> +. ./test-lib.sh
> +
> +# external diff has been tested in t4020-diff-external.sh
> +
> +test_expect_success 'setup' '
> + echo zero > zero &&
> + git add zero &&
> + git commit -m zero &&
> + echo one > one &&
> + echo two > two &&
> + git add one two &&
> + git commit -m onetwo &&
> + git update-index --assume-unchanged one &&
> + echo borked >> one &&
> + test "$(git ls-files -v one)" = "h one"
> +'
Maybe use test_commit, to make it more readable?
> +
> +test_expect_success 'diff-index does not examine assume-unchanged entries' '
> + git diff-index HEAD^ -- one | grep -q 5626abf0f72e58d7a153368ba57db4c673c0e171
> +'
> +
> +# TODO ced_uptodate()
What is this about?
> +test_expect_success 'diff-files does not examine assume-unchanged entries' '
> + /usr/bin/git diff-files -- one
> +'
> +
> +test_done
Thanks,
Dscho
^ permalink raw reply
* Re: [PATCH] fix potential infinite loop given large unsigned integer
From: Ryan Flynn @ 2009-08-10 16:17 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Erik Faye-Lund, Christian Couder, Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0908101421340.8324@intel-tinevez-2-302>
On Mon, Aug 10, 2009 at 8:24 AM, Johannes
Schindelin<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Mon, 10 Aug 2009, Erik Faye-Lund wrote:
>
>> On Mon, Aug 10, 2009 at 7:24 AM, Christian
>> Couder<chriscool@tuxfamily.org> wrote:
>> >> log10() appears to be C99, but can be emulated on earlier C-versions by
>> >> doing #define log10(x) (log(x) / log(10.0))
>> >
>> > That would mean linking with -lm?
>>
>> I guess so. Are we currently trying to avoid linking to the math-parts
>> of libc?
>
> Yes.
>
> I guess we could fix the overflow thing very easily, though:
>
> static unsigned int digits_of_number(unsigned int number) {
> unsigned int result;
> for (result = 1; number; number /= 10, result++)
> ; /* do nothing */
> return result;
> }
>
> Ciao,
> Dscho
>
>
whoops, actually yours: digits_of_number(1) -> 2
^ permalink raw reply
* Re: [PATCH] fix potential infinite loop given large unsigned integer
From: Ryan Flynn @ 2009-08-10 16:14 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Erik Faye-Lund, Christian Couder, Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0908101421340.8324@intel-tinevez-2-302>
On Mon, Aug 10, 2009 at 8:24 AM, Johannes
Schindelin<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Mon, 10 Aug 2009, Erik Faye-Lund wrote:
>
>> On Mon, Aug 10, 2009 at 7:24 AM, Christian
>> Couder<chriscool@tuxfamily.org> wrote:
>> >> log10() appears to be C99, but can be emulated on earlier C-versions by
>> >> doing #define log10(x) (log(x) / log(10.0))
>> >
>> > That would mean linking with -lm?
>>
>> I guess so. Are we currently trying to avoid linking to the math-parts
>> of libc?
>
> Yes.
>
> I guess we could fix the overflow thing very easily, though:
>
> static unsigned int digits_of_number(unsigned int number) {
> unsigned int result;
> for (result = 1; number; number /= 10, result++)
> ; /* do nothing */
> return result;
> }
>
> Ciao,
> Dscho
>
>
that is equivalent to the original patch, yes.
^ permalink raw reply
* [PATCH (resend) 3/3] Check return value of ftruncate call in http.c
From: Tay Ray Chuan @ 2009-08-10 16:05 UTC (permalink / raw)
To: git, gitster; +Cc: Jeff Lasslett
In-Reply-To: <20090810235955.1a659e6c.rctay89@gmail.com>
From: Jeff Lasslett <jeff.lasslett@gmail.com>
In new_http_object_request(), check ftruncate() call return value and
handle possible errors.
Signed-off-by: Jeff Lasslett <jeff.lasslett@gmail.com>
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
Jeff, I took out all the url-specific cleanups and expanded their
scope (see earlier patches). You can safely focus on ftruncate() and
do an abort there. :)
http.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/http.c b/http.c
index 98f9707..14d5357 100644
--- a/http.c
+++ b/http.c
@@ -1187,7 +1187,11 @@ struct http_object_request *new_http_object_request(const char *base_url,
if (prev_posn>0) {
prev_posn = 0;
lseek(freq->localfile, 0, SEEK_SET);
- ftruncate(freq->localfile, 0);
+ if (ftruncate(freq->localfile, 0) < 0) {
+ error("Couldn't truncate temporary file %s for %s: %s",
+ freq->tmpfile, freq->filename, strerror(errno));
+ goto abort;
+ }
}
}
--
1.6.3.1
^ permalink raw reply related
* [PATCH (resend) 2/3] http.c: replace usage of temporary variable for urls
From: Tay Ray Chuan @ 2009-08-10 15:59 UTC (permalink / raw)
To: git, gitster; +Cc: Jeff Lasslett
In-Reply-To: <20090810235548.110c43a6.rctay89@gmail.com>
Use preq->url in new_http_pack_request and freq->url in
new_http_object_request when calling curl_setopt(CURLOPT_URL), instead
of using an intermediate variable, 'url'.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
http.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/http.c b/http.c
index cfe32f5..98f9707 100644
--- a/http.c
+++ b/http.c
@@ -1004,7 +1004,6 @@ int finish_http_pack_request(struct http_pack_request *preq)
struct http_pack_request *new_http_pack_request(
struct packed_git *target, const char *base_url)
{
- char *url;
char *filename;
long prev_posn = 0;
char range[RANGE_HEADER_SIZE];
@@ -1018,8 +1017,7 @@ struct http_pack_request *new_http_pack_request(
end_url_with_slash(&buf, base_url);
strbuf_addf(&buf, "objects/pack/pack-%s.pack",
sha1_to_hex(target->sha1));
- url = strbuf_detach(&buf, NULL);
- preq->url = xstrdup(url);
+ preq->url = strbuf_detach(&buf, NULL);
filename = sha1_pack_name(target->sha1);
snprintf(preq->filename, sizeof(preq->filename), "%s", filename);
@@ -1035,7 +1033,7 @@ struct http_pack_request *new_http_pack_request(
preq->slot->local = preq->packfile;
curl_easy_setopt(preq->slot->curl, CURLOPT_FILE, preq->packfile);
curl_easy_setopt(preq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite);
- curl_easy_setopt(preq->slot->curl, CURLOPT_URL, url);
+ curl_easy_setopt(preq->slot->curl, CURLOPT_URL, preq->url);
curl_easy_setopt(preq->slot->curl, CURLOPT_HTTPHEADER,
no_pragma_header);
@@ -1059,6 +1057,7 @@ struct http_pack_request *new_http_pack_request(
abort:
free(filename);
+ free(preq->url);
free(preq);
return NULL;
}
@@ -1099,7 +1098,6 @@ struct http_object_request *new_http_object_request(const char *base_url,
char *hex = sha1_to_hex(sha1);
char *filename;
char prevfile[PATH_MAX];
- char *url;
int prevlocal;
unsigned char prev_buf[PREV_BUF_SIZE];
ssize_t prev_read = 0;
@@ -1153,8 +1151,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
git_SHA1_Init(&freq->c);
- url = get_remote_object_url(base_url, hex, 0);
- freq->url = xstrdup(url);
+ freq->url = get_remote_object_url(base_url, hex, 0);
/*
* If a previous temp file is present, process what was already
@@ -1199,7 +1196,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
curl_easy_setopt(freq->slot->curl, CURLOPT_FILE, freq);
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
- curl_easy_setopt(freq->slot->curl, CURLOPT_URL, url);
+ curl_easy_setopt(freq->slot->curl, CURLOPT_URL, freq->url);
curl_easy_setopt(freq->slot->curl, CURLOPT_HTTPHEADER, no_pragma_header);
/*
@@ -1219,9 +1216,9 @@ struct http_object_request *new_http_object_request(const char *base_url,
return freq;
- free(url);
abort:
free(filename);
+ free(freq->url);
free(freq);
return NULL;
}
--
1.6.3.1
^ permalink raw reply related
* Re: give a hint/solution for "It looks like git-am is in progress. Cannot rebase."
From: John Tapsell @ 2009-08-10 15:59 UTC (permalink / raw)
To: Lucian Adrian Grijincu; +Cc: git
In-Reply-To: <acf3f2e60908100734l6388d9a8k90ed835304a69918@mail.gmail.com>
2009/8/10 Lucian Adrian Grijincu <lucian.grijincu@gmail.com>:
> Hi,
>
> I ran git-am instead of git-apply on my repo. The git-am complained
> about the input data, I completely ignored it because I never use
> git-am (except on typos + tab-completions like today).
>
> Later, after a few commits I wanted to rebase (interactively) my tree
> to merge a few commits.
> $ git rebase -i HEAD~4
> It looks like git-am is in progress. Cannot rebase.
>
> Ok, the message is nice, it tells me it can't do something, but I'm
> stupid enough not to know how to proceed.
> I see that this message is the same in HEAD (master and next).
>
> It would be nice if git would output one or two hints. For example:
> * run "git cancel-a-git-am-in-progress" to cancel a git-am in progress
> * run "git commit-the-git-am-in-progress" to commit the git-am in progress
+1
git am --help suggests --abort btw. That would be the most
obvious guess :-)
> Of course, the commands need to be replaced with some valid git
> commands, but I don't know which those commands are :)
>
> The message is generated in git-rebase.sh by this code:
> test -f "$GIT_DIR"/rebase-apply/applying &&
> die 'It looks like git-am is in progress. Cannot rebase.'
>
> For now I think I'll `rm -rf .git/rebase-apply` (and hopefully not
> break anything).
>
> --
> .
> ..: Lucian
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* [PATCH (resend) 1/3] http.c: free preq when aborting
From: Tay Ray Chuan @ 2009-08-10 15:55 UTC (permalink / raw)
To: git, gitster; +Cc: Jeff Lasslett
In-Reply-To: <be6fef0d0908100847h7e9b53a2ofdf318e9958be3b2@mail.gmail.com>
Free preq in new_http_pack_request when aborting. preq was allocated
before jumping to the 'abort' label so this is safe.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---
http.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c
index a2720d5..cfe32f5 100644
--- a/http.c
+++ b/http.c
@@ -1059,6 +1059,7 @@ struct http_pack_request *new_http_pack_request(
abort:
free(filename);
+ free(preq);
return NULL;
}
--
1.6.3.1
^ 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