git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Elena Petrashen <elena.petrashen@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com, sunshine@sunshineco.com
Subject: Re: [PATCH v3][Outreachy] branch -D: allow - as abbreviation of @{-1}
Date: Thu, 31 Mar 2016 17:09:21 +0200	[thread overview]
Message-ID: <vpqwpoi1y72.fsf@anie.imag.fr> (raw)
In-Reply-To: <1459416327-795-1-git-send-email-elena.petrashen@gmail.com> (Elena Petrashen's message of "Thu, 31 Mar 2016 12:25:27 +0300")

Elena Petrashen <elena.petrashen@gmail.com> writes:

> --- a/advice.c
> +++ b/advice.c
> @@ -15,6 +15,7 @@ int advice_detached_head = 1;
>  int advice_set_upstream_failure = 1;
>  int advice_object_name_warning = 1;
>  int advice_rm_hints = 1;
> +int advice_delete_branch_via_at_ref = 1;
>  
>  static struct {
>  	const char *name;
> @@ -35,6 +36,7 @@ static struct {
>  	{ "setupstreamfailure", &advice_set_upstream_failure },
>  	{ "objectnamewarning", &advice_object_name_warning },
>  	{ "rmhints", &advice_rm_hints },
> +	{ "deletebranchviaatref", &advice_delete_branch_via_at_ref },
>  
>  	/* make this an alias for backward compatibility */
>  	{ "pushnonfastforward", &advice_push_update_rejected }

This is undocumented.

> +		expand_dash_shortcut (argv, i);
> +		if(!strncmp(argv[i], "@{-", strlen("@{-")))

Style: space after if.

We have a starts_with() function to avoid this strncmp(... strlen()) dance.

> @@ -262,6 +275,9 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
>  			       (flags & REF_ISBROKEN) ? "broken"
>  			       : (flags & REF_ISSYMREF) ? target
>  			       : find_unique_abbrev(sha1, DEFAULT_ABBREV));
> +			if (at_shortcut && advice_delete_branch_via_at_ref)
> +			       delete_branch_advice (bname.buf,
> +				find_unique_abbrev(sha1, DEFAULT_ABBREV));

Style: 1-space indent is not sufficient. Either align the arguments (not
applicable here) or indent by one tab to mark "I'm not done with
argument list".

Also, no space between delete_branch_advice and '('.

> +test_expect_success 'test deleting "-" deletes previous branch' '
> +	git checkout -b prev &&
> +	test_commit prev &&
> +	git checkout master &&
> +	git branch -D - >actual &&
> +	sha1=$(git rev-parse prev | cut -c 1-7) &&

Didn't this | cut ... turn into a --short in a previous version?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  reply	other threads:[~2016-03-31 15:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31  9:25 [PATCH v3][Outreachy] branch -D: allow - as abbreviation of @{-1} Elena Petrashen
2016-03-31 15:09 ` Matthieu Moy [this message]
2016-03-31 15:31 ` Remi Galan Alfonso
2016-04-04 20:31   ` elena petrashen
2016-04-04 21:53     ` Remi Galan Alfonso
2016-04-06 10:00       ` elena petrashen
2016-04-06 20:05         ` Remi Galan Alfonso
2016-03-31 19:26 ` Junio C Hamano
2016-04-06 10:42   ` elena petrashen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqwpoi1y72.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=elena.petrashen@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).