Re: [PATCH][Outreachy] remove all the inclusions of git-compat-util.h in header files

2018-10-08 Thread Ananya Krishna Maram
On Mon, 8 Oct 2018 at 22:43, Derrick Stolee  wrote:
>
> On 10/8/2018 1:05 PM, Ananya Krishna Maram wrote:
> > Hi All,
> Hello, Ananya! Welcome.
>
> > I was searching through #leftovers and found this.
> > https://public-inbox.org/git/cabpp-bgvvxcbzx44er6to-pusfen_6gnyj1u5cuon9deaa4...@mail.gmail.com/
> >
> > This patch address the task discussed in the above link.
> The discussion above seems to not be intended for your commit message,
> but it does show up when I run `git am` and provide your email as input.
> The typical way to avoid this is to place all commentary below the "---"

Sorry, I didn't know that. Shall I re submit the patch with proper commentary.

> that signifies the commit message is over.
> > From: Ananya Krishan Maram 
> >
> > skip the #include of git-compat-util.h since all .c files include it.
> >
> > Signed-off-by: Ananya Krishna Maram 
> > ---
> >   advice.h | 1 -
> >   commit-graph.h   | 1 -
> >   hash.h   | 1 -
> >   pkt-line.h   | 1 -
> >   t/helper/test-tool.h | 1 -
> >   5 files changed, 5 deletions(-)
> >
> > diff --git a/advice.h b/advice.h
> > index ab24df0fd..09148baa6 100644
> > --- a/advice.h
> > +++ b/advice.h
> > @@ -1,7 +1,6 @@
> >   #ifndef ADVICE_H
> >   #define ADVICE_H
> >
> > -#include "git-compat-util.h"
> >
> >   extern int advice_push_update_rejected;
> >   extern int advice_push_non_ff_current;
> > diff --git a/commit-graph.h b/commit-graph.h
> > index b05047676..0e93c2bed 100644
> > --- a/commit-graph.h
> > +++ b/commit-graph.h
> > @@ -1,7 +1,6 @@
> >   #ifndef COMMIT_GRAPH_H
> >   #define COMMIT_GRAPH_H
> >
> > -#include "git-compat-util.h"
> >   #include "repository.h"
> >   #include "string-list.h"
> >   #include "cache.h"
> > diff --git a/hash.h b/hash.h
> > index 7c8238bc2..9a4334c5d 100644
> > --- a/hash.h
> > +++ b/hash.h
> > @@ -1,7 +1,6 @@
> >   #ifndef HASH_H
> >   #define HASH_H
> >
> > -#include "git-compat-util.h"
> >
> >   #if defined(SHA1_PPC)
> >   #include "ppc/sha1.h"
> > diff --git a/pkt-line.h b/pkt-line.h
> > index 5b28d4347..fdd316494 100644
> > --- a/pkt-line.h
> > +++ b/pkt-line.h
> > @@ -1,7 +1,6 @@
> >   #ifndef PKTLINE_H
> >   #define PKTLINE_H
> >
> > -#include "git-compat-util.h"
> >   #include "strbuf.h"
> >
> >   /*
> > diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
> > index e07495727..24e0a1589 100644
> > --- a/t/helper/test-tool.h
> > +++ b/t/helper/test-tool.h
> > @@ -1,7 +1,6 @@
> >   #ifndef __TEST_TOOL_H__
> >   #define __TEST_TOOL_H__
> >
> > -#include "git-compat-util.h"
> >
> >   int cmd__chmtime(int argc, const char **argv);
> >   int cmd__config(int argc, const char **argv);
> I applied these changes locally and confirmed the code compiles, so all
> .c files including these _do_ include git-compat-util.h properly.
>
> Thanks,
> -Stolee
>


[PATCH][Outreachy] remove all the inclusions of git-compat-util.h in header files

2018-10-08 Thread Ananya Krishna Maram
Hi All, 
I was searching through #leftovers and found this.
https://public-inbox.org/git/cabpp-bgvvxcbzx44er6to-pusfen_6gnyj1u5cuon9deaa4...@mail.gmail.com/

This patch address the task discussed in the above link. 

From: Ananya Krishan Maram 

skip the #include of git-compat-util.h since all .c files include it.

Signed-off-by: Ananya Krishna Maram 
---
 advice.h | 1 -
 commit-graph.h   | 1 -
 hash.h   | 1 -
 pkt-line.h   | 1 -
 t/helper/test-tool.h | 1 -
 5 files changed, 5 deletions(-)

diff --git a/advice.h b/advice.h
index ab24df0fd..09148baa6 100644
--- a/advice.h
+++ b/advice.h
@@ -1,7 +1,6 @@
 #ifndef ADVICE_H
 #define ADVICE_H
 
-#include "git-compat-util.h"
 
 extern int advice_push_update_rejected;
 extern int advice_push_non_ff_current;
diff --git a/commit-graph.h b/commit-graph.h
index b05047676..0e93c2bed 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -1,7 +1,6 @@
 #ifndef COMMIT_GRAPH_H
 #define COMMIT_GRAPH_H
 
-#include "git-compat-util.h"
 #include "repository.h"
 #include "string-list.h"
 #include "cache.h"
diff --git a/hash.h b/hash.h
index 7c8238bc2..9a4334c5d 100644
--- a/hash.h
+++ b/hash.h
@@ -1,7 +1,6 @@
 #ifndef HASH_H
 #define HASH_H
 
-#include "git-compat-util.h"
 
 #if defined(SHA1_PPC)
 #include "ppc/sha1.h"
diff --git a/pkt-line.h b/pkt-line.h
index 5b28d4347..fdd316494 100644
--- a/pkt-line.h
+++ b/pkt-line.h
@@ -1,7 +1,6 @@
 #ifndef PKTLINE_H
 #define PKTLINE_H
 
-#include "git-compat-util.h"
 #include "strbuf.h"
 
 /*
diff --git a/t/helper/test-tool.h b/t/helper/test-tool.h
index e07495727..24e0a1589 100644
--- a/t/helper/test-tool.h
+++ b/t/helper/test-tool.h
@@ -1,7 +1,6 @@
 #ifndef __TEST_TOOL_H__
 #define __TEST_TOOL_H__
 
-#include "git-compat-util.h"
 
 int cmd__chmtime(int argc, const char **argv);
 int cmd__config(int argc, const char **argv);
-- 
2.19.0.272.ga00e0029e



Re: [PATCH] [Outreachy] git/userdiff.c fix regex pattern error

2018-10-04 Thread Ananya Krishna Maram
On Thu, 4 Oct 2018 at 20:56, Johannes Schindelin
 wrote:
>
> Hi Ananya,
>
> On Thu, 4 Oct 2018, Ananya Krishna Maram wrote:
>
> > On Thu, 4 Oct 2018 at 19:56, Johannes Schindelin
> >  wrote:
> > >
> > > Hi Ananya,
> > >
> > > thank you for taking the time to write this patch!
> > >
> > > On Thu, 4 Oct 2018, Ananya Krishna Maram wrote:
> > >
> > > > the forward slash character should be escaped with backslash. Fix
> > > > Unescaped forward slash error in Python regex statements.
> > > >
> > > > Signed-off-by: Ananya Krishna Maram
> > >
> > > That explains pretty well what you did, but I wonder why the forward slash
> > > needs to be escaped? I would understand if we enclosed the pattern in
> > > `//`, as it is done e.g. in Javascript, but we do not...
> >
> > You are correct, the code would execute either ways. But when I came across
> > this line, I didn't get it's meaning instantly because as per standards, 
> > forward
> > slash has to be escaped. In fact when open source code is written according 
> > to
> > standards, the code will be reachable to more people.
>
> I am afraid that I do not follow... Regular expressions have quite a few
> special characters, but forward slashes are not among them.
>
> Meaning: if we had specified the regular expression thusly (in any
> language that supports them to be specified in this way):
>
> /|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?/
>
> then I would agree that this is a bug, and needs to be fixed. But we
> specify it as a regular C string:
>
> "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"
>
> In this context, the backslash has an additional, nested meaning: it
> escapes special characters in a C string, too. So writing
>
> "\\"
>
> will actually result in a string consisting of a single backslash. And
>
> "\n"
>
> would specify a string consisting of a single line feed character. Some C
> compilers ignore incorrectly-escaped characters, i.e. "\/" would simply
> expand to the forward slash.
>
> However, you wanted to escape the forward slash in the regular expression.
> To do that, you would have to write
>
> "\\/"
>
> i.e. specifying, in a C string, a backslash character, followed by a
> forward slash character.
>
> However, the regular expression would then be interpreting the backslash
> character as escape character in its own right, seeing the forward slash,
> and replacing this sequence by a forward slash.
>
> But it does not need to be escaped, when you specify the regular
> expression the way we do. And the way we specified it is really the
> standard when specifying regular expressions in C code, i.e. *without* the
> suggested backslash.

Aha!. this makes total sense. I was thinking from a general regular expression
point of view. But I should be thinking from C point of view and how C
might interpret this newly submitted string.
This explanation is very clear. Thanks for taking time to reply to my
patch. From next time on, I will try to think from
git project's point of view.

Thanks,
Ananya.

> Ciao,
> Johannes
>
> >
> > Thanks,
> > Ananya.
> >
> > > Thanks,
> > > Johannes
> > >
> > > > ---
> > > >  userdiff.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/userdiff.c b/userdiff.c
> > > > index f565f6731..f4ff9b9e5 100644
> > > > --- a/userdiff.c
> > > > +++ b/userdiff.c
> > > > @@ -123,7 +123,7 @@ PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
> > > >/* -- */
> > > >"[a-zA-Z_][a-zA-Z0-9_]*"
> > > >"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
> > > > -  "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
> > > > +  "|[-+*\/<>%&^|=!]=|\/\/=?|<<=?|>>=?|\\*\\*=?"),
> > > >/* -- */
> > > >  PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
> > > >/* -- */
> > > > --
> > > > 2.17.1
> > > >
> > > >
> >


