* [RESEND PATCH] fast-import: Cleanup mode setting.
@ 2009-01-14 1:37 Felipe Contreras
2009-01-14 2:08 ` Johannes Schindelin
2009-01-14 2:16 ` Shawn O. Pearce
0 siblings, 2 replies; 8+ messages in thread
From: Felipe Contreras @ 2009-01-14 1:37 UTC (permalink / raw)
To: git; +Cc: Shawn O. Pearce, Johannes Schindelin, Miklos Vajna,
Felipe Contreras
"S_IFREG | mode" probably is only required for 0644 and 0755.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
fast-import.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index a6bce66..f0e08ac 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1872,12 +1872,13 @@ static void file_change_m(struct branch *b)
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
+ case 0644:
+ case 0755:
+ mode |= S_IFREG;
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
- case 0644:
- case 0755:
/* ok */
break;
default:
@@ -1944,7 +1945,7 @@ static void file_change_m(struct branch *b)
typename(type), command_buf.buf);
}
- tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
+ tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
}
static void file_change_d(struct branch *b)
--
1.6.0.6.5.ga66c
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 1:37 [RESEND PATCH] fast-import: Cleanup mode setting Felipe Contreras
@ 2009-01-14 2:08 ` Johannes Schindelin
2009-01-14 2:17 ` Shawn O. Pearce
2009-01-14 2:16 ` Shawn O. Pearce
1 sibling, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2009-01-14 2:08 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git, Shawn O. Pearce, Miklos Vajna
Hi,
On Wed, 14 Jan 2009, Felipe Contreras wrote:
> "S_IFREG | mode" probably is only required for 0644 and 0755.
Why should we want to have that patch? IOW what does it fix, and what
might it break?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 1:37 [RESEND PATCH] fast-import: Cleanup mode setting Felipe Contreras
2009-01-14 2:08 ` Johannes Schindelin
@ 2009-01-14 2:16 ` Shawn O. Pearce
1 sibling, 0 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2009-01-14 2:16 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git, Johannes Schindelin, Miklos Vajna
Felipe Contreras <felipe.contreras@gmail.com> wrote:
> "S_IFREG | mode" probably is only required for 0644 and 0755.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
> ---
> fast-import.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fast-import.c b/fast-import.c
> index a6bce66..f0e08ac 100644
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -1872,12 +1872,13 @@ static void file_change_m(struct branch *b)
> if (!p)
> die("Corrupt mode: %s", command_buf.buf);
> switch (mode) {
> + case 0644:
> + case 0755:
> + mode |= S_IFREG;
> case S_IFREG | 0644:
> case S_IFREG | 0755:
> case S_IFLNK:
> case S_IFGITLINK:
> - case 0644:
> - case 0755:
> /* ok */
> break;
> default:
> @@ -1944,7 +1945,7 @@ static void file_change_m(struct branch *b)
> typename(type), command_buf.buf);
> }
>
> - tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
> + tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
> }
>
> static void file_change_d(struct branch *b)
> --
> 1.6.0.6.5.ga66c
>
--
Shawn.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 2:08 ` Johannes Schindelin
@ 2009-01-14 2:17 ` Shawn O. Pearce
2009-01-14 2:28 ` Johannes Schindelin
0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-01-14 2:17 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Felipe Contreras, git, Miklos Vajna
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Wed, 14 Jan 2009, Felipe Contreras wrote:
>
> > "S_IFREG | mode" probably is only required for 0644 and 0755.
>
> Why should we want to have that patch? IOW what does it fix, and what
> might it break?
It cleans up the code to make it more readable.
It makes no sense to be doing S_IFREG | S_IFLINK, which happens when
the input is for a symlink. It doesn't break anything to do that |
operation, but it also looks damn odd when reading the function.
--
Shawn.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 2:17 ` Shawn O. Pearce
@ 2009-01-14 2:28 ` Johannes Schindelin
2009-01-14 2:29 ` Shawn O. Pearce
0 siblings, 1 reply; 8+ messages in thread
From: Johannes Schindelin @ 2009-01-14 2:28 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Felipe Contreras, git, Miklos Vajna
Hi,
On Tue, 13 Jan 2009, Shawn O. Pearce wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > On Wed, 14 Jan 2009, Felipe Contreras wrote:
> >
> > > "S_IFREG | mode" probably is only required for 0644 and 0755.
> >
> > Why should we want to have that patch? IOW what does it fix, and what
> > might it break?
>
> It cleans up the code to make it more readable.
>
> It makes no sense to be doing S_IFREG | S_IFLINK, which happens when
> the input is for a symlink. It doesn't break anything to do that |
> operation, but it also looks damn odd when reading the function.
Imagining myself reading the commit message 6 months from now, in all
likeliness I will have wished that those two paragraphs were in there.
Verbatim.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 2:28 ` Johannes Schindelin
@ 2009-01-14 2:29 ` Shawn O. Pearce
2009-01-14 2:46 ` Felipe Contreras
0 siblings, 1 reply; 8+ messages in thread
From: Shawn O. Pearce @ 2009-01-14 2:29 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Felipe Contreras, git, Miklos Vajna
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> On Tue, 13 Jan 2009, Shawn O. Pearce wrote:
> >
> > It cleans up the code to make it more readable.
> >
> > It makes no sense to be doing S_IFREG | S_IFLINK, which happens when
> > the input is for a symlink. It doesn't break anything to do that |
> > operation, but it also looks damn odd when reading the function.
>
> Imagining myself reading the commit message 6 months from now, in all
> likeliness I will have wished that those two paragraphs were in there.
> Verbatim.
Maybe Junio or Felipe can copy it into the message.
Or you can use a git note now to attach it to the commit Junio
hasn't yet created, so you can look it up in the future. :-)
--
Shawn.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 2:29 ` Shawn O. Pearce
@ 2009-01-14 2:46 ` Felipe Contreras
2009-01-14 2:51 ` Shawn O. Pearce
0 siblings, 1 reply; 8+ messages in thread
From: Felipe Contreras @ 2009-01-14 2:46 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Johannes Schindelin, git, Miklos Vajna
[-- Attachment #1: Type: text/plain, Size: 1025 bytes --]
On Wed, Jan 14, 2009 at 4:29 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> On Tue, 13 Jan 2009, Shawn O. Pearce wrote:
>> >
>> > It cleans up the code to make it more readable.
>> >
>> > It makes no sense to be doing S_IFREG | S_IFLINK, which happens when
>> > the input is for a symlink. It doesn't break anything to do that |
>> > operation, but it also looks damn odd when reading the function.
>>
>> Imagining myself reading the commit message 6 months from now, in all
>> likeliness I will have wished that those two paragraphs were in there.
>> Verbatim.
>
> Maybe Junio or Felipe can copy it into the message.
>
> Or you can use a git note now to attach it to the commit Junio
> hasn't yet created, so you can look it up in the future. :-)
How about the attached patch?
"S_IFREG | mode" probably is only required for 0644 and 0755.
It doesn't make sense to do S_IFREG | S_IFLINK (0100000 | 0120000),
since no bits are changed.
--
Felipe Contreras
[-- Attachment #2: 0001-fast-import-Cleanup-mode-setting.patch --]
[-- Type: application/octet-stream, Size: 1324 bytes --]
From 2eee342bb2613a3378ea05d22ecdcc31e58f2e22 Mon Sep 17 00:00:00 2001
From: Felipe Contreras <felipe.contreras@gmail.com>
Date: Mon, 22 Dec 2008 04:13:59 +0200
Subject: [PATCH] fast-import: Cleanup mode setting.
"S_IFREG | mode" probably is only required for 0644 and 0755.
It doesn't make sense to do S_IFREG | S_IFLINK (0100000 | 0120000),
since no bits are changed.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
fast-import.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index a6bce66..f0e08ac 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1872,12 +1872,13 @@ static void file_change_m(struct branch *b)
if (!p)
die("Corrupt mode: %s", command_buf.buf);
switch (mode) {
+ case 0644:
+ case 0755:
+ mode |= S_IFREG;
case S_IFREG | 0644:
case S_IFREG | 0755:
case S_IFLNK:
case S_IFGITLINK:
- case 0644:
- case 0755:
/* ok */
break;
default:
@@ -1944,7 +1945,7 @@ static void file_change_m(struct branch *b)
typename(type), command_buf.buf);
}
- tree_content_set(&b->branch_tree, p, sha1, S_IFREG | mode, NULL);
+ tree_content_set(&b->branch_tree, p, sha1, mode, NULL);
}
static void file_change_d(struct branch *b)
--
1.6.0.6.5.ga66c
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH] fast-import: Cleanup mode setting.
2009-01-14 2:46 ` Felipe Contreras
@ 2009-01-14 2:51 ` Shawn O. Pearce
0 siblings, 0 replies; 8+ messages in thread
From: Shawn O. Pearce @ 2009-01-14 2:51 UTC (permalink / raw)
To: Felipe Contreras; +Cc: Johannes Schindelin, git, Miklos Vajna
Felipe Contreras <felipe.contreras@gmail.com> wrote:
>
> How about the attached patch?
>
> "S_IFREG | mode" probably is only required for 0644 and 0755.
>
> It doesn't make sense to do S_IFREG | S_IFLINK (0100000 | 0120000),
> since no bits are changed.
Looks fine to me.
--
Shawn.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-01-14 2:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-14 1:37 [RESEND PATCH] fast-import: Cleanup mode setting Felipe Contreras
2009-01-14 2:08 ` Johannes Schindelin
2009-01-14 2:17 ` Shawn O. Pearce
2009-01-14 2:28 ` Johannes Schindelin
2009-01-14 2:29 ` Shawn O. Pearce
2009-01-14 2:46 ` Felipe Contreras
2009-01-14 2:51 ` Shawn O. Pearce
2009-01-14 2:16 ` Shawn O. Pearce
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).