[PATCH] branch test: fix invalid config key access

2017-05-28 Thread Sahil Dua
t;. 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 --- t/t3200-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 del

[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
checked out branch and create a new branch with name "new-branch". On Mon, May 29, 2017 at 4:09 AM, Junio C Hamano wrote: > > Sahil Dua writes: > > > New feature - copying a branch along with its config section. > > That's an unusual non-sentence (without a verb) in

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 wrote: > On Mon, May 29, 2017 at 12:56 AM, Sahil Dua wrote: >> 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 >> re

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 wrote: > On Mon, May 29, 2017 at 10:41 PM, Sahil Dua wrote: >> On Mon, May 29, 2017 at 1:30 AM, Ævar Arnfjörð Bjarmason >> wrote: >>> On Mon, May 29, 2017 at 12:56 AM, Sahil Dua wrote: >>>> New featu

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

2017-05-31 Thread Sahil Dua
ur copied section. Hence, literally 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. Sign

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

2017-05-31 Thread Sahil Dua
nges a lot 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 --- builtin/branch.c | 48 +++ builti

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

2017-05-31 Thread Sahil Dua
enamed 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 --- builtin/branch.c | 4 ++-- builtin/config.c | 4 ++-- builtin/remote.c |

[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 --- t/t3200-branch.sh | 53

[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 --- builtin/branch.c | 2 +- 1 file changed, 1

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

2017-05-31 Thread Sahil Dua
o"] intact and 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 --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletion

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 wrote: > Sahil Dua writes: > >> Adds copy branch option available using -c or -C (forcefully). >> >> Includes a lot of function renames and their signature changes in order >> to introduce a new function parameter

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

2017-06-01 Thread Sahil Dua
push to the 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 --- t/t3200-branch.sh | 100 ++

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

2017-06-01 Thread Sahil Dua
o"] intact and 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 --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletion

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

2017-06-01 Thread Sahil Dua
and is used, operation should delete 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 confi

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 wrote: > > On Thu, Jun 1, 2017 at 8:35 PM, Sahil Dua wrote: > > Adds copy branch option available using -c or -C (forcefully). > > Commenting on the series in general. I have a fixup branch for you > with commi

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

2017-06-05 Thread Sahil Dua
push to the 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 --- t/t3200-branch.sh | 100 ++

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

2017-06-05 Thread Sahil Dua
nfig section. fixups by avar: - fixup: use git 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 --- builtin/branch.c |

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

2017-06-05 Thread Sahil Dua
o"] intact and 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 --- config.c | 14 -- 1 file changed, 12 insertions(+), 2 deletion

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

2017-06-05 Thread Sahil Dua
be changed, can someone please point me to how it's being handled so that I can change the behavior. On Mon, Jun 5, 2017 at 10:40 PM, Sahil Dua wrote: > Adds copy branch option available using -c or -C (forcefully). > > Adds new function copy_existing_ref to cop

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

2017-06-05 Thread Sahil Dua
However, there's one similar test case for -M option. Signed-off-by: Sahil Dua --- 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-br

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 wrote: > Sahil Dua writes: > >> Adds a test for the case when only one parameter is passed to '-m' >> (move/rename) option. >> >> For example - if 'git branch -m bbb' is run, it should rename the &g

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 wrote: > On Tue, Jun 6, 2017 at 2:10 AM, Junio C Hamano wrote: >> Sahil Dua writes: >> >>> I want suggestions about one logical point raised by Evar. >>> >>> Let's consider a case that I&#x

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

2017-06-11 Thread Sahil Dua
However, there's one 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 --- t/t32

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

2017-06-13 Thread Sahil Dua
ote that since the topmost entry 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 --- t/t3200-branch.sh | 17 + 1 file changed, 17 insertions(+) diff

[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 f

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

2017-06-13 Thread Sahil Dua
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 Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Sahil Dua --- t/t3200-bran

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

2017-06-13 Thread Sahil Dua
o do about that is left to a future change. Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Sahil Dua Signed-off-by: Ævar Arnfjörð Bjarmason --- Documentation/git-branch.txt | 14 ++- builtin/branch.c | 67 ++ cache.h | 2 + config.c

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 wrote: > Junio C Hamano writes: > >> Sahil Dua writes: >> >>> Add the ability to --copy a branch and its reflog and configuration, >>> this uses the same underlying machinery as the --move (-m) option >&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

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 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 in public API. I noticed that git_conf

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

2017-06-18 Thread Sahil Dua
fig file. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Ramsay Jones Signed-off-by: Sahil Dua --- config.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config.c b/config.c index 34a139c..32fd3c8 100644 --- a/config.c +++ b/config.c @@ -2169,10 +2169,10 @

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

2017-06-18 Thread Sahil Dua
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 Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Sahil Dua --- Changes * Use 'sed -n -e'

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

2017-06-18 Thread Sahil Dua
ad of master, as the user might expect. What to do about that is left to a future change. Helped-by: Ævar Arnfjörð Bjarmason Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Sahil Dua --- Documentation/git-branch.txt | 14 ++- builtin/branch.c | 67 ++ cac

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 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 "foo"]'. >>

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" learn

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) >> + branch: add a --copy (-c) option to

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
checked out' > git checkout -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