builtin/checkout: Fix message when switching to an existing branch
PATCH 1/1 builtin/checkout: Fix message when switching to an existing branch
Fix "Switched to a new branch <name>" to read "Switched to branch <name>" when <name> corresponds to an existing branch. This bug was introduced in 02ac983 while introducing the -B switch.
--- builtin/checkout.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
builtin/checkout.c +4 -1
@@ -545,10 +545,13 @@ static void update_refs_for_switch(struct checkout_opts *opts,if (old->path && !strcmp (new->path, old->path))fprintf (stderr,"Already on '%s'\n" , new->name); -else +else if (opts->new_branch)fprintf (stderr,"Switched to%s branch '%s'\n" , opts->branch_exists ?" and reset" :" a new" , new->name); +else +fprintf (stderr,"Switched to branch '%s'\n" , + new->name); }if (old->path && old->name) {char log_file[PATH_MAX ], ref_file[PATH_MAX ];
Signature · 1 line
1.7.2.2.408.g7357
Quoted 9 lines · Ramkumar Ramachandra
builtin/checkout.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)builtin/checkout.c +0
-0@@ -545,10 +545,13 @@ static void update_refs_for_switch(struct checkout_opts *opts, if (old->path && !strcmp(new->path, old->path))
builtin/checkout.c static void update_refs_for_switch(struct checkout_opts *opts, · line 554
Quoted 10 lines
builtin/checkout.c +4
-1fprintf(stderr, "Already on '%s'\n", new->name); - else + else if (opts->new_branch) fprintf(stderr, "Switched to%s branch '%s'\n", opts->branch_exists ? " and reset" : " a new", new->name); + else + fprintf(stderr, "Switched to branch '%s'\n", + new->name);
On a closer reading, I realise that "reset" isn't mentioned if the branch exists.
The terser ternary version doesn't suffer from this defect.
Signature · 2 lines
Cheers, Ray Chuan
Quoted 4 lines · Tay Ray Chuan
On a closer reading, I realise that "reset" isn't mentioned if the branch exists.
The terser ternary version doesn't suffer from this defect.
Sorry, please ignore that.
Signature · 2 lines
Cheers, Ray Chuan
Quoted 6 lines · Ramkumar Ramachandra
Fix "Switched to a new branch <name>" to read "Switched to branch <name>" when <name> corresponds to an existing branch. This bug was introduced in 02ac983 while introducing the
-Bswitch.Cc Tay Ray Chuan <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>
Please see
Signature · 2 lines
Cheers, Ray Chuan
Hi Tay,
Quoted 6 lines · Tay Ray Chuan
Quoted 4 lines · Ramkumar Ramachandra
Fix "Switched to a new branch <name>" to read "Switched to branch <name>" when <name> corresponds to an existing branch. This bug was introduced in 02ac983 while introducing the
-Bswitch.
Quoted 6 lines
Quoted 2 lines
Cc Tay Ray Chuan <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>Please see
Ah yes. It looks like I missed this earlier. Sorry for the noise.
-- Ram
Quoted 6 lines · Tay Ray Chuan
Quoted 4 lines · Ramkumar Ramachandra
Fix "Switched to a new branch <name>" to read "Switched to branch <name>" when <name> corresponds to an existing branch. This bug was introduced in 02ac983 while introducing the
-Bswitch.
Quoted 6 lines
Quoted 2 lines
Cc Tay Ray Chuan <[email protected]>Signed-off-by Ramkumar Ramachandra <[email protected]>Please see
Hmm, I somehow find this version easier to read.