Re: [PATCH v2 GSoC RFC] diff: allow "-" as a short-hand for "last branch"

2017-03-09 Thread Siddharth Kannan
On Fri, Mar 10, 2017 at 04:52:07AM +, mash wrote: > Maybe you can reuse the diff tests. I'll do another microproject then. Yeah, definitely. If there are more tests required, then I will reuse your ones! > > mash > > The original message doesn't seem to cc the mailing list: Thanks! It was r

[PATCH v2 GSoC RFC] diff: allow "-" as a short-hand for "last branch"

2017-03-09 Thread Siddharth Kannan
Hey, I have already worked on this, and I made the change inside sha1_name.c. The final version of my patch is here[1]. > Handling the dash in sha1_name:get_sha1_basic is not an issue but > git > was designed with the dash in mind for options not for this weird > short-hand so as long as there's

Re: [PATCH GSoC] Allow "-" as a short-hand for "@{-1}" in branch deletions

2017-03-09 Thread Siddharth Kannan
Hey Shuyang, On Thu, Mar 09, 2017 at 09:47:12AM -0800, Stefan Beller wrote: > > The "-" shorthand that stands for "the branch we were previously on", > > like we did for "git merge -" sometime after we introduced "git checkout -". > > Now I am introducing this shorthand to branch delete, i.e. > > "

[PATCH 1/6 v5] revision.c: do not update argv with unknown option

2017-02-24 Thread Siddharth Kannan
provided as argument was unknown to handle_revision_opt(). Signed-off-by: Siddharth Kannan --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index b37dbec..5674a9a 100644 --- a/revision.c +++ b/revision.c @@ -2016,8 +2016,6 @@ static

[PATCH 1/6 v5] revision.c: do not update argv with unknown option

2017-02-24 Thread Siddharth Kannan
provided as argument was unknown to handle_revision_opt(). Signed-off-by: Siddharth Kannan --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index b37dbec..5674a9a 100644 --- a/revision.c +++ b/revision.c @@ -2016,8 +2016,6 @@ static

[PATCH 2/6 v5] revision.c: swap if/else blocks

2017-02-24 Thread Siddharth Kannan
Swap the condition and bodies of an "if (A) do_A else do_B" in setup_revisions() to "if (!A) do_B else do A", to make the change in the the next step easier to read. No behaviour change is intended in this step. Signed-off-by: Siddharth Kannan --- revision.c | 6 +++--

[PATCH 6/6 v5] revert.c: delegate handling of "-" shorthand to setup_revisions

2017-02-24 Thread Siddharth Kannan
been removed. This patch also adds a test to check that revert recognizes the "-" shorthand. Signed-off-by: Siddharth Kannan --- builtin/revert.c| 2 -- t/t3514-revert-shorthand.sh | 25 + 2 files changed, 25 insertions(+), 2 deletions(-) cre

[PATCH 5/6 v5] merge.c: delegate handling of "-" shorthand to revision.c:get_sha1

2017-02-24 Thread Siddharth Kannan
rent : this function calls revision.c:get_sha1 This patch also adds a test for checking that the shorthand works properly Signed-off-by: Siddharth Kannan --- builtin/merge.c | 2 -- t/t3035-merge-hyphen-shorthand.sh | 33 + 2 files changed,

[PATCH 4/6 v5] sha1_name.c: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-24 Thread Siddharth Kannan
this patch. This is something that needs to be fixed later by making changes deeper down the callchain. Signed-off-by: Siddharth Kannan --- sha1_name.c | 5 +++ t/t4214-log-shorthand.sh | 106 +++ 2 files changed, 111 insertions(+) cre

[PATCH 0/6 v5] allow "-" as a shorthand for "previous branch"

2017-02-24 Thread Siddharth Kannan
n.siddhart...@gmail.com [2]: vpqbmu768on@anie.imag.fr [3]: xmqq1sv1euob@gitster.mtv.corp.google.com Siddharth Kannan (6): revision.c: do not update argv with unknown option revision.c: swap if/else blocks revision.c: args starting with "-" might be a revision sha1_name

[PATCH 3/6 v5] revision.c: args starting with "-" might be a revision

2017-02-24 Thread Siddharth Kannan
on to the next argument. This patch prepares the addition of "-" as a shorthand for "previous branch". Signed-off-by: Siddharth Kannan --- revision.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/revision.c b/revision.c index 8d4ddae..5470c33 10064

Re: [PATCH 4/4 v4] sha1_name.c: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-21 Thread Siddharth Kannan
On 21 February 2017 at 02:00, Junio C Hamano wrote: > Siddharth Kannan writes: > > So, is it okay to stop with just supporting "-" and not support things > > like "-@{yesterday}"? > > If the approach to turn "-" into "@{-1}" at that sp

Re: [PATCH 4/4 v4] sha1_name.c: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-20 Thread Siddharth Kannan
; is not an ideal final state, is probably an acceptable milestone to > stop at. So, is it okay to stop with just supporting "-" and not support things like "-@{yesterday}"? Matthieu's comments on the matter: Siddharth Kannan writes: > As per Matthieu'

