Re: What's cooking in git.git (Jul 2017, #09; Mon, 31)

2017-08-03 Thread Sahil Dua
> > * sd/branch-copy (2017-06-18) 3 commits > (merged to 'next' on 2017-07-18 at 5e3b9357ea) > + branch: add a --copy (-c) option to go with --move (-m) > + branch: add test for -m renaming multiple config sections > + config: create a function to format section headers > > "git branch"

Re: What's cooking in git.git (Jul 2017, #09; Mon, 31)

2017-08-03 Thread Sahil Dua
Ah! I had skipped this reply from Ramsay earlier. On Tue, Aug 1, 2017 at 1:36 AM, Ramsay Jones wrote: > > > On 31/07/17 23:30, Junio C Hamano wrote: > [snip] >> >> * sd/branch-copy (2017-06-18) 3 commits >> (merged to 'next' on 2017-07-18 at 5e3b9357ea) >> +

Re: [PATCH v2 1/3] config: create a function to format section headers

2017-06-19 Thread Sahil Dua
On Mon, Jun 19, 2017 at 2:08 PM, Ramsay Jones <ram...@ramsayjones.plus.com> wrote: > > > On 18/06/17 22:16, Sahil Dua wrote: >> Factor out the logic which creates section headers in the config file, >> e.g. the 'branch.foo' key will be turned into '[branch &qu

[PATCH] branch test: fix invalid config key access

2017-05-28 Thread Sahil Dua
Earlier it was trying to access invalid config key and hence was getting an error. However, this wasn't caught because we were expecting the command to fail for other reason as mentioned above. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.sh | 2 +- 1 file chan

Re: [PATCH/RFC] branch: add tests for new copy branch feature

2017-05-29 Thread Sahil Dua
ch and create a new branch with name "new-branch". On Mon, May 29, 2017 at 4:09 AM, Junio C Hamano <gits...@pobox.com> wrote: > > Sahil Dua <sahildua2...@gmail.com> writes: > > > New feature - copying a branch along with its config section. > > That's

Re: [PATCH/RFC] branch: add tests for new copy branch feature

2017-05-29 Thread Sahil Dua
On Mon, May 29, 2017 at 1:30 AM, Ævar Arnfjörð Bjarmason <ava...@gmail.com> wrote: > On Mon, May 29, 2017 at 12:56 AM, Sahil Dua <sahildua2...@gmail.com> wrote: >> New feature - copying a branch along with its config section. >> >> Aim is to have an option -c

[PATCH/RFC] branch: add tests for new copy branch feature

2017-05-28 Thread Sahil Dua
New feature - copying a branch along with its config section. Aim is to have an option -c for copying a branch just like -m option for renaming a branch. This commit adds a few basic tests for getting any suggestions/feedback about expected behavior for this new feature. Signed-off-by: Sahil

Re: [PATCH/RFC] branch: add tests for new copy branch feature

2017-05-29 Thread Sahil Dua
On Mon, May 29, 2017 at 10:50 PM, Ævar Arnfjörð Bjarmason <ava...@gmail.com> wrote: > On Mon, May 29, 2017 at 10:41 PM, Sahil Dua <sahildua2...@gmail.com> wrote: >> On Mon, May 29, 2017 at 1:30 AM, Ævar Arnfjörð Bjarmason >> <ava...@gmail.com> wrote: >>> O

[PATCH/RFC v2 2/6] branch: add copy branch option

2017-05-31 Thread Sahil Dua
of other files wherever the renamed functions were used. By default copy=0 is passed at all those places so that they keep behaving the way they were, before these changes. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- builtin/branch.c

[PATCH/RFC v2 4/6] config: modify function signature to include copy argument

2017-05-31 Thread Sahil Dua
he renamed and updated functions were being used. Default value of copy=0 is passed at all those places in order to make sure the behavior of the functions doesn't change for those cases. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- builtin/branch.c | 4 ++-- builtin/config.c | 4 ++--

[PATCH/RFC v2 1/6] branch: add tests for new copy branch feature

2017-05-31 Thread Sahil Dua
Adds a few basic tests for getting any suggestions/feedback about expected behavior for this new feature. Aim is to have an option -c for copying a branch just like -m option for renaming a branch. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.s

[PATCH/RFC v2 6/6] branch: don't copy or rename config when same branch name

2017-05-31 Thread Sahil Dua
It doesn't make sense to trigger config section copy or rename method if both the branch names are same. For example - git branch -C a a In such a case, it shouldn't try to copy or rename the git config section. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- builtin/branch.c | 2

[PATCH/RFC v2 3/6] config: abstract out create section from key logic

2017-05-31 Thread Sahil Dua
get [branch "bar"] from "branch.bar" key. 'store_create_section' function will return [branch "bar"] when "branch.bar" is passed. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) dif

[PATCH/RFC v2 5/6] config: add copy config section logic