Re: [PATCH] [Outreachy] git/userdiff.c fix regex pattern error

2018-10-04 Thread Ananya Krishna Maram
On Thu, 4 Oct 2018 at 19:56, Johannes Schindelin
 wrote:
>
> Hi Ananya,
>
> thank you for taking the time to write this patch!
>
> On Thu, 4 Oct 2018, Ananya Krishna Maram wrote:
>
> > the forward slash character should be escaped with backslash. Fix
> > Unescaped forward slash error in Python regex statements.
> >
> > Signed-off-by: Ananya Krishna Maram
>
> That explains pretty well what you did, but I wonder why the forward slash
> needs to be escaped? I would understand if we enclosed the pattern in
> `//`, as it is done e.g. in Javascript, but we do not...

You are correct, the code would execute either ways. But when I came across
this line, I didn't get it's meaning instantly because as per standards, forward
slash has to be escaped. In fact when open source code is written according to
standards, the code will be reachable to more people.

Thanks,
Ananya.

> Thanks,
> Johannes
>
> > ---
> >  userdiff.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/userdiff.c b/userdiff.c
> > index f565f6731..f4ff9b9e5 100644
> > --- a/userdiff.c
> > +++ b/userdiff.c
> > @@ -123,7 +123,7 @@ PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
> >/* -- */
> >"[a-zA-Z_][a-zA-Z0-9_]*"
> >"|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
> > -  "|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
> > +  "|[-+*\/<>%&^|=!]=|\/\/=?|<<=?|>>=?|\\*\\*=?"),
> >/* -- */
> >  PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
> >/* -- */
> > --
> > 2.17.1
> >
> >