Re: [PATCH 0/4 v4] WIP: allow "-" as a shorthand for "previous branch"

2017-02-16 Thread Siddharth Kannan
Hey Junio and Matthieu, On 17 February 2017 at 00:19, Junio C Hamano wrote: > Matthieu Moy writes: > >> Siddharth Kannan writes: >> >>> This is as per our discussion[1]. The patches and commit messages are based >>> on >>> J

Re: [PATCH 1/4 v4] revision.c: do not update argv with unknown option

2017-02-16 Thread Siddharth Kannan
Hey Matthieu, On 16 February 2017 at 23:52, Matthieu Moy wrote: > > Indeed, I misread the patch. The explanation could be a little bit more > "tired-reviewer-proof" by not using a past tone, perhaps > > 1. setup_revision, which is changed to ... Oh, okay! Sorry about the confusion! Yes, I used

[PATCH 0/4 v4] WIP: allow "-" as a shorthand for "previous branch"

2017-02-16 Thread Siddharth Kannan
ill have to keep that part intact even in this solution. (I am not too sure about this. If this is the preferred solution, then I will dig deeper and find the right place as I did for the first part of this patch) Matthieu: Thanks a lot for your comments on the tests! test_commit has made the test

[PATCH 1/4 v4] revision.c: do not update argv with unknown option

2017-02-16 Thread Siddharth Kannan
provided as argument was unknown to handle_revision_opt(). Signed-off-by: Siddharth Kannan --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index b37dbec..5674a9a 100644 --- a/revision.c +++ b/revision.c @@ -2016,8 +2016,6 @@ static

[PATCH 3/4 v4] revision.c: args starting with "-" might be a revision

2017-02-16 Thread Siddharth Kannan
on to the next argument. This patch prepares the addition of "-" as a shorthand for "previous branch". Signed-off-by: Siddharth Kannan --- revision.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/revision.c b/revision.c index 8d4ddae..5470c33 10064

[PATCH 4/4 v4] sha1_name.c: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-16 Thread Siddharth Kannan
ds in this list are not of the rm-variety, (i.e a command that would delete something), this change does not make it easier for people to delete. (eg: "git branch -d -" is *not* enabled by this patch) Signed-off-by: Siddharth Kannan --- Instead of replacing the whole string, we would e

[PATCH 2/4 v4] revision.c: swap if/else blocks

2017-02-16 Thread Siddharth Kannan
Swap the condition and bodies of an "if (A) do_A else do_B" in setup_revisions() to "if (!A) do_B else do_A", to make the change in the the next step easier to read. No behaviour change is intended in this step. Signed-off-by: Siddharth Kannan --- revision.c | 6 +++--

Re: [PATCH 1/2 v3] revision.c: args starting with "-" might be a revision

2017-02-13 Thread Siddharth Kannan
remove code that does this shorthand stuff for other commands as per Matthieu's comments) -- Best Regards, Siddharth Kannan.

Re: [PATCH 1/2 v3] revision.c: args starting with "-" might be a revision

2017-02-12 Thread Siddharth Kannan
On Sat, Feb 11, 2017 at 01:08:09PM -0800, Junio C Hamano wrote: > Siddharth Kannan writes: > > > Um, I am sorry, but I feel that decrementing left, and incrementing it > > again is > > also confusing. > > Yes, but it is no more confusing than your original "

Re: [PATCH 2/2 v3] sha1_name: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-12 Thread Siddharth Kannan
Hey Matthieu, On Sun, Feb 12, 2017 at 10:48:56AM +0100, Matthieu Moy wrote: > Siddharth Kannan writes: > > > sha1_name.c | 5 > > t/t4214-log-shorthand.sh | 73 > > > > 2 files changed, 78 inserti

Re: [PATCH 1/2 v3] revision.c: args starting with "-" might be a revision