2017-05-31 Thread Sahil Dua
copying the config section from branch1 to branch2. However, there's one case which is not handled by this yet - when branch2 already has some configuration and -C command is used, operation should delete the present configuration for branch2. Signed-off-by: Sahil Dua <sahildua2...@gmail.

Re: [PATCH/RFC v2 2/6] branch: add copy branch option

2017-06-01 Thread Sahil Dua
On Thu, Jun 1, 2017 at 3:50 AM, Junio C Hamano <gits...@pobox.com> wrote: > Sahil Dua <sahildua2...@gmail.com> writes: > >> Adds copy branch option available using -c or -C (forcefully). >> >> Includes a lot of function renames and their signature changes in

[PATCH/RFC v3 1/3] branch: add tests for new copy branch feature

2017-06-01 Thread Sahil Dua
he same branch as "git push on topic-1 branch would. 4. "git branch -c new-branch" should copy the currently checked out branch and create a new branch with name "new-branch". Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.sh | 100 ++

[PATCH/RFC v3 2/3] config: abstract out create section from key logic

2017-06-01 Thread Sahil Dua
get [branch "bar"] from "branch.bar" key. 'store_create_section' function will return [branch "bar"] when "branch.bar" is passed. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) dif

[PATCH/RFC v3 3/3] branch: add copy branch feature implementation

2017-06-01 Thread Sahil Dua
the present configuration for branch2. Also, it doesn't make sense to trigger config section copy config section function if both the branch names are same. For example - git branch -C a a In such a case, it shouldn't try to copy or rename the git config section. Signed-off-by: Sahil Dua <sahild

Re: [PATCH/RFC v3 3/3] branch: add copy branch feature implementation

2017-06-01 Thread Sahil Dua
On Thu, Jun 1, 2017 at 8:59 PM, Ævar Arnfjörð Bjarmason <ava...@gmail.com> wrote: > > On Thu, Jun 1, 2017 at 8:35 PM, Sahil Dua <sahildua2...@gmail.com> wrote: > > Adds copy branch option available using -c or -C (forcefully). > > Commenting on the series in general.

Re: [PATCH/RFC v4 3/3] branch: add copy branch feature implementation

2017-06-06 Thread Sahil Dua
On Tue, Jun 6, 2017 at 9:39 AM, Ævar Arnfjörð Bjarmason <ava...@gmail.com> wrote: > On Tue, Jun 6, 2017 at 2:10 AM, Junio C Hamano <gits...@pobox.com> wrote: >> Sahil Dua <sahildua2...@gmail.com> writes: >> >>> I want suggestions about one logical po

Re: [PATCH] t3200: add test for single parameter passed to -m option

2017-06-06 Thread Sahil Dua
On Tue, Jun 6, 2017 at 3:27 AM, Junio C Hamano <gits...@pobox.com> wrote: > Sahil Dua <sahildua2...@gmail.com> writes: > >> Adds a test for the case when only one parameter is passed to '-m' >> (move/rename) option. >> >> For example - if 'g

[PATCH v3] t3200: add test for single parameter passed to -m option

2017-06-13 Thread Sahil Dua
on reflog for bbb will be about branch creation, we compare bbb@{1} (instead of bbb@{0}) with aaa@{0} to make sure the reflog for bbb retains entries from aaa. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.sh | 17 + 1 file changed, 17 insertions(+) diff --g

Re: Subject: [PATCH] config: mark a file-local symbol as static

2017-06-17 Thread Sahil Dua
Hi Ramsay, Thanks for noticing. I will squash this into the relevant patch. Also, git_config_copy_section_in_file() and refs_copy_existing_ref() don't need to be available in public API. Regards Sahil Dua Graduate Software Developer Booking.com Connect on LinkedIn www.sahildua.com On Thu, Jun

Re: Subject: [PATCH] config: mark a file-local symbol as static

2017-06-17 Thread Sahil Dua
On Sat, Jun 17, 2017 at 11:40 PM, Sahil Dua <sahildua2...@gmail.com> wrote: > Hi Ramsay, > > Thanks for noticing. I will squash this into the relevant patch. > > Also, git_config_copy_section_in_file() and refs_copy_existing_ref() > don't need to be available

Re: [PATCH 3/3] branch: add a --copy (-c) option to go with --move (-m)

2017-06-14 Thread Sahil Dua
On Tue, Jun 13, 2017 at 7:30 PM, Junio C Hamano <gits...@pobox.com> wrote: > Junio C Hamano <gits...@pobox.com> writes: > >> Sahil Dua <sahildua2...@gmail.com> writes: >> >>> Add the ability to --copy a branch and its reflog and configuration

[PATCH v2 1/3] config: create a function to format section headers

2017-06-18 Thread Sahil Dua
f-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed-off-by: Ramsay Jones <ram...@ramsayjones.plus.com> Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- config.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c i