[PATCH] [Outreachy] git/userdiff.c fix regex pattern error

2018-10-04 Thread Ananya Krishna Maram
the forward slash character should be escaped with backslash. Fix
Unescaped forward slash error in Python regex statements.

Signed-off-by: Ananya Krishna Maram
---
 userdiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/userdiff.c b/userdiff.c
index f565f6731..f4ff9b9e5 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -123,7 +123,7 @@ PATTERNS("python", "^[ \t]*((class|def)[ \t].*)$",
 /* -- */
 "[a-zA-Z_][a-zA-Z0-9_]*"
 "|[-+0-9.e]+[jJlL]?|0[xX]?[0-9a-fA-F]+[lL]?"
-"|[-+*/<>%&^|=!]=|//=?|<<=?|>>=?|\\*\\*=?"),
+"|[-+*\/<>%&^|=!]=|\/\/=?|<<=?|>>=?|\\*\\*=?"),
 /* -- */
 PATTERNS("ruby", "^[ \t]*((class|module|def)[ \t].*)$",
 /* -- */
-- 
2.17.1



[Outreachy] Introduce myself

2018-09-30 Thread Ananya Krishna Maram
Hi Git Community, Christian and Johannes,

My initial Outreachy got accepted. My name is Ananya Krishna(her), I
am from south India. I completed my under-graduation. Due to some
problems, I decided to stay back at home. And currently I would like
to dedicate myself to learn from open communities.

During the school, I showed keen interest in operating systems and
implemented most of the scheduling, synchronization and some sample
examples in memory management. I also did a lot of assignments in bash
scripting. In my 3rd year of Btech, I was introduced to this magical
tool `git` and got flattened by how it made me to keep track of
versions of my assignments. Having done a lot of assignment in C and
bash scripting and keen interest to learn about working of git
internals, I choose to contribute to this project. So I started
observing the patches sent to git mailing list.

I am currently looking for first patch opportunities to git. I came
across[1] and I will try to put maximum effort towards my goal and if
I need some clarification of the problem statement I guess you guys or
Outreachy mentors will be here to help me.

Thanks,
Ananya.


 [1](https://git.github.io/SoC-2018-Microprojects/)