2017-02-11 Thread Siddharth Kannan
die("bad revision '%s'", arg); > @@ -2255,8 +2261,6 @@ int setup_revisions(int argc, const char **argv, struct > rev_info *revs, struct s > append_prune_data(&prune_data, argv + i); > break; > } > - else > - got_rev_arg = 1; > } > > if (prune_data.nr) { Thanks Junio, for the time you spent analysing and writing the above version of the patch! Regards, - Siddharth Kannan

[PATCH 2/2 v3] sha1_name: teach get_sha1_1 "-" shorthand for "@{-1}"

2017-02-10 Thread Siddharth Kannan
ds in this list are not of the rm-variety, (i.e a command that would delete something), this change does not make it easier for people to delete. (eg: "git branch -d -" is *not* enabled by this patch) Signed-off-by: Siddharth Kannan --- sha1_name.c | 5 t/t4214-l

[PATCH 1/2 v3] revision.c: args starting with "-" might be a revision

2017-02-10 Thread Siddharth Kannan
s starting with "-" and once for arguments that didn't start with "-". Now, it will be called once per argument. This patch prepares the addition of "-" as a shorthand for "previous branch". Signed-off-by: Siddharth Kannan --- revision.c | 12

[PATCH 0/2 v3] WIP: allow "-" as a shorthand for "previous branch"

2017-02-10 Thread Siddharth Kannan
pqh944eof7@anie.imag.fr/#t [2]: https://public-inbox.org/git/can-3qhozn_wyvqbvdu_c1h4vuoat5fobfl7k+femnpqkxjw...@mail.gmail.com/ [3]: https://travis-ci.org/icyflame/git/builds/200431159 Siddharth Kannan (2): revision.c: args starting with "-" might be a revision sha1_name: teach get_sha1

Re: [PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-09 Thread Siddharth Kannan
On 9 February 2017 at 17:55, Matthieu Moy wrote: > >> [...] >> As you might notice, in this list, most commands are not of the `rm` variety, >> i.e. something that would delete stuff. > > OK, I think I'm convinced. I am glad! :) > > Keep the arguments in mind when polishing the commit message.

Re: GSoC 2017: application open, deadline = February 9, 2017

2017-02-09 Thread Siddharth Kannan
On 9 February 2017 at 15:45, Matthieu Moy wrote: > > A non-quoted but yet important part of my initial email was: > > | So, as much as possible, I'd like to avoid being an org admin this > | year. It's not a lot of work (much, much less than being a mentor!), > | but if I manage to get some time t

Re: [PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-08 Thread Siddharth Kannan
Hello Matthieu, On 8 February 2017 at 20:10, Matthieu Moy wrote: > In a previous discussion, I made an analogy with "cd -" (which is the > source of inspiration of this shorthand AFAIK): "-" did not magically > become "the last visited directory" for all Unix commands, just for > "cd". And in thi

[PATCH/RFC v2] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-07 Thread Siddharth Kannan
Teach revision.c:setup_revisions that an argument starting with "-" can be an argument also. `left` variable needs to be incremented only when the supplied arg is neither an argument, nor an option. Teach sha1_name.c:get_sha1_1 that "-" is equivalent to "@{-1}" S

Re: [PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-07 Thread Siddharth Kannan
On Mon, Feb 06, 2017 at 03:09:47PM -0800, Junio C Hamano wrote: > The focus of GSoC being mentoring those who are new to the open > source development, and hopefully retain them in the community after > GSoC is over, we do expect microprojects to be suitable for those > who are new to the codebase.

Re: [PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-06 Thread Siddharth Kannan
n will be a lot more involved, of course, and I > think it will be larger than a reasonable microproject for people > new to the codebase. So true :) I had spent a fair bit of time already on my previous patch, and I thought I might as well complete my research into this, and send this write-up to the mailing list, so that I could write a patch some time later. In case you would prefer for me to not work on this anymore because I am new to the codebase, I will leave it at this. - Siddharth Kannan

Re: [PATCH v3] parse-remote: remove reference to unused op_prep

2017-02-05 Thread Siddharth Kannan
Hey Pranit, On Sun, Feb 05, 2017 at 02:45:46AM +0530, Pranit Bauva wrote: > Hey Siddharth, > > On Sat, Feb 4, 2017 at 8:01 PM, Siddharth Kannan > wrote: > > The error_on_missing_default_upstream helper function learned to > > take op_prep argument with 15a147e618 ("r

Re: [PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-05 Thread Siddharth Kannan
Hey Junio, On Sun, Feb 05, 2017 at 04:15:03PM -0800, Junio C Hamano wrote: > Siddharth Kannan writes: > > > @@ -158,6 +158,51 @@ static void cmd_log_init_finish(int argc, const char > > **argv, const char *prefix, > > > > if (quiet) > >

[PATCH/RFC] WIP: log: allow "-" as a short-hand for "previous branch"

2017-02-05 Thread Siddharth Kannan
ick: allow "-" as abbreviation of '@{-1}', 2013-09-05) and 4e8115ff (merge: allow "-" as a short-hand for "previous branch", 2011-04-07) (c) and (d) have been implemented by using the strbuf API, growing it to the right size and placing "@{-1}"

[PATCH v3] parse-remote: remove reference to unused op_prep

2017-02-04 Thread Siddharth Kannan
nt is no longer used. Remove it. Signed-off-by: Siddharth Kannan --- Thanks a lot for the review, Pranit and Junio! I have made the appropriate changes, and the edit to the file inside contrib/examples/ has been removed from this patch. git-parse-remote.sh | 3 +-- git-rebase.sh | 2 +-

[PATCH v2] parse-remote: Remove reference to unused op_prep

2017-02-04 Thread Siddharth Kannan
nt is no longer used. Remove it. Signed-off-by: Siddharth Kannan --- Thanks a lot, Pranit and Junio for your reviews on the first version of this patch. I have changed the messages accordingly. contrib/examples/git-pull.sh | 2 +- git-parse-remote.sh | 3 +-- git-rebase.sh

[PATCH] git-parse-remote.sh: Remove op_prep argument

2017-02-03 Thread Siddharth Kannan
ropriately Signed-off-by: Siddharth Kannan --- The contrib/examples/git-pull.sh file also has a variable op_prep which is used in one of the messages shown the user. Should I remove this variable as well? contrib/examples/git-pull.sh | 2 +- git-parse-remote.sh | 3 +-- git-rebase.sh