[PATCH v2 2/3] branch: add test for -m renaming multiple config sections

2017-06-18 Thread Sahil Dua
g when editing the file with git-config. This adds a test for the currently expected semantics in the face of some rather obscure edge cases which are unlikely to occur in practice. Helped-by: Sahil Dua <sahildua2...@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed

[PATCH v2 3/3] branch: add a --copy (-c) option to go with --move (-m)

2017-06-18 Thread Sahil Dua
ect. What to do about that is left to a future change. Helped-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- Documentation/git-branch.txt | 14 ++- builti

[PATCH v2] t3200: add test for single parameter passed to -m option

2017-06-11 Thread Sahil Dua
similar test case for -M option. Add test for making sure HEAD points to the bbb (new branch name). Also add a test for making sure the reflog that is moved to 'bbb' retains entries created for the currently checked out branch. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-bra

[PATCH 3/3] branch: add a --copy (-c) option to go with --move (-m)

2017-06-13 Thread Sahil Dua
change. Helped-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed-off-by: Sahil Dua <sahildua2...@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> --- Documentation/git-branch.txt | 14 ++- builtin/branch.c | 67 ++ cache.h

[PATCH 1/3] config: create a function to format section headers

2017-06-13 Thread Sahil Dua
Factor out the logic which creates section headers in the config file, e.g. the 'branch.foo' key will be turned into '[branch "foo"]'. This introduces no function changes, but is needed for a later change which adds support for copying branch sections in the config file. Signed-off-by:

[PATCH 2/3] branch: add test for -m renaming multiple config sections

2017-06-13 Thread Sahil Dua
g when editing the file with git-config. This adds a test for the currently expected semantics in the face of some rather obscure edge cases which are unlikely to occur in practice. Helped-by: Sahil Dua <sahildua2...@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <ava...@gmail.com> Signed

Re: [PATCH/RFC v4 3/3] branch: add copy branch feature implementation

2017-06-05 Thread Sahil Dua
change the behavior. On Mon, Jun 5, 2017 at 10:40 PM, Sahil Dua <sahildua2...@gmail.com> wrote: > Adds copy branch option available using -c or -C (forcefully). > > Adds new function copy_existing_ref to copy the ref and > git_config_copy_section to copy the git config secti

[PATCH/RFC v4 3/3] branch: add copy branch feature implementation

2017-06-05 Thread Sahil Dua
comment style, and not C++ comments... - fixup bad i18n usage This interpolation of English words with sprintf resulted in untranslatable strings. - fixup mixed code/decl warning Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- builtin/branch.c

[PATCH/RFC v4 1/3] branch: add tests for new copy branch feature

2017-06-05 Thread Sahil Dua
he same branch as "git push on topic-1 branch would. 4. "git branch -c new-branch" should copy the currently checked out branch and create a new branch with name "new-branch". Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.sh | 100 ++

[PATCH/RFC v4 2/3] config: abstract out create section from key logic

2017-06-05 Thread Sahil Dua
get [branch "bar"] from "branch.bar" key. 'store_create_section' function will return [branch "bar"] when "branch.bar" is passed. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) dif

[PATCH] t3200: add test for single parameter passed to -m option

2017-06-05 Thread Sahil Dua
similar test case for -M option. Signed-off-by: Sahil Dua <sahildua2...@gmail.com> --- t/t3200-branch.sh | 8 1 file changed, 8 insertions(+) diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index fe62e7c775da6..7504f14bc52f8 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-bra

Re: What's cooking in git.git (Sep 2017, #03; Fri, 15)

2017-09-21 Thread Sahil Dua
> > * sd/branch-copy (2017-06-18) 3 commits > - branch: add a --copy (-c) option to go with --move (-m) > - branch: add test for -m renaming multiple config sections > - config: create a function to format section headers > > "git branch" learned "-c/-C" to create and switch to a new branch >

Re: What's cooking in git.git (Sep 2017, #03; Fri, 15)

2017-09-24 Thread Sahil Dua
eckout -b c1 && > git branch c2 && > git branch -C c1 c2 && > - test $(git rev-parse --abbrev-ref HEAD) = c2 > + test $(git rev-parse --abbrev-ref HEAD) = c1 > ' > > -test_expect_success 'git branch -C c1 c2 should add entries to > .git/logs/HEAD' ' > +test_expect_success 'git branch -C c1 c2 should never touch HEAD' ' > msg="Branch: copied refs/heads/c1 to refs/heads/c2" && > - grep "$msg$" .git/logs/HEAD > + ! grep "$msg$" .git/logs/HEAD > ' > > test_expect_success 'git branch -C master should work when master is checked > out' ' > -- > 2.14.1-907-g5aa63875cf > > > -- Regards Sahil Dua Software Developer Booking.com Connect on LinkedIn www.sahildua